sop-extras-0.2.1.0: Type-level and data utilities that build upon SOP.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.SOP.Index

Synopsis

Indexing SOP types

data Index xs x where Source #

Constructors

IZIndex (x ': xs) x 
ISIndex xs x → Index (y ': xs) x 

dictIndexAllAll c xs ⇒ Proxy c → Index xs x → Dict c x Source #

indices ∷ ∀ xs. SListI xs ⇒ NP (Index xs) xs Source #

injectNS ∷ ∀ f x xs. Index xs x → f x → NS f xs Source #

injectNS' ∷ ∀ f a b x xs. (Coercible a (f x), Coercible b (NS f xs)) ⇒ Proxy f → Index xs x → a → b Source #

projectNPIndex xs x → NP f xs → f x Source #

Zipping with indices

hcimap ∷ (HAp h, All c xs, Prod h ~ NP) ⇒ proxy c → (∀ a. c a ⇒ Index xs a → f1 a → f2 a) → h f1 xs → h f2 xs Source #

hcizipWith ∷ (HAp h, All c xs, Prod h ~ NP) ⇒ proxy c → (∀ a. c a ⇒ Index xs a → f1 a → f2 a → f3 a) → NP f1 xs → h f2 xs → h f3 xs Source #

hcizipWith3 ∷ (HAp h, All c xs, Prod h ~ NP) ⇒ proxy c → (∀ a. c a ⇒ Index xs a → f1 a → f2 a → f3 a → f4 a) → NP f1 xs → NP f2 xs → h f3 xs → h f4 xs Source #

hcizipWith4 ∷ (HAp h, All c xs, Prod h ~ NP) ⇒ proxy c → (∀ a. c a ⇒ Index xs a → f1 a → f2 a → f3 a → f4 a → f5 a) → NP f1 xs → NP f2 xs → NP f3 xs → h f4 xs → h f5 xs Source #

himap ∷ (HAp h, SListI xs, Prod h ~ NP) ⇒ (∀ a. Index xs a → f1 a → f2 a) → h f1 xs → h f2 xs Source #

hizipWith ∷ (HAp h, SListI xs, Prod h ~ NP) ⇒ (∀ a. Index xs a → f1 a → f2 a → f3 a) → NP f1 xs → h f2 xs → h f3 xs Source #

hizipWith3 ∷ (HAp h, SListI xs, Prod h ~ NP) ⇒ (∀ a. Index xs a → f1 a → f2 a → f3 a → f4 a) → NP f1 xs → NP f2 xs → h f3 xs → h f4 xs Source #

hizipWith4 ∷ (HAp h, SListI xs, Prod h ~ NP) ⇒ (∀ a. Index xs a → f1 a → f2 a → f3 a → f4 a → f5 a) → NP f1 xs → NP f2 xs → NP f3 xs → h f4 xs → h f5 xs Source #

Indices with Word

npWithIndicesSListI xs ⇒ NP (K Word8) xs Source #

We only allow up to 23 (so counting from 0, 24 elements in xs), because CBOR stores a Word8 in the range 0-23 as a single byte equal to the value of the Word8.

nsFromIndexSListI xs ⇒ Word8Maybe (NS (K ()) xs) Source #

We only allow up to 23, see npWithIndices.

nsToIndexSListI xs ⇒ NS f xs → Word8 Source #

toWord8Index xs x → Word8 Source #