Copyright | (c) Fumiaki Kinoshita 2015 |
---|---|

License | BSD3 |

Maintainer | Fumiaki Kinoshita <fumiexcel@gmail.com> |

Stability | experimental |

Portability | non-portable |

Safe Haskell | None |

Language | Haskell2010 |

- newtype K0 a = K0 {
- getK0 :: a

- type AllOf xs = K0 :* xs
- type OneOf xs = K0 :| xs
- (<%) :: x -> AllOf xs -> AllOf (x : xs)
- pluck :: x ∈ xs => AllOf xs -> x
- bury :: x ∈ xs => x -> OneOf xs
- (<%|) :: (x -> r) -> (OneOf xs -> r) -> OneOf (x : xs) -> r
- record :: (x ∈ xs, Functor f) => (x -> f x) -> AllOf xs -> f (AllOf xs)
- recordAt :: Functor f => Membership xs x -> (x -> f x) -> AllOf xs -> f (AllOf xs)
- (<?%) :: (x -> a) -> (Match K0 a :* xs) -> Match K0 a :* (x : xs)
- newtype K1 a f = K1 {
- getK1 :: f a

- (<?!) :: (f x -> a) -> (Match (K1 x) a :* xs) -> Match (K1 x) a :* (f : fs)
- accessing :: (Coercible b a, b ∈ xs) => (a -> b) -> Lens' (AllOf xs) a
- decFields :: DecsQ -> DecsQ
- decFieldsDeriving :: [Name] -> DecsQ -> DecsQ

# Documentation

Just a value.

(<%|) :: (x -> r) -> (OneOf xs -> r) -> OneOf (x : xs) -> r infixr 1 Source

Naive pattern matching for a plain value.

record :: (x ∈ xs, Functor f) => (x -> f x) -> AllOf xs -> f (AllOf xs) Source

*O(log n)* A lens for a plain value in a product.

recordAt :: Functor f => Membership xs x -> (x -> f x) -> AllOf xs -> f (AllOf xs) Source

*O(log n)* A lens for a plain value in a product.

(<?%) :: (x -> a) -> (Match K0 a :* xs) -> Match K0 a :* (x : xs) infixr 1 Source

Prepend a clause for a plain value.

Wrap a type that has a kind `* -> *`

.

(<?!) :: (f x -> a) -> (Match (K1 x) a :* xs) -> Match (K1 x) a :* (f : fs) infixr 1 Source

Prepend a clause for a parameterized value.

accessing :: (Coercible b a, b ∈ xs) => (a -> b) -> Lens' (AllOf xs) a Source

An accessor for newtype constructors.