extensible-0.3.3: 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 

_K0 :: (Functor f, Profunctor p) => p a (f b) -> p (K0 a) (f (K0 b)) Source

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.

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