Safe Haskell | None |
---|---|
Language | Haskell2010 |
The HList library
(C) 2004, Oleg Kiselyov, Ralf Laemmel, Keean Schupke
Array-like access to HLists.
Synopsis
- class HLookupByHNat (n :: HNat) (l :: [*]) where
- type HLookupByHNatR (n :: HNat) (l :: [*]) :: *
- hLookupByHNat :: Proxy n -> HList l -> HLookupByHNatR n l
- class HDeleteAtHNat (n :: HNat) (l :: [*]) where
- type HDeleteAtHNatR (n :: HNat) (l :: [*]) :: [*]
- hDeleteAtHNat :: Proxy n -> HList l -> HList (HDeleteAtHNatR n l)
- class HUpdateAtHNat' n e l l => HUpdateAtHNat n e l where
- hUpdateAtHNat :: Proxy n -> e -> HList l -> HList (HUpdateAtHNatR n e l)
- class HUpdateAtHNat' (n :: HNat) e (l :: [*]) (l0 :: [*]) where
- type HUpdateAtHNatR (n :: HNat) e (l :: [*]) :: [*]
- hUpdateAtHNat' :: Proxy l0 -> Proxy n -> e -> HList l -> HList (HUpdateAtHNatR n e l)
- hProjectByHNats' :: forall (a :: [Type]) (b :: [Type]) r (l :: [Type]). (SameLength' a b, SameLength' b a, HMapAux r (FHLookupByHNat l) a b) => r a -> HList l -> r b
- newtype FHLookupByHNat (l :: [*]) = FHLookupByHNat (HList l)
- hProjectByHNats :: forall (ns :: [HNat]) a (z :: [Type]). (HUnfoldFD (FHUProj 'True ns) (ApplyR (FHUProj 'True ns) (a, Proxy 'HZero)) z, Apply (FHUProj 'True ns) (a, Proxy 'HZero)) => Proxy ns -> a -> HList z
- data FHUProj (sel :: Bool) (ns :: [HNat]) = FHUProj
- type family KMember (n :: HNat) (ns :: [HNat]) :: Bool
- type HProjectByHNatsR (ns :: [HNat]) (l :: [*]) = HUnfold (FHUProj True ns) (HList l, Proxy 'HZero)
- type HProjectByHNatsCtx ns l = (Apply (FHUProj True ns) (HList l, Proxy 'HZero), HUnfold' (FHUProj True ns) (HList l, Proxy 'HZero))
- hProjectAwayByHNats :: forall (ns :: [HNat]) a (z :: [Type]). (HUnfoldFD (FHUProj 'False ns) (ApplyR (FHUProj 'False ns) (a, Proxy 'HZero)) z, Apply (FHUProj 'False ns) (a, Proxy 'HZero)) => Proxy ns -> a -> HList z
- type HProjectAwayByHNatsR (ns :: [HNat]) (l :: [*]) = HUnfold (FHUProj False ns) (HList l, Proxy 'HZero)
- type HProjectAwayByHNatsCtx ns l = (Apply (FHUProj False ns) (HList l, Proxy 'HZero), HUnfold' (FHUProj False ns) (HList l, Proxy 'HZero))
- hSplitByHNats :: forall (ns :: [HNat]) a (z1 :: [Type]) (z2 :: [Type]). (HUnfoldFD (FHUProj 'True ns) (ApplyR (FHUProj 'True ns) (a, Proxy 'HZero)) z1, HUnfoldFD (FHUProj 'False ns) (ApplyR (FHUProj 'False ns) (a, Proxy 'HZero)) z2, Apply (FHUProj 'True ns) (a, Proxy 'HZero), Apply (FHUProj 'False ns) (a, Proxy 'HZero)) => Proxy ns -> a -> (HList z1, HList z2)
Lookup
class HLookupByHNat (n :: HNat) (l :: [*]) where Source #
type HLookupByHNatR (n :: HNat) (l :: [*]) :: * Source #
hLookupByHNat :: Proxy n -> HList l -> HLookupByHNatR n l Source #
Instances
HLookupByHNat 'HZero (e ': l) Source # | |
Defined in Data.HList.HArray type HLookupByHNatR 'HZero (e ': l) Source # hLookupByHNat :: Proxy 'HZero -> HList (e ': l) -> HLookupByHNatR 'HZero (e ': l) Source # | |
HLookupByHNat n l => HLookupByHNat ('HSucc n) (e ': l) Source # | |
Defined in Data.HList.HArray type HLookupByHNatR ('HSucc n) (e ': l) Source # hLookupByHNat :: Proxy ('HSucc n) -> HList (e ': l) -> HLookupByHNatR ('HSucc n) (e ': l) Source # |
Delete
class HDeleteAtHNat (n :: HNat) (l :: [*]) where Source #
type HDeleteAtHNatR (n :: HNat) (l :: [*]) :: [*] Source #
hDeleteAtHNat :: Proxy n -> HList l -> HList (HDeleteAtHNatR n l) Source #
Instances
HDeleteAtHNat 'HZero (e ': l) Source # | |
Defined in Data.HList.HArray type HDeleteAtHNatR 'HZero (e ': l) :: [Type] Source # hDeleteAtHNat :: Proxy 'HZero -> HList (e ': l) -> HList (HDeleteAtHNatR 'HZero (e ': l)) Source # | |
HDeleteAtHNat n l => HDeleteAtHNat ('HSucc n) (e ': l) Source # | |
Defined in Data.HList.HArray type HDeleteAtHNatR ('HSucc n) (e ': l) :: [Type] Source # hDeleteAtHNat :: Proxy ('HSucc n) -> HList (e ': l) -> HList (HDeleteAtHNatR ('HSucc n) (e ': l)) Source # |
Update
class HUpdateAtHNat' n e l l => HUpdateAtHNat n e l where Source #
hUpdateAtHNat :: Proxy n -> e -> HList l -> HList (HUpdateAtHNatR n e l) Source #
Instances
HUpdateAtHNat' n e l l => HUpdateAtHNat n e l Source # | |
Defined in Data.HList.HArray hUpdateAtHNat :: Proxy n -> e -> HList l -> HList (HUpdateAtHNatR n e l) Source # |
class HUpdateAtHNat' (n :: HNat) e (l :: [*]) (l0 :: [*]) where Source #
type HUpdateAtHNatR (n :: HNat) e (l :: [*]) :: [*] Source #
hUpdateAtHNat' :: Proxy l0 -> Proxy n -> e -> HList l -> HList (HUpdateAtHNatR n e l) Source #
Instances
Fail (HNatIndexTooLarge n HList l0) => HUpdateAtHNat' n e1 ('[] :: [Type]) l0 Source # | |
Defined in Data.HList.HArray type HUpdateAtHNatR n e1 '[] :: [Type] Source # hUpdateAtHNat' :: Proxy l0 -> Proxy n -> e1 -> HList '[] -> HList (HUpdateAtHNatR n e1 '[]) Source # | |
HUpdateAtHNat' 'HZero e1 (e ': l) l0 Source # | |
Defined in Data.HList.HArray type HUpdateAtHNatR 'HZero e1 (e ': l) :: [Type] Source # hUpdateAtHNat' :: Proxy l0 -> Proxy 'HZero -> e1 -> HList (e ': l) -> HList (HUpdateAtHNatR 'HZero e1 (e ': l)) Source # | |
HUpdateAtHNat' n e1 l l0 => HUpdateAtHNat' ('HSucc n) e1 (e ': l) l0 Source # | |
Defined in Data.HList.HArray type HUpdateAtHNatR ('HSucc n) e1 (e ': l) :: [Type] Source # hUpdateAtHNat' :: Proxy l0 -> Proxy ('HSucc n) -> e1 -> HList (e ': l) -> HList (HUpdateAtHNatR ('HSucc n) e1 (e ': l)) Source # |
Projection
hProjectByHNats' :: forall (a :: [Type]) (b :: [Type]) r (l :: [Type]). (SameLength' a b, SameLength' b a, HMapAux r (FHLookupByHNat l) a b) => r a -> HList l -> r b Source #
newtype FHLookupByHNat (l :: [*]) Source #
FHLookupByHNat (HList l) |
Instances
HLookupByHNat n l => Apply (FHLookupByHNat l) (Proxy n) Source # | |
Defined in Data.HList.HArray type ApplyR (FHLookupByHNat l) (Proxy n) Source # apply :: FHLookupByHNat l -> Proxy n -> ApplyR (FHLookupByHNat l) (Proxy n) Source # | |
type ApplyR (FHLookupByHNat l) (Proxy n) Source # | |
Defined in Data.HList.HArray |
hProjectByHNats :: forall (ns :: [HNat]) a (z :: [Type]). (HUnfoldFD (FHUProj 'True ns) (ApplyR (FHUProj 'True ns) (a, Proxy 'HZero)) z, Apply (FHUProj 'True ns) (a, Proxy 'HZero)) => Proxy ns -> a -> HList z Source #
data FHUProj (sel :: Bool) (ns :: [HNat]) Source #
Instances
Apply (FHUProj sel ns) (HList l, Proxy ('HSucc n)) => Apply (Proxy 'False, FHUProj sel ns) (HList (e ': l), Proxy n) Source # | |
Apply (Proxy 'True, FHUProj sel ns) (HList (e ': l), Proxy n) Source # | |
(ch ~ Proxy (HBoolEQ sel (KMember n ns)), Apply (ch, FHUProj sel ns) (HList (e ': l), Proxy n)) => Apply (FHUProj sel ns) (HList (e ': l), Proxy n) Source # | |
Apply (FHUProj sel ns) (HList ('[] :: [Type]), n) Source # | |
type ApplyR (Proxy 'False, FHUProj sel ns) (HList (e ': l), Proxy n) Source # | |
type ApplyR (Proxy 'True, FHUProj sel ns) (HList (e ': l), Proxy n) Source # | |
type ApplyR (FHUProj sel ns) (HList ('[] :: [Type]), n) Source # | |
type ApplyR (FHUProj sel ns) (HList (e ': l), Proxy n) Source # | |
type HProjectByHNatsR (ns :: [HNat]) (l :: [*]) = HUnfold (FHUProj True ns) (HList l, Proxy 'HZero) Source #
type HProjectByHNatsCtx ns l = (Apply (FHUProj True ns) (HList l, Proxy 'HZero), HUnfold' (FHUProj True ns) (HList l, Proxy 'HZero)) Source #
Complement of Projection
hProjectAwayByHNats :: forall (ns :: [HNat]) a (z :: [Type]). (HUnfoldFD (FHUProj 'False ns) (ApplyR (FHUProj 'False ns) (a, Proxy 'HZero)) z, Apply (FHUProj 'False ns) (a, Proxy 'HZero)) => Proxy ns -> a -> HList z Source #
type HProjectAwayByHNatsR (ns :: [HNat]) (l :: [*]) = HUnfold (FHUProj False ns) (HList l, Proxy 'HZero) Source #
type HProjectAwayByHNatsCtx ns l = (Apply (FHUProj False ns) (HList l, Proxy 'HZero), HUnfold' (FHUProj False ns) (HList l, Proxy 'HZero)) Source #
Splitting
hSplitByHNats :: forall (ns :: [HNat]) a (z1 :: [Type]) (z2 :: [Type]). (HUnfoldFD (FHUProj 'True ns) (ApplyR (FHUProj 'True ns) (a, Proxy 'HZero)) z1, HUnfoldFD (FHUProj 'False ns) (ApplyR (FHUProj 'False ns) (a, Proxy 'HZero)) z2, Apply (FHUProj 'True ns) (a, Proxy 'HZero), Apply (FHUProj 'False ns) (a, Proxy 'HZero)) => Proxy ns -> a -> (HList z1, HList z2) Source #
Splitting an array according to indices