HList-0.5.3.0: Heterogeneous lists
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.HList.Data

Description

Data instances for HListFlat and Record which pretend to be flat data structures. The Data instance for HList gives a nested structure.

NOTE: these instances do not work with ghc-7.8 with promoted string (Symbol) labels because of https://ghc.haskell.org/trac/ghc/ticket/9111

HList

The data instance for

a :: HList '[Int, Double, b]

Looks like the same instance for

type T b = (Int, (Double, (b, ())))
HListFlat

The Data instance for

a :: Data b => HListFlat '[Int,Double,b]

will look like the Data instance for:

data A b = A Int Double b
Record

For Record similar ideas apply. An

a :: Record '[ LVPair "x" Int, LVPair "y" Double ]

should behave like a:

data A = A { x :: Int, y :: Double } deriving (Data)

Many unsafecoerces are necessary here because the Data class includes type parameters c that cannot be used in the class context for the instance. Perhaps there is another way.

Synopsis

exports for type signatures/ haddock usage

type DataHListFlatCxt na g a = (g ~ FoldRArrow a (HList a), HBuild' '[] g, Typeable (HListFlat a), TypeablePolyK a, HFoldl (GfoldlK C) (C g) a (C (HList a)), HFoldr (GunfoldK C) (C g) (HReplicateR na ()) (C (HList a)), HLengthEq a na, HReplicate na ()) Source #

class TypeRepsList a where Source #

Methods

typeRepsList :: a -> [TypeRep] Source #

Instances

