۲%      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                   ! " # $ (c) Conal Elliott 2007BSD3conal@conal.net experimentalportableSafe(c) Conal Elliott 2007BSD3conal@conal.net experimentalMPTCSafe<=? Class of monads with references.Change the contents of a ref(c) Conal Elliott 2007BSD3conal@conal.net experimental TypeOperatorsSafeQRBijective functionsA type of bijective arrows )Bijective identity arrow. Warning: uses % on (~>). If you have no %, but you have a  DeepArrow, you can instead use  Bi idA idA. Inverse bijectionBijections on functorsBijections on arrows.@Apply a function in an alternative (monomorphic) representation.         82(c) Conal Elliott 2007-2013BSD3conal@conal.net experimentalsee LANGUAGE pragmaNone/59:;<=IOQRTC;Arrow-like type between type constructors (doesn't enforce  Arrow (~>) here).#Pairing of binary type constructors"Pairing of unary type constructorsNIdentity type constructor. Until there's a better place to find it. I'd use Control.Monad.IdentityA, but I don't want to introduce a dependency on mtl just for Id.Compatibility synonym for (:$). 'Type application We can also drop the AppC constructor, but then we overlap with many other instances, like [a]. Here's a template for App-free instances. t instance (Applicative f, Monoid a) => Monoid (f a) where mempty = pure mempty mappend = liftA2 mappend#Convert to an %.%(-> IO ()) as a &. A ContraFunctor.&Flip type arguments)Simulates universal constraint forall a. Monoid (f a)..See Simulating Quantified Class Constraints ( 1http://flint.cs.yale.edu/trifonov/papers/sqcc.pdf/) Instantiate this schema wherever necessary: H instance Monoid_f f where { mempty_f = mempty ; mappend_f = mappend },Support needed for a 2 to be an &.2Common pattern for &s.5>Composition of type constructors: unary with binary. Called  StaticArrow in [1].8Monad distributivity.+TODO: what conditions are required so that (m :. n) satisfies the monad laws?:Compatibility synonym;&Composition of unary type constructors There are (at least) two useful 'Z instances, so you'll have to pick one and type-specialize it (filling in all or parts of g and/or f). b -- standard Monoid instance for Applicative applied to Monoid instance (Applicative (g :. f), Monoid a) => Monoid ((g :. f) a) where { mempty = pure mempty; mappend = liftA2 mappend } -- Especially handy when g is a Monoid_f. instance Monoid (g (f a)) => Monoid ((g :. f) a) where { mempty = O mempty; mappend = inO2 mappend }8Corresponding to the first and second definitions above,  instance (Applicative g, Monoid_f f) => Monoid_f (g :. f) where { mempty_f = O (pure mempty_f); mappend_f = inO2 (liftA2 mappend_f) } instance Monoid_f g => Monoid_f (g :. f) where { mempty_f = O mempty_f; mappend_f = inO2 mappend_f } Similarly, there are two useful ( instances and two useful = instances.  instance ( Functor g, Functor f) => Functor (g :. f) where fmap = fmapFF instance (ContraFunctor g, ContraFunctor f) => Functor (g :. f) where fmap = fmapCC instance ( Functor g, ContraFunctor f) => ContraFunctor (g :. f) where contraFmap = contraFmapFC instance (ContraFunctor g, Functor f) => ContraFunctor (g :. f) where contraFmap = contraFmapCFSHowever, it's such a bother to define the Functor instances per composition type, I've left the fmapFF case in. If you want the fmapCC one, you're out of luck for now. I'd love to hear a good solution. Maybe someday Haskell will do Prolog-style search for instances, subgoaling the constraints, rather than just matching instance heads.=*Contravariant functors. often useful for  acceptors (consumers, sinks) of values.?Binary functions@Unary functionsADAdd pre-processing argument :: (a' -> a) -> ((a -> b) -> (a' -> b))BAdd post-processingCAdd pre- and post processingE6Like '(~>)' but specialized to functors and functions.G$Bijections on contravariant functorsHUnwrap a '(:.)'.Inewtype bijectionJ"Compose a bijection, Functor styleK(Compose a bijection, ContraFunctor styleL"Apply a unary function within the : constructor.M#Apply a binary function within the : constructor.N$Apply a ternary function within the : constructor.OHandy combination of : and ).PHandy combination of L and *.QHandy combination of M and +.RHandy combination of N and ,.S Used for the Functor :. Functor instance of (T Used for the ContraFunctor :. ContraFunctor instance of (U Used for the Functor :. ContraFunctor instance of (V Used for the ContraFunctor :. Functor instance of (W A candidate - for (m :. n)XA candidate '(>>=)' for (m :. n)Z---like function for implicitly composed monads[---like function for explicitly composed monads\Apply unary function in side a 2 representation.] Apply binary function in side a 2 representation.^newtype bijectionbnewtype bijectionhnewtype bijectioniHandy infix & curried jnewtype bijectionkCompose a bijectionlApply unary function inside of f :*: g representation.m Apply binary function inside of f :*: g representation.n!Apply ternary function inside of f :*: g representation.o8A handy combining form. See '(***#)' for an sample use.p<Combine two binary functions into a binary function on pairsqHandy infix & curried r Apply binary function inside of f :*: g representation.s Apply binary function inside of f :*: g representation.tApply unary function inside of Arrw representation.u Apply binary function inside of  Arrw j f g representation.v!Apply ternary function inside of  Arrw j f g representation.wnewtype bijectionxCompose a bijectionynewtype bijection}newtype bijection~.Convenience for partial-manipulating functions !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~l !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~l@?BACEDF=>G;<:HIJKLMNOPQRSTUV89WXYZ[567234\],-./01)*+&'(^_`a%#$ !"bcdehfgijkpolmnqrswxtuvyz{|}~p !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ 17 0;9 C1D1E1F1o0p3(c) Conal Elliott 2007BSD3conal@conal.net experimentalportableNone9;QR for all applications of fSProvide a title on a value. If you can title polymorphically, please instantiate 5 instead of Title. Then you'll automatically get a - for each type instance, thanks to this rule. : instance Title_f f => Title (f a) where title = title_f #To handle ambiguity for types like  ([] Char) -- aka . , this module is compiled with OverlappingInstances and UndecidableInstances+. The more specific instance (yours) wins.MIn defining your instance, you might want to use the String instance, e.g.,  title ttl "". (c) Conal Elliott 2007BSD3conal@conal.net experimentalsynonym instanceNone9IQRCType of context-dependent monoid. Includes an explicit dictionary.Dictionary for .newtype bijection(c) Conal Elliott 2007BSD3conal@conal.net experimentalGHCNoneOQRT Dual to 0. Especially handy for contravariant functors (=$) . Use this template (filling in f) : ` instance ContraFunctor f => Copair f where { cofsts = cofmap fst ; cosnds = cofmap snd }6Unpairpable. Minimal instance definition: either (a)  or (b) both of  and *. A standard template to substitute any ( f. But watch out for effects! K instance Functor f => Unpair f where {fsts = fmap fst; snds = fmap snd}Type of  method. Generalizes .Type constructor class for -like things. Here are some standard instance templates you can fill in. They're not defined in the general forms below, because they would lead to a lot of overlap.  instance Applicative f => Pair f where pair = liftA2 (,) instance (Applicative h, Pair f) => Pair (h :. f) where pair = apPair instance (Functor g, Pair g, Pair f) => Pair (g :. f) where pair = ppPair instance (Arrow (~>), Unpair f, Pair g) => Pair (Arrw (~>) f g) where pair = arPair instance (Monoid_f h, Copair h) => Pair h where pair = copair.Also, if you have a type constructor that's a ( and a , here is a way to define '( *)' for /:  (<*>) = pairWith ($)"Minimum definitions for instances.Type of  method Handy for  instances Handy for  instances Pairing of  values. Warning: definition uses %+, so only use if your arrow has a working %. Pairing of ( values. Combines contribution of each.<Turn a pair of sources into a source of pair-editors. See  6http://conal.net/blog/posts/pairs-sums-and-reactivity/. 'Functor'\/'Monoid' version. See also .<Turn a pair of sources into a source of pair-editors. See  6http://conal.net/blog/posts/pairs-sums-and-reactivity/. Monad version. See also .& (c) Conal Elliott 2007BSD3conal@conal.net experimentalGHCNoneOQRT Dual to 0. Especially handy for contravariant functors ( Cofunctor$) . Use this template (filling in f) : [ instance Cofunctor f => Cozip f where { cofsts = cofmap fst ; cosnds = cofmap snd }5Unzippable. Minimal instance definition: either (a)  or (b) both of  and *. A standard template to substitute any ( f. But watch out for effects! J instance Functor f => Unzip f where {fsts = fmap fst; snds = fmap snd}Type of  method. Generalizes 0.Type constructor class for -like things. Here are some standard instance templates you can fill in. They're not defined in the general forms below, because they would lead to a lot of overlap. x instance Applicative f => Zip f where zip = liftA2 (,) instance (Applicative h, Zip f) => Zip (h :. f) where zip = apZip instance (Functor g, Zip g, Zip f) => Zip (g :. f) where zip = ppZip instance (Arrow (~>), Unzip f, Zip g) => Zip (Arrw (~>) f g) where zip = arZip instance (Monoid_f h, Cozip h) => Zip h where zip = cozip.Also, if you have a type constructor that's a ( and a , here is a way to define '( *)' for /:  (<*>) = zipWith ($)"Minimum definitions for instances.Type of  method Generalized 1 Generalized 1 Handy for  instances Handy for  instances Ziping of  values. Warning: definition uses %+, so only use if your arrow has a working %. Ziping of ( values. Combines contribution of each.<Turn a pair of sources into a source of pair-editors. See  6http://conal.net/blog/posts/pairs-sums-and-reactivity/. 'Functor'\/'Monoid' version. See also .<Turn a pair of sources into a source of pair-editors. See  6http://conal.net/blog/posts/pairs-sums-and-reactivity/. Monad version. See also .( " (c) Conal Elliott 2007BSD3conal@conal.net experimentalportableNone9 8Partial value. Represented an endomorphism, which is a ' under 2 and '(.)'. Then 3, is the completely undefined value, and in u ` 'mappend'@` v, v selectively replaces parts of  u@. The 4 instances for Pair, Unpair, Copair, Unfun, and Cofun( are all very useful on partial values. [Treat a full value as a partial one. Fully overrides any "previous" (earlier argument to mappend) partial value. PForce a partial value into a full one, filling in bottom for any missing parts.dInverse to "element" access, on all elements. A way to inject some info about every element. For f, consider '[]', (->) a, Event, etc.)Provide in info about a function argument$Provide info about a function result>Inject a partial argument-source into a partial function-sink.     567             567 (c) Conal Elliott 2007BSD3conal@conal.net experimentalmulti-parameter type classesNone 9;<=?OQRT Like Copair, but for functionsLike Unpair?, but for functions. Minimal instance definition: either (a)  or (b) both of  and .Deconstruct pair-like valueFirst part of pair-like valueSecond part of pair-like valuePType constructor class for function-like things having lambda-like construction.Type of  method. Think of src: as the bound variable (or pattern) part of a lambda and snka as the expression part. They combine to form a function-typed expression. Instance template: m instance (Applicative f, Lambda src snk) => Lambda (f :. src) (f :. snk) where lambda = apLambda 8 Handy for / functor instances of 9 with . Warning: definition uses %+, so only use if your arrow has a working %.8:9 !"#$  8:9 !"#$;    !"#$%&''()(*+,-../01234567899:;;<=>?@?ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                       !"#$"#%"&'"&("&)"&*"&+"&,"&-"&."&/"0"0"&1"&2"34567 8 9 :;)TypeCompose-0.9.12-CUb55uJGeK65Htq0yqldJX Data.RefMonadData.BijectionControl.Compose Data.Title Data.CxMonoid Data.PairData.Zip Data.Partial Data.LambdaControl.InstancesRefMonadnewRefreadRefwriteRef modifyRef$fRefMonadSTSTRef$fRefMonadIOIORef:<->: BijectionBibiTobiFromidbinversebimap--->inBi$fArrowBijection$fCategoryTYPEBijection:->:ArrwunArrw::*::ProddunProdd:*:ProdunProdIdApp:$unAppToOItoOIOIFlipunFlipMonoid_fmempty_f mappend_fFunAblearrFunfirstFun secondFun***%&&&%FunAunFunAOOunOODistribMdistribMO:. ContraFunctor contraFmapBinopUnopargumentresult~><~~>**<~bicomapunObiOconvOcoconvOinOinO2inO3oPureoFmapoLiftA2oLiftA3fmapFFfmapCC contraFmapFC contraFmapCF joinDistribM bindDistribMreturnDistribMjoinMMT joinComposeTinFunAinFunA2biFlipinFlipinFlip2inFlip3biAppinAppinApp2unIdinIdinId2biId*:*biProdconvProdinProdinProd2inProd3$****#*::*inProddinProdd2inArrwinArrw2inArrw3biFunconvFunbiConstinConstinConst2inConst3biEndoinEndo$fMonoid_fEndo$fContraFunctorArrw $fFunctorArrw $fArrow::*::$fCategoryTYPE::*::$fApplicative:*: $fFunctor:*: $fMonoid_f:*:$fOrd:*:$fEq:*: $fShow:*:$fTraversableId $fFoldableId $fMonadId$fApplicativeId $fFunctorId $fMonoid:$ $fToOIFlip$fMonoid_fFlip $fMonoidFlip$fContraFunctorFlip $fMonoid_f[] $fArrowFunA$fCategoryTYPEFunA $fArrowOO$fCategoryTYPEOO$fApplicative:.$fTraversable:. $fFoldable:. $fFunctor:.$fEq:.$fShow:.$fOrd:. $fGeneric:. $fGeneric1:.$fEqId$fShowId$fOrdId $fGenericId $fGeneric1Id $fShow::*:: $fEq::*:: $fOrd::*:: $fMonoidArrwTitle_ftitle_fTitletitle $fTitle_fFlip $fTitle(->) $fTitle_fIO $fTitle[]$fTitlef $fTitle_f:.CxMonoid unCxMonoid MonoidDict biCxMonoid$fTitleCxMonoid$fMonoidCxMonoidCopaircofstscosndsUnpairunpairfstssndsUnpairTyPairpairPairTyapPairppPairarPaircopairpairEdit pairEditM $fPairEndo $fCopairEndo $fUnpairEndo $fCopair:*: $fCopair:. $fCopairFlip $fCopairConst $fUnpairId $fUnpairConst $fUnpair(,) $fUnpair(->) $fUnpair[] $fPair:*: $fPairArrw $fPairFlip$fPairId $fPairConst$fPairIO $fPair(->) $fPair(,)$fPair[]CozipUnzipunzipUnzipTyZipzipZipTyzipWithzipWith3apZipppZiparZipcozip $fZipEndo $fCozipEndo $fUnzipEndo $fCozip:*: $fCozip:. $fCozipFlip $fCozipConst $fUnzipId $fUnzipConst $fUnzip(,) $fUnzip(->) $fUnzip[]$fZip:*: $fZipArrw $fZipFlip$fZipId $fZipConst$fZipIO $fZip(->)$fZip(,)$fZip[]PartialXPartialvalppvalpUnEltpUnArgpUnRespUnSrc $fFunAbleEndoColambdacoresUnlambdaunlambdafsrcfresLambdalambdaLambdaTy$fColambdaEndo$fUnlambdaEndoEndo$fLambdaArrwArrw$fLambda:*::*: $fLambdafArrw $fLambdaf:. $fLambdaf:.0$fLambdaIOFlip$fLambdaIdFlipbase Control.ArrowarrArrowGHC.BaseMonoidFunctorpurefmapliftA2liftA3joinString ApplicativeGHC.Listidmempty Data.MonoidEndopArrpFirstpSecondapLambdaarLambda apLambda'