extensible-0.3.7: Extensible, efficient, optics-friendly data types

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

Data.Extensible.Wrapper

Description

 

Synopsis

Documentation

class Wrapper h where Source

The extensible data types should take k -> * as a parameter. This class allows us to take a shortcut for direct representation.

Minimal complete definition

Nothing

Associated Types

type Repr h v :: * Source

Repr h v is the actual representation of h v.

Methods

_Wrapper :: (Functor f, Profunctor p) => Optic' p f (h v) (Repr h v) Source

This is an isomorphism between h v and Repr h v.

_Wrapper :: Iso' (h v) (Repr h v)

Instances

Wrapper * Identity Source 
Wrapper k (Proxy k) Source 
Wrapper k (Const' k a) Source 
Wrapper k h => Wrapper k (Nullable k h) Source 
Wrapper k h => Wrapper k (Match k h r) Source 
(Functor f, Wrapper k g) => Wrapper k (Comp * k f g) Source 
Wrapper k h => Wrapper (Assoc k k) (Field k k h) Source 

_WrapperAs :: (Functor f, Profunctor p, Wrapper h) => proxy v -> Optic' p f (h v) (Repr h v) Source

Restricted version of _Wrapper. It is useful for eliminating ambiguousness.

newtype Const' a x Source

Poly-kinded Const

Constructors

Const' 

Fields

getConst' :: a
 

Instances

Wrapper k (Const' k a) Source 
Eq a => Eq (Const' k a x) Source 
Ord a => Ord (Const' k a x) Source 
Show a => Show (Const' k a x) Source 
type Repr k (Const' k a) b = a Source 

newtype Comp f g a Source

Poly-kinded composition

Constructors

Comp 

Fields

getComp :: f (g a)
 

Instances

(Functor f, Wrapper k g) => Wrapper k (Comp * k f g) Source 
Eq (f (g a)) => Eq (Comp j i f g a) Source 
Ord (f (g a)) => Ord (Comp j i f g a) Source 
Show (f (g a)) => Show (Comp j i f g a) Source 
type Repr k (Comp * k f g) x = f (Repr k g x) Source 

comp :: Functor f => (a -> g b) -> f a -> Comp f g b Source