Copyright | (c) Fumiaki Kinoshita 2017 |
---|---|
License | BSD3 |
Maintainer | Fumiaki Kinoshita <fumiexcel@gmail.com> |
Safe Haskell | None |
Language | Haskell2010 |
- class (Functor f, Profunctor p) => Extensible f p (t :: (k -> *) -> [k] -> *) where
- type ExtensibleConstr t (h :: k -> *) (xs :: [k]) (x :: k) :: Constraint
- piece :: (x ∈ xs, Extensible f p t, ExtensibleConstr t h xs x) => Optic' p f (t h xs) (h x)
- pieceAssoc :: (Associate k v xs, Extensible f p t, ExtensibleConstr t h xs (k :> v)) => Optic' p f (t h xs) (h (k :> v))
- itemAt :: (Wrapper h, Extensible f p t, ExtensibleConstr t h xs x) => Membership xs x -> Optic' p f (t h xs) (Repr h x)
- item :: (Wrapper h, Extensible f p t, x ∈ xs, ExtensibleConstr t h xs x) => proxy x -> Optic' p f (t h xs) (Repr h x)
- itemAssoc :: (Wrapper h, Extensible f p t, Associate k v xs, ExtensibleConstr t h xs (k :> v)) => proxy k -> Optic' p f (t h xs) (Repr h (k :> v))
- data Membership (xs :: [k]) (x :: k)
- mkMembership :: Int -> Q Exp
- compareMembership :: Membership xs x -> Membership xs y -> Either Ordering (x :~: y)
- leadership :: Membership (y ': xs) x -> ((x :~: y) -> r) -> (Membership xs x -> r) -> r
- class Member xs x where
- remember :: forall xs x r. Membership xs x -> (Member xs x => r) -> r
- type (∈) x xs = Member xs x
- type family FindType (x :: k) (xs :: [k]) :: [Nat] where ...
- class Generate (xs :: [k]) where
- class (ForallF c xs, Generate xs) => Forall (c :: k -> Constraint) (xs :: [k]) where
- type family ForallF (c :: k -> Constraint) (xs :: [k]) :: Constraint where ...
- data Assoc k v = k :> v
- type (>:) = (:>)
- class Associate k v xs | k xs -> v where
- type family FindAssoc (n :: Nat) (key :: k) (xs :: [Assoc k v]) where ...
- type family Elaborate (key :: k) (xs :: [v]) :: Elaborated k v where ...
- data Elaborated k v
Class
class (Functor f, Profunctor p) => Extensible f p (t :: (k -> *) -> [k] -> *) where Source #
This class allows us to use pieceAt
for both sums and products.
type ExtensibleConstr t (h :: k -> *) (xs :: [k]) (x :: k) :: Constraint Source #
pieceAt :: ExtensibleConstr t h xs x => Membership xs x -> Optic' p f (t h xs) (h x) Source #
(Applicative f, Choice p) => Extensible k f p ((:|) k) Source # | |
(Corepresentable p, Comonad (Corep p), Functor f) => Extensible k f p ((:*) k) Source # | |
(Functor f, Profunctor p) => Extensible k f p (Inextensible k) Source # | |
(Corepresentable p, Comonad (Corep p), Functor f) => Extensible k f p (BitProd k r) Source # | |
piece :: (x ∈ xs, Extensible f p t, ExtensibleConstr t h xs x) => Optic' p f (t h xs) (h x) Source #
Accessor for an element.
pieceAssoc :: (Associate k v xs, Extensible f p t, ExtensibleConstr t h xs (k :> v)) => Optic' p f (t h xs) (h (k :> v)) Source #
Like piece
, but reckon membership from its key.
itemAt :: (Wrapper h, Extensible f p t, ExtensibleConstr t h xs x) => Membership xs x -> Optic' p f (t h xs) (Repr h x) Source #
Access a specified element through a wrapper.
item :: (Wrapper h, Extensible f p t, x ∈ xs, ExtensibleConstr t h xs x) => proxy x -> Optic' p f (t h xs) (Repr h x) Source #
Access an element through a wrapper.
itemAssoc :: (Wrapper h, Extensible f p t, Associate k v xs, ExtensibleConstr t h xs (k :> v)) => proxy k -> Optic' p f (t h xs) (Repr h (k :> v)) Source #
Access an element specified by the key type through a wrapper.
Membership
data Membership (xs :: [k]) (x :: k) Source #
The position of x
in the type level set xs
.
Eq (Membership k xs x) Source # | |
Ord (Membership k xs x) Source # | |
Show (Membership k xs x) Source # | |
Semigroup (Membership k xs x) Source # | |
Hashable (Membership k xs x) Source # | |
NFData (Membership k xs x) Source # | |
mkMembership :: Int -> Q Exp Source #
Generates a Membership
that corresponds to the given ordinal (0-origin).
compareMembership :: Membership xs x -> Membership xs y -> Either Ordering (x :~: y) Source #
Compare two Membership
s.
leadership :: Membership (y ': xs) x -> ((x :~: y) -> r) -> (Membership xs x -> r) -> r Source #
Embodies a type equivalence to ensure that the Membership
points the first element.
Member
remember :: forall xs x r. Membership xs x -> (Member xs x => r) -> r Source #
Remember that Member xs x
from Membership
.
Generation
class Generate (xs :: [k]) where Source #
Every type-level list is an instance of Generate
.
henumerate :: (forall x. Membership xs x -> r -> r) -> r -> r Source #
Enumerate all possible Membership
s of xs
.
hcount :: proxy xs -> Int Source #
Count the number of memberships.
hgenerateList :: Applicative f => (forall x. Membership xs x -> f (h x)) -> f (HList h xs) Source #
Enumerate Membership
s and construct an HList
.
class (ForallF c xs, Generate xs) => Forall (c :: k -> Constraint) (xs :: [k]) where Source #
Every element in xs
satisfies c
henumerateFor :: proxy c -> proxy' xs -> (forall x. c x => Membership xs x -> r -> r) -> r -> r Source #
Enumerate all possible Membership
s of xs
with an additional context.
hgenerateListFor :: Applicative f => proxy c -> (forall x. c x => Membership xs x -> f (h x)) -> f (HList h xs) Source #
type family ForallF (c :: k -> Constraint) (xs :: [k]) :: Constraint where ... Source #
Association
The kind of key-value pairs
k :> v infix 0 |
class Associate k v xs | k xs -> v where Source #
is essentially identical to Associate
k v xs(k :> v) ∈ xs
, but the type v
is inferred from k
and xs
.
association :: Membership xs (k :> v) Source #
Sugar
type family Elaborate (key :: k) (xs :: [v]) :: Elaborated k v where ... Source #