Skip to content

Newtype type class with compiler generated instances

Define a Newtype class, autmatically generating instances

class Newtype n where
  type O n :: Type

  pack   :: O n -> n
  unpack :: n   -> O n

as defined in Conal's Generic parallel functional programming but also found in the newtype and lens packages.

I run into this class every once in a while

Trac metadata
Trac field Value
Version 8.0.1
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information