Safe Haskell | None |
---|---|
Language | Haskell2010 |
Pack/unpack newtypes.
Synopsis
- class (Generic a, Coercible a (Old a), Newtype' a) => Newtype a
- type Old a = GOld (Rep a)
- type family GOld (f :: * -> *) where ...
- type Newtype' a = NewtypeErr a (MetaDataNewtype (MetaOf (Rep a)))
- type family NewtypeErr a (b :: Bool) :: Constraint where ...
- unpack :: Newtype a => a -> Old a
- pack :: Newtype a => Old a -> a
Documentation
class (Generic a, Coercible a (Old a), Newtype' a) => Newtype a Source #
type Old a = GOld (Rep a) Source #
The type wrapped by a newtype.
newtype Foo = Foo { bar :: Bar } deriving Generic
-- Old Foo ~ Bar
type Newtype' a = NewtypeErr a (MetaDataNewtype (MetaOf (Rep a))) Source #
Use Newtype
instead.
type family NewtypeErr a (b :: Bool) :: Constraint where ... Source #
NewtypeErr a True = () | |
NewtypeErr a False = TypeError ((Text "The type " :<>: ShowType a) :<>: Text " is not a newtype.") |