references-0.3.0.1: Selectors for reading and updating data.

Safe HaskellNone
LanguageHaskell98

Control.Reference.TH.Tuple

Description

A module for creating lenses to fields of simple, tuple data structures like pairs, triplets, and so on.

Synopsis

Documentation

data TupleConf Source

A tuple configuration is a scheme for tuple-like data structures.

Constructors

TupleConf 

Fields

tupleType :: [Name] -> Type
 
tuplePattern :: [Name] -> Pat
 
tupleExpr :: [Name] -> Exp
 

hsTupConf :: TupleConf Source

Generates the normal haskell tuples ((a,b), (a,b,c), (a,b,c,d))

makeTupleRefs :: TupleConf -> Int -> Int -> Q [Dec] Source

Creates Lens_1 ... Lens_n classes, and instances for tuples up to m.

Classes and instances look like the following:

class Lens_1 s t a b | s -> a, t -> b
                     , a t -> s, b s -> t where 
  _1 :: Lens s t a b

instance Lens_1 (a,b) (a',b) a a' where 
  _1 = lens ((a,b) -> a) (a' (a,b) -> (a',b))