putlenses-0.1.3: Put-based lens library

Copyright(C) 2013 Hugo Pacheco
LicenseBSD-style (see the file LICENSE)
MaintainerHugo Pacheco <hpacheco@nii.ac.jp>
Stabilityprovisional
Safe HaskellNone
LanguageHaskell98

GHC.InOut

Description

Generic sums of products representation for algebraic data types

Documentation

class (Generic a, ToFromRep (Rep a)) => InOut a where Source

Methods

inn :: F a -> a Source

out :: a -> F a Source

Instances

(Generic a, ToFromRep (Rep a)) => InOut a 

type family Flatten f :: * Source

Instances

type Flatten U1 = () 
type Flatten (K1 i c) = c 
type Flatten ((:+:) f g) = Either (Flatten f) (Flatten g) 
type Flatten ((:*:) f g) = (Flatten f, Flatten g) 
type Flatten (M1 i c f) = Flatten f 

type F a = Flatten (Rep a) Source

class ToFromRep f where Source

Methods

fromRep :: f x -> Flatten f Source

toRep :: Flatten f -> f x Source

Instances

ToFromRep U1 
ToFromRep (K1 i c) 
(ToFromRep f, ToFromRep g) => ToFromRep ((:+:) f g) 
(ToFromRep f, ToFromRep g) => ToFromRep ((:*:) f g) 
ToFromRep f => ToFromRep (M1 i c f)