HList-0.5.2.0: Heterogeneous lists
Safe HaskellNone
LanguageHaskell2010

Data.HList.TIC

Description

The HList library

(C) 2004, Oleg Kiselyov, Ralf Laemmel, Keean Schupke

Type-indexed co-products. The public interface is exposed in CommonMain#TIC

(There are other ways: see ConsUnion.hs, for example)

Synopsis

Documentation

newtype TIC (l :: [*]) Source #

A datatype for type-indexed co-products. A TIC is just a Variant, where the elements of the type-level list "l" are in the form Tagged x x.

Constructors

TIC (Variant l) 

Instances

Instances details
TypeIndexed Variant TIC Source # 
Instance details

Defined in Data.HList.TIC

Methods

typeIndexed :: forall p f (s :: [Type]) (t :: [Type]) (a :: [Type]) (b :: [Type]). (TypeIndexedCxt s t a b, Profunctor p, Functor f) => p (TIC (TagR a)) (f (TIC (TagR b))) -> p (Variant s) (f (Variant t)) Source #

HMapAux Variant f xs ys => HMapAux TIC f xs ys Source # 
Instance details

Defined in Data.HList.TIC

Methods

hMapAux :: f -> TIC xs -> TIC ys Source #

(TICPrism s t a b, Label x ~ Label a, a ~ b, s ~ t, SameLength s t) => Labelable (x :: k) TIC s t a b Source #
hLens' :: Label a -> Prism' (TIC s) a

note that a more general function ticPrism :: Prism (TIC s) (TIC t) a b, cannot have an instance of Labelable

Note: `x :: k` according to the instance head, but the instance body forces the kind variable to be * later on. IE. (k ~ *)

Instance details

Defined in Data.HList.Labelable

Associated Types

type LabelableTy TIC :: LabeledOpticType Source #

Methods

hLens' :: Label x -> LabeledOptic x TIC s t a b Source #

(HasField o (TIC l) mo, mo ~ Maybe o) => HOccurs mo (TIC l) Source # 
Instance details

Defined in Data.HList.TIC

Methods

hOccurs :: TIC l -> mo Source #

(me ~ Maybe e, HOccursNot (Tagged e e) l) => HExtend me (TIC l) Source #
Nothing .*. x = x
Just a .*. y = mkTIC a
Instance details

Defined in Data.HList.TIC

Associated Types

type HExtendR me (TIC l) Source #

Methods

(.*.) :: me -> TIC l -> HExtendR me (TIC l) Source #

Bounded (Variant l) => Bounded (TIC l) Source # 
Instance details

Defined in Data.HList.TIC

Methods

minBound :: TIC l #

maxBound :: TIC l #

Enum (Variant l) => Enum (TIC l) Source # 
Instance details

Defined in Data.HList.TIC

Methods

succ :: TIC l -> TIC l #

pred :: TIC l -> TIC l #

toEnum :: Int -> TIC l #

fromEnum :: TIC l -> Int #

enumFrom :: TIC l -> [TIC l] #

enumFromThen :: TIC l -> TIC l -> [TIC l] #

enumFromTo :: TIC l -> TIC l -> [TIC l] #

enumFromThenTo :: TIC l -> TIC l -> TIC l -> [TIC l] #

Eq (Variant l) => Eq (TIC l) Source # 
Instance details

Defined in Data.HList.TIC

Methods

(==) :: TIC l -> TIC l -> Bool #

(/=) :: TIC l -> TIC l -> Bool #

(TypeablePolyK xs, Typeable (Variant xs), Data (Variant xs)) => Data (TIC xs) 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) -> 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) #

Ord (Variant l) => Ord (TIC l) Source # 
Instance details

Defined in Data.HList.TIC

Methods

compare :: TIC l -> TIC l -> Ordering #

(<) :: TIC l -> TIC l -> Bool #

(<=) :: TIC l -> TIC l -> Bool #

(>) :: TIC l -> TIC l -> Bool #

(>=) :: TIC l -> TIC l -> Bool #

max :: TIC l -> TIC l -> TIC l #

min :: TIC l -> TIC l -> TIC l #

(ReadVariant l, HAllTaggedEq l, HRLabelSet l) => Read (TIC l) Source # 
Instance details

Defined in Data.HList.TIC

ShowVariant l => Show (TIC l) Source #

TICs are not opaque

Instance details

Defined in Data.HList.TIC

Methods

showsPrec :: Int -> TIC l -> ShowS #

show :: TIC l -> String #

showList :: [TIC l] -> ShowS #

Ix (Variant l) => Ix (TIC l) Source # 
Instance details

Defined in Data.HList.TIC

Methods

range :: (TIC l, TIC l) -> [TIC l] #

index :: (TIC l, TIC l) -> TIC l -> Int #

unsafeIndex :: (TIC l, TIC l) -> TIC l -> Int #

inRange :: (TIC l, TIC l) -> TIC l -> Bool #

rangeSize :: (TIC l, TIC l) -> Int #

unsafeRangeSize :: (TIC l, TIC l) -> Int #

Semigroup (Variant l) => Semigroup (TIC l) Source # 
Instance details

Defined in Data.HList.TIC

Methods

(<>) :: TIC l -> TIC l -> TIC l #

sconcat :: NonEmpty (TIC l) -> TIC l #

stimes :: Integral b => b -> TIC l -> TIC l #

Monoid (Variant l) => Monoid (TIC l) Source # 
Instance details

