Copyright | (c) Fumiaki Kinoshita 2015 |
---|---|
License | BSD3 |
Maintainer | Fumiaki Kinoshita <[email protected]> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Data.Extensible.Product
Contents
Description
- data h :* s where
- (<:*) :: forall h x xs. h x -> (h :* xs) -> h :* (x : xs)
- hhead :: (h :* (x : xs)) -> h x
- htail :: (h :* (x : xs)) -> h :* xs
- huncons :: forall h x xs. (h :* (x : xs)) -> (h x, h :* xs)
- hmap :: (forall x. g x -> h x) -> (g :* xs) -> h :* xs
- hzipWith :: (forall x. f x -> g x -> h x) -> (f :* xs) -> (g :* xs) -> h :* xs
- hzipWith3 :: (forall x. f x -> g x -> h x -> i x) -> (f :* xs) -> (g :* xs) -> (h :* xs) -> i :* xs
- hfoldMap :: Monoid a => (forall x. h x -> a) -> (h :* xs) -> a
- htraverse :: Applicative f => (forall x. h x -> f (h x)) -> (h :* xs) -> f (h :* xs)
- hlookup :: Position xs x -> (h :* xs) -> h x
- sector :: (Functor f, x ∈ xs) => (h x -> f (h x)) -> (h :* xs) -> f (h :* xs)
- sectorAt :: forall h x xs f. Functor f => Position xs x -> (h x -> f (h x)) -> (h :* xs) -> f (h :* xs)
- class Generate xs where
- class Forall c xs where
- generateFor :: Proxy c -> (forall x. c x => Position xs x -> h x) -> h :* xs
- class c (h x) => ClassComp c h x
Product
The extensible product type
(<:*) :: forall h x xs. h x -> (h :* xs) -> h :* (x : xs) infixr 5 Source
O(log n) Add an element to a product.
huncons :: forall h x xs. (h :* (x : xs)) -> (h x, h :* xs) Source
Split a product to the head and the tail.
hmap :: (forall x. g x -> h x) -> (g :* xs) -> h :* xs Source
Transform every elements in a union, preserving the order.
hzipWith :: (forall x. f x -> g x -> h x) -> (f :* xs) -> (g :* xs) -> h :* xs Source
zipWith
for heterogeneous product
hzipWith3 :: (forall x. f x -> g x -> h x -> i x) -> (f :* xs) -> (g :* xs) -> (h :* xs) -> i :* xs Source
zipWith3
for heterogeneous product
htraverse :: Applicative f => (forall x. h x -> f (h x)) -> (h :* xs) -> f (h :* xs) Source
Traverse all elements.
sector :: (Functor f, x ∈ xs) => (h x -> f (h x)) -> (h :* xs) -> f (h :* xs) Source
O(log n) A lens for a specific element.
sectorAt :: forall h x xs f. Functor f => Position xs x -> (h x -> f (h x)) -> (h :* xs) -> f (h :* xs) Source
O(log n) A lens for a value in a known position.
class Generate xs where Source
Given a function that maps types to values, we can "collect" entities all you want.