extensible-0.2.10: Extensible, efficient, lens-friendly data types

Copyright(c) Fumiaki Kinoshita 2015
LicenseBSD3
MaintainerFumiaki Kinoshita <fumiexcel@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Data.Extensible.Plain

Description

 

Synopsis

Documentation

newtype K0 a Source

Just a value.

Constructors

K0 

Fields

getK0 :: a
 

Instances

Monad K0 
Functor K0 
Applicative K0 
Foldable K0 
Traversable K0 
Eq a => Eq (K0 a) 
Ord a => Ord (K0 a) 
Read a => Read (K0 a) 
Show a => Show (K0 a) 
Typeable (* -> *) K0 

type AllOf xs = K0 :* xs Source

Alias for plain products

type OneOf xs = K0 :| xs Source

Alias for plain sums

(<%) :: x -> AllOf xs -> AllOf (x : xs) infixr 5 Source

O(log n) Add a plain value to a product.

pluck :: x xs => AllOf xs -> x Source

Extract a plain value.

bury :: x xs => x -> OneOf xs Source

Embed a plain 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.

newtype K1 a f Source

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

Constructors

K1 

Fields

getK1 :: f a
 

Instances

Typeable (k -> (k -> *) -> *) (K1 k) 
Eq (f a) => Eq (K1 k a f) 
Ord (f a) => Ord (K1 k a f) 
Read (f a) => Read (K1 k a f) 

(<?!) :: (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.

decFields :: DecsQ -> DecsQ Source

Generate newtype wrappers and lenses from type synonyms.

decFields [d|type Foo = Int|]

Generates:

newtype Foo = Foo Int
foo :: (Foo ∈ xs) => Lens' (AllOf xs) Int
foo = accessing Foo

decFieldsDeriving :: [Name] -> DecsQ -> DecsQ Source

decFields with additional deriving clauses