Defined in Data.HList.TIC

Methods

mempty :: TIC l #

mappend :: TIC l -> TIC l -> TIC l #

mconcat :: [TIC l] -> TIC l #

HasField o (Variant l) (Maybe o) => HasField (o :: Type) (TIC l) (Maybe o) Source #

Public destructor (or, open union's projection function)

Instance details

Defined in Data.HList.TIC

Methods

hLookupByLabel :: Label o -> TIC l -> Maybe o Source #

type LabelableTy TIC Source # 
Instance details

Defined in Data.HList.Labelable

type HExtendR me (TIC l) Source # 
Instance details

Defined in Data.HList.TIC

type HExtendR me (TIC l) = TIC (Tagged (UnMaybe me) (UnMaybe me) ': l)

ticVariant :: forall p f (l1 :: [Type]) (l2 :: [Type]). (Profunctor p, Functor f) => p (Variant l1) (f (Variant l2)) -> p (TIC l1) (f (TIC l2)) Source #

Iso (TIC s) (TIC t) (Variant s) (Variant t)

typeIndexed may be more appropriate

ticVariant' :: forall p f (l :: [Type]). (Profunctor p, Functor f) => p (Variant l) (f (Variant l)) -> p (TIC l) (f (TIC l)) Source #

Iso' (TIC s) (Variant s)

class TypeIndexed r tr | r -> tr, tr -> r where Source #

Conversion between type indexed collections (TIC and TIP) and the corresponding collection that has other label types (Variant and Record respectively)

See typeIndexed'

Methods

typeIndexed :: forall p f s t a b. (TypeIndexedCxt s t a b, Profunctor p, Functor f) => p (tr (TagR a)) (f (tr (TagR b))) -> p (r s) (f (r t)) Source #

Iso (r s) (r t) (tr a) (tr b)

Instances

Instances details
TypeIndexed Record TIP Source # 
Instance details

Defined in Data.HList.TIC

Methods

typeIndexed :: forall p f (s :: [Type]) (t :: [Type]) (a :: [Type]) (b :: [Type]). (TypeIndexedCxt s t a b, Profunctor p, Functor f) => p (TIP (TagR a)) (f (TIP (TagR b))) -> p (Record s) (f (Record t)) Source #

TypeIndexed Variant TIC Source # 
Instance details

Defined in Data.HList.TIC

Methods

typeIndexed :: forall p f (s :: [Type]) (t :: [Type]) (a :: [Type]) (b :: [Type]). (TypeIndexedCxt s t a b, Profunctor p, Functor f) => p (TIC (TagR a)) (f (TIC (TagR b))) -> p (Variant s) (f (Variant t)) Source #

typeIndexed' :: forall r tr (t :: [Type]) p f. (TypeIndexed r tr, HMapAux HList TaggedFn (RecordValuesR t) t, RecordValues t, SameLabels t t, HAllTaggedLV t, HLabelSet (LabelsOf t), TagUntagFD (RecordValuesR t) (TagR (RecordValuesR t)), Profunctor p, Functor f, SameLength' t t, SameLength' (RecordValuesR t) (RecordValuesR t), Coercible (TagR (RecordValuesR t)) t) => p (tr (TagR (RecordValuesR t))) (f (tr (TagR (RecordValuesR t)))) -> p (r t) (f (r t)) Source #

Iso' (Variant s) (TIC a)
Iso' (Record s) (TIP a)

where s has a type like '[Tagged "x" Int], and a has a type like '[Tagged Int Int].

mkTIC' Source #

Arguments

:: forall i l proxy. (HTypeIndexed l, MkVariant i i l) 
=> i 
-> proxy l

the ordering of types in the l :: [*] matters. This argument is intended to fix the ordering it can be a Record, Variant, TIP, Proxy

-> TIC l 

Public constructor (or, open union's injection function)

mkTIC1 :: forall i. MkVariant i i '[Tagged i i] => i -> TIC '[Tagged i i] Source #

make a TIC that contains one element

mkTIC :: forall i (l :: [Type]) (n :: HNat). (HFind1 i (UnLabel i (LabelsOf l)) (UnLabel i (LabelsOf l)) n, HasField i (Record l) i, KnownNat (HNat2Nat n), HAllTaggedLV l, HLabelSet (LabelsOf l), HAllTaggedEq l) => i -> TIC l Source #

make a TIC for use in contexts where the result type is fixed

class TICPrism s t a b | s a b -> t, t a b -> s where Source #

similar to HPrism

Methods

ticPrism :: (SameLength s t, Choice p, Applicative f) => (a `p` f b) -> TIC s `p` f (TIC t) Source #

Instances

Instances details
(MkVariant b b t, HasField a (Variant s) (Maybe a), SameLength s t, HFindLabel b t n, HFindLabel a s n, HUpdateAtHNatR n (Tagged b b) s ~ t, HUpdateAtHNatR n (Tagged a a) t ~ s) => TICPrism s t a b Source # 
Instance details

Defined in Data.HList.TIC

Methods

ticPrism :: (SameLength s t, Choice p, Applicative f) => p a (f b) -> p (TIC s) (f (TIC t)) Source #

ticPrism' :: forall s t a b. (HPrism a s t a b, a ~ b, s ~ t) => forall f p. (Applicative f, Choice p) => (a `p` f b) -> TIC s `p` f (TIC t) Source #

Prism' (TIC s) a