generic-data-0.5.0.0: Utilities for GHC.Generics

Safe HaskellNone
LanguageHaskell2010

Generic.Data.Internal.Newtype

Description

Pack/unpack newtypes.

Synopsis

Documentation

class (Generic a, Coercible a (Old a), Newtype' a) => Newtype a Source #

Class of newtypes.

Instances
(Generic a, Coercible a (Old a), Newtype' a) => Newtype a Source # 
Instance details

Defined in Generic.Data.Internal.Newtype

type Old a = GOld (Rep a) Source #

type family GOld (f :: * -> *) where ... Source #

Equations

GOld (D1 _d (C1 _c (S1 _s (K1 _i b)))) = b 

type family NewtypeErr a (b :: Bool) :: Constraint where ... Source #

Equations

NewtypeErr a True = () 
NewtypeErr a False = TypeError ((Text "The type " :<>: ShowType a) :<>: Text " is not a newtype.") 

unpack :: Newtype a => a -> Old a Source #

Generic newtype destructor.

pack :: Newtype a => Old a -> a Source #

Generic newtype constructor.