Opened 10 years ago

Closed 10 years ago

#3928 closed proposal (fixed)

Turn SampleVar into an abstract newtype

Reported by: basvandijk Owned by:
Priority: normal Milestone:
Component: libraries/base Version: 6.12.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


a Control.Concurrent.SampleVar is currently a type synonym:

type SampleVar a = MVar (Int, MVar a)

This has two problems:

  • Users can "screw up" the internal state.
  • We can't define instances for SampleVars without using the

TypeSynonymInstances language extension.

My proposal is to turn SampleVar into an abstract newtype like:

newtype SampleVar a = SampleVar (MVar (Int, MVar a))

The related discussion on contains the patch that implements this:

Attachments (1)

samplevar.dpatch (32.2 KB) - added by basvandijk 10 years ago.

Download all attachments as: .zip

Change History (2)

Changed 10 years ago by basvandijk

Attachment: samplevar.dpatch added

comment:1 Changed 10 years ago by basvandijk

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.