Instances details
(TypeRepsList (HList xs), Typeable x) => TypeRepsList (HList (x ': xs)) Source # 
Instance details

Defined in Data.HList.Data

Methods

typeRepsList :: HList (x ': xs) -> [TypeRep] Source #

TypeRepsList (HList ('[] :: [Type])) Source # 
Instance details

Defined in Data.HList.Data

Methods

typeRepsList :: HList '[] -> [TypeRep] Source #

TypeRepsList (HList xs) => TypeRepsList (Record xs) Source # 
Instance details

Defined in Data.HList.Data

Methods

typeRepsList :: Record xs -> [TypeRep] Source #

less likely to be used

class RecordLabelsStr (xs :: [*]) where Source #

Instances

Instances details
RecordLabelsStr ('[] :: [Type]) Source # 
Instance details

Defined in Data.HList.Data

Methods

recordLabelsStr :: Record '[] -> [String] Source #

(RecordLabelsStr xs, ShowLabel x) => RecordLabelsStr (Tagged x t ': xs) Source # 
Instance details

Defined in Data.HList.Data

Methods

recordLabelsStr :: Record (Tagged x t ': xs) -> [String] Source #

data GfoldlK c where Source #

wraps up the first argument to gfoldl

Constructors

GfoldlK :: (forall d b. Data d => c (d -> b) -> d -> c b) -> GfoldlK c 

Instances

Instances details
(Data d, (c (d -> b), d) ~ x, c b ~ y) => ApplyAB (GfoldlK c) x y Source # 
Instance details

Defined in Data.HList.Data

Methods

applyAB :: GfoldlK c -> x -> y Source #

data GunfoldK c where Source #

Constructors

GunfoldK :: (forall b r. Data b => c (b -> r) -> c r) -> GunfoldK c 

Instances

Instances details
(Data b, x ~ (t, c (b -> r)), y ~ c r) => ApplyAB (GunfoldK c) x y Source # 
Instance details

Defined in Data.HList.Data

Methods

applyAB :: GunfoldK c -> x -> y Source #

newtype HListFlat a Source #

this data type only exists to have Data instance

Constructors

HListFlat (HList a) 

Instances

Instances details
DataHListFlatCxt na g a => Data (HListFlat a) Source # 
Instance details

Defined in Data.HList.Data

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> HListFlat a -> c (HListFlat a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (HListFlat a) #

toConstr :: HListFlat a -> Constr #

dataTypeOf :: HListFlat a -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (HListFlat a)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (HListFlat a)) #

gmapT :: (forall b. Data b => b -> b) -> HListFlat a -> HListFlat a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HListFlat a -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HListFlat a -> r #

gmapQ :: (forall d. Data d => d -> u) -> HListFlat a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> HListFlat a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> HListFlat a -> m (HListFlat a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HListFlat a -> m (HListFlat a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HListFlat a -> m (HListFlat a) #

type TypeablePolyK (a :: k) = Typeable a Source #

Orphan instances

(Data x, Data (HList xs), TypeablePolyK (x ': xs), Typeable (HList (x ': xs))) => Data (HList (x ': xs)) Source # 
Instance details

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> HList (x ': xs) -> c (HList (x ': xs)) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (HList (x ': xs)) #

toConstr :: HList (x ': xs) -> Constr #

dataTypeOf :: HList (x ': xs) -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (HList (x ': xs))) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (HList (x ': xs))) #

gmapT :: (forall b. Data b => b -> b) -> HList (x ': xs) -> HList (x ': xs) #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HList (x ': xs) -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HList (x ': xs) -> r #

gmapQ :: (forall d. Data d => d -> u) -> HList (x ': xs) -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> HList (x ': xs) -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> HList (x ': xs) -> m (HList (x ': xs)) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HList (x ': xs) -> m (HList (x ': xs)) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HList (x ': xs) -> m (HList (x ': xs)) #

Typeable (HList ('[] :: [Type])) => Data (HList ('[] :: [Type])) Source # 
Instance details

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> HList '[] -> c (HList '[]) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (HList '[]) #

toConstr :: HList '[] -> Constr #

dataTypeOf :: HList '[] -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (HList '[])) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (HList '[])) #

gmapT :: (forall b. Data b => b -> b) -> HList '[] -> HList '[] #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HList '[] -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HList '[] -> r #

gmapQ :: (forall d. Data d => d -> u) -> HList '[] -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> HList '[] -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> HList '[] -> m (HList '[]) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HList '[] -> m (HList '[]) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HList '[] -> m (HList '[]) #

DataRecordCxt a => Data (Record a) Source # 
Instance details

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Record a -> c (Record a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Record a) #

toConstr :: Record a -> Constr #

dataTypeOf :: Record a -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Record a)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Record a)) #

gmapT :: (forall b. Data b => b -> b) -> Record a -> Record a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Record a -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Record a -> r #

gmapQ :: (forall d. Data d => d -> u) -> Record a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Record a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Record a -> m (Record a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Record a -> m (Record a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Record a -> m (Record a) #

(TypeablePolyK xs, Typeable (Variant xs), Data (Variant xs)) => Data (TIC xs) Source # 
Instance details

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TIC xs -> c (TIC xs) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (TIC xs) #

toConstr :: TIC xs -> Constr #

dataTypeOf :: TIC xs -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (TIC xs)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (TIC xs)) #

gmapT :: (forall b. Data b => b -> b) -> TIC xs -> TIC xs #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TIC xs -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TIC xs -> r #

gmapQ :: (forall d. Data d => d -> u) -> TIC xs -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> TIC xs -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> TIC xs -> m (TIC xs) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TIC xs -> m (TIC xs) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TIC xs -> m (TIC xs) #

(TypeablePolyK xs, Typeable (HList xs), Data (HList xs)) => Data (TIP xs) Source # 
Instance details

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TIP xs -> c (TIP xs) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (TIP xs) #

toConstr :: TIP xs -> Constr #

dataTypeOf :: TIP xs -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (TIP xs)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (TIP xs)) #

gmapT :: (forall b. Data b => b -> b) -> TIP xs -> TIP xs #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TIP xs -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TIP xs -> r #

gmapQ :: (forall d. Data d => d -> u) -> TIP xs -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> TIP xs -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> TIP xs -> m (TIP xs) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TIP xs -> m (TIP xs) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TIP xs -> m (TIP xs) #