HList-0.5.2.0: Heterogeneous lists
Safe HaskellNone
LanguageHaskell2010

Data.HList.HArray

Description

The HList library

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

Array-like access to HLists.

Synopsis

Lookup

class HLookupByHNat (n :: HNat) (l :: [*]) where Source #

Associated Types

type HLookupByHNatR (n :: HNat) (l :: [*]) :: * Source #

Instances

Instances details
HLookupByHNat 'HZero (e ': l) Source # 
Instance details

Defined in Data.HList.HArray

Associated Types

type HLookupByHNatR 'HZero (e ': l) Source #

Methods

hLookupByHNat :: Proxy 'HZero -> HList (e ': l) -> HLookupByHNatR 'HZero (e ': l) Source #

HLookupByHNat n l => HLookupByHNat ('HSucc n) (e ': l) Source # 
Instance details

Defined in Data.HList.HArray

Associated Types

type HLookupByHNatR ('HSucc n) (e ': l) Source #

Methods

hLookupByHNat :: Proxy ('HSucc n) -> HList (e ': l) -> HLookupByHNatR ('HSucc n) (e ': l) Source #

Delete

class HDeleteAtHNat (n :: HNat) (l :: [*]) where Source #

Associated Types

type HDeleteAtHNatR (n :: HNat) (l :: [*]) :: [*] Source #

Instances

Instances details
HDeleteAtHNat 'HZero (e ': l) Source # 
Instance details

Defined in Data.HList.HArray

Associated Types

type HDeleteAtHNatR 'HZero (e ': l) :: [Type] Source #

Methods

hDeleteAtHNat :: Proxy 'HZero -> HList (e ': l) -> HList (HDeleteAtHNatR 'HZero (e ': l)) Source #

HDeleteAtHNat n l => HDeleteAtHNat ('HSucc n) (e ': l) Source # 
Instance details

Defined in Data.HList.HArray

Associated Types

type HDeleteAtHNatR ('HSucc n) (e ': l) :: [Type] Source #

Methods

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 #

Methods

hUpdateAtHNat :: Proxy n -> e -> HList l -> HList (HUpdateAtHNatR n e l) Source #

Instances

Instances details
HUpdateAtHNat' n e l l => HUpdateAtHNat n e l Source # 
Instance details

Defined in Data.HList.HArray

Methods

hUpdateAtHNat :: Proxy n -> e -> HList l -> HList (HUpdateAtHNatR n e l) Source #

class HUpdateAtHNat' (n :: HNat) e (l :: [*]) (l0 :: [*]) where Source #

Associated Types

type HUpdateAtHNatR (n :: HNat) e (l :: [*]) :: [*] Source #

Methods

hUpdateAtHNat' :: Proxy l0 -> Proxy n -> e -> HList l -> HList (HUpdateAtHNatR n e l) Source #

Instances

Instances details
Fail (HNatIndexTooLarge n HList l0) => HUpdateAtHNat' n e1 ('[] :: [Type]) l0 Source # 
Instance details

Defined in Data.HList.HArray

Associated Types

type HUpdateAtHNatR n e1 '[] :: [Type] Source #

Methods

hUpdateAtHNat' :: Proxy l0 -> Proxy n -> e1 -> HList '[] -> HList (HUpdateAtHNatR n e1 '[]) Source #

HUpdateAtHNat' 'HZero e1 (e ': l) l0 Source # 
Instance details

Defined in Data.HList.HArray

Associated Types

type HUpdateAtHNatR 'HZero e1 (e ': l) :: [Type] Source #

Methods

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 # 
Instance details

Defined in Data.HList.HArray

Associated Types

type HUpdateAtHNatR ('HSucc n) e1 (e ': l) :: [Type] Source #

Methods

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 #

Constructors

FHLookupByHNat (HList l) 

Instances

Instances details
HLookupByHNat n l => Apply (FHLookupByHNat l) (Proxy n) Source # 
Instance details

Defined in Data.HList.HArray

Associated Types

type ApplyR (FHLookupByHNat l) (Proxy n) Source #

type ApplyR (FHLookupByHNat l) (Proxy n) Source # 
Instance details

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 #

Constructors

FHUProj 

Instances

Instances details
Apply (FHUProj sel ns) (HList l, Proxy ('HSucc n)) => Apply (Proxy 'False, FHUProj sel ns) (HList (e ': l), Proxy n) Source # 
Instance details

Defined in Data.HList.HArray

Associated Types

type ApplyR (Proxy 'False, FHUProj sel ns) (HList (e ': l), Proxy n) Source #

Methods

apply :: (Proxy 'False, FHUProj sel ns) -> (HList (e ': l), Proxy n) -> ApplyR (Proxy 'False, FHUProj sel ns) (HList (e ': l), Proxy n) Source #

Apply (Proxy 'True, FHUProj sel ns) (HList (e ': l), Proxy n) Source # 
Instance details

Defined in Data.HList.HArray

Associated Types

type ApplyR (Proxy 'True, FHUProj sel ns) (HList (e ': l), Proxy n) Source #

Methods

apply :: (Proxy 'True, FHUProj sel ns) -> (HList (e ': l), Proxy n) -> ApplyR (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 # 
Instance details

Defined in Data.HList.HArray

Associated Types

type ApplyR (FHUProj sel ns) (HList (e ': l), Proxy n) Source #

Methods

apply :: FHUProj sel ns -> (HList (e ': l), Proxy n) -> ApplyR (FHUProj sel ns) (HList (e ': l), Proxy n) Source #

Apply (FHUProj sel ns) (HList ('[] :: [Type]), n) Source # 
Instance details

Defined in Data.HList.HArray

Associated Types

type ApplyR (FHUProj sel ns) (HList '[], n) Source #

Methods

apply :: FHUProj sel ns -> (HList '[], n) -> ApplyR (FHUProj sel ns) (HList '[], n) Source #

type ApplyR (Proxy 'False, FHUProj sel ns) (HList (e ': l), Proxy n) Source # 
Instance details

Defined in Data.HList.HArray

type ApplyR (Proxy 'False, FHUProj sel ns) (HList (e ': l), Proxy n) = ApplyR (FHUProj sel ns) (HList l, Proxy ('HSucc n))
type ApplyR (Proxy 'True, FHUProj sel ns) (HList (e ': l), Proxy n) Source # 
Instance details

Defined in Data.HList.HArray

type ApplyR (Proxy 'True, FHUProj sel ns) (HList (e ': l), Proxy n) = HJust (e, (HList l, Proxy ('HSucc n)))
type ApplyR (FHUProj sel ns) (HList ('[] :: [Type]), n) Source # 
Instance details

Defined in Data.HList.HArray

type ApplyR (FHUProj sel ns) (HList ('[] :: [Type]), n) = HNothing
type ApplyR (FHUProj sel ns) (HList (e ': l), Proxy n) Source # 
Instance details

Defined in Data.HList.HArray

type ApplyR (FHUProj sel ns) (HList (e ': l), Proxy n) = ApplyR (Proxy (HBoolEQ sel (KMember n ns)), FHUProj sel ns) (HList (e ': l), Proxy n)

type family KMember (n :: HNat) (ns :: [HNat]) :: Bool Source #

Instances

Instances details
type KMember n ('[] :: [HNat]) Source # 
Instance details

Defined in Data.HList.HArray

type KMember n ('[] :: [HNat]) = 'False
type KMember n (n1 ': l) Source # 
Instance details

Defined in Data.HList.HArray

type KMember n (n1 ': l) = HOr (HNatEq n n1) (KMember n l)

type HProjectByHNatsR (ns :: [HNat]) (l :: [*]) = 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 #

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