P      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ portable experimentalconal@conal.netMPTC experimentalconal@conal.netChange the contents of a ref !Class of monads with references.  TypeOperators experimentalconal@conal.net)Bijective identity arrow. Warning: uses   on (~>) . If you  have no  , but you have a  DeepArrow, you can instead use Bi idA  idA. Inverse bijection Bijections on functors Bijections on arrows. AApply a function in an alternative (monomorphic) representation. Bijective functions A type of bijective arrows     see LANGUAGE pragma experimentalconal@conal.net3%Bijections on contravariant functors newtype bijection #Compose a bijection, Functor style %Compose a bijection, Cofunctor style "Apply a unary function within the `b constructor. #Apply a binary function within the `b constructor. $Apply a ternary function within the `b constructor.  Used for the Functor :. Functor instance of    Used for the Cofunctor :. Cofunctor instance of    Used for the Functor :. Cofunctor instance of    Used for the Cofunctor :. Functor instance of   Apply unary function in side a Z[ representation.  Apply binary function in side a Z[ representation. newtype bijection newtype bijection %newtype bijection &newtype bijection 'Compose a bijection (Apply unary function inside of f :*: g representation. ) Apply binary function inside of f :*: g representation. *!Apply ternary function inside of f :*: g representation. +A handy combining form. See '(***#)' for an sample use. ,=Combine two binary functions into a binary function on pairs - Apply binary function inside of f :*: g representation. . Apply binary function inside of f :*: g representation. /Apply unary function inside of Arrw representation. 0 Apply binary function inside of  Arrw (~>) f g representation. 1!Apply ternary function inside of  Arrw (~>) f g representation. 2newtype bijection 3Compose a bijection 4newtype bijection 8newtype bijection 9/Convenience for partial-manipulating functions ;0Arrow-like type between type constructors (doesn' t enforce Arrow  (~>) here). >$Pairing of binary type constructors A#Pairing of unary type constructors D'Identity type constructor. Until there's a better place to find it.  I'd use Control.Monad.Identity , but I don't want to introduce a  dependency on mtl just for Id. G Compatibility synonym for (:$). HType application  We can also drop the App, constructor, but then we overlap with many  other instances, like [a]. Here's a template for App-free  instances.  < instance (Applicative f, Monoid a) => Monoid (f a) where  mempty = pure mempty  mappend = liftA2 mappend KConvert to an M. M(-> IO ()) as a NO. A Cofunctor. NFlip type arguments QSimulates 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:  I instance Monoid_f f where { mempty_f = mempty ; mappend_f = mappend } TSupport needed for a Z[ to be an  . ZCommon pattern for  s. ]=Composition of type constructors: unary with binary. Called   StaticArrow in [1]. `Compatibility synonym a'Composition of unary type constructors  There are (at least) two useful   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 K instance (Applicative (g :. f), Monoid a) => Monoid ((g :. f) a) where 9 { mempty = pure mempty; mappend = liftA2 mappend } . -- Especially handy when g is a Monoid_f. ; instance Monoid (g (f a)) => Monoid ((g :. f) a) where 4 { mempty = O mempty; mappend = inO2 mappend } 9Corresponding to the first and second definitions above,   D instance (Applicative g, Monoid_f f) => Monoid_f (g :. f) where L { mempty_f = O (pure mempty_f); mappend_f = inO2 (liftA2 mappend_f) } 3 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 d instances.   P instance ( Functor g, Functor f) => Functor (g :. f) where fmap = fmapFF P instance (Cofunctor g, Cofunctor f) => Functor (g :. f) where fmap = fmapCC   T instance (Functor g, Cofunctor f) => Cofunctor (g :. f) where cofmap = cofmapFC T instance (Cofunctor g, Functor f) => Cofunctor (g :. f) where cofmap = cofmapCF  However, it'4s such a bother to define the Functor instances per composition type, I'4ve 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 Jsomeday Haskell will do Prolog-style search for instances, subgoaling the 7constraints, rather than just matching instance heads. d*Contravariant functors. often useful for  acceptors (consumers,  sinks) of values. fBinary functions gUnary functions Y !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgYgfdeabc`]^_Z[\TUVWXYQRSNOPMKLHIJG !"DEF%#$ABC&',+()*>?@-.;<=:23/01456789portable experimentalconal@conal.netik for all applications of f jFProvide a title on a value. If you can title polymorphically, please  instantiate h instead of Title. Then you'll automatically  get a j. 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. FIn defining your instance, you might want to use the String instance,  e.g.,  title ttl "". hijkjkhisynonym instance experimentalconal@conal.netlnewtype bijection mDType of context-dependent monoid. Includes an explicit dictionary. pDictionary for mn. lmnoppmnolGHC experimentalconal@conal.net q Handy for  instances r Handy for  instances s Pairing of ;< values. Warning: definition uses   , so only ! use if your arrow has a working  . t Pairing of w) values. Combines contribution of each. u;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 v. v;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 u. wDual to z. . Especially handy for contravariant functors (d) . Use this  template (filling in f) :  * instance Cofunctor f => Copair f where 1 { cofst = cofmap fst ; cosnd = cofmap snd } z?Dissectable as pairs. 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 {pfst = fmap fst; psnd = fmap snd} ~Type of { method. Generalizes  . :Type constructor class for pair-like things. Generalizes  . A Here are some standard instance templates you can fill in. They're not I 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 9 instance (Functor g, Pair g, Pair f) => Pair (g :. f)  where pair = ppPair I instance (Arrow (~>), Unpair f, Pair g) => Pair (Arrw (~>) f g) where  pair = arPair 3 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  :   rf  *> rx = uncurry ($) <$ (rf  rx) Type of  method qrstuvwxyz{|}~qrs~z{|}wxytuvportable experimentalconal@conal.net:Treat a full value as a partial one. Fully overrides any  "previous" (earlier argument to mappend) partial value. AForce a partial value into a full one, filling in bottom for any  missing parts.  Inverse to "element"0 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. 8Partial value. Represented an endomorphism, which is a    under   and '(.)'. Then  $ is the completely undefined value,  and in u  `@'mappend'@` v, v selectively replaces parts of u. The    instances for , z, w, Unfun, and Cofun ( are all very useful on partial values. multi-parameter type classes experimentalconal@conal.net  Handy for   functor instances of   with ;<. Warning: definition uses   , so only ! use if your arrow has a working  . Like Copair, but for functions Like Unpair>, but for functions. Minimal instance definition: either (a)   or (b) both of  and . Deconstruct pair-like value First part of pair-like value Second part of pair-like value QType 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 snk as the expression part. They / combine to form a function-typed expression.  Instance template:  , instance (Applicative f, Lambda src snk) + => Lambda (f :. src) (f :. snk) where  lambda = apLambda   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKKLMNOPQRSSTUVUWXYZ[[\]^_`abcdeffghhijkjlmnopqrstuvvwxyz{|}~         TypeCompose-0.5 Data.RefMonadData.BijectionControl.Compose Data.Title Data.CxMonoid Data.Pair Data.Partial Data.LambdaControl.Instancesbase Control.ArrowGHC.Base Data.MonoidGHC.ListControl.Applicative modifyRefRefMonadnewRefreadRefwriteRefidbinversebimap--->inBi:<->: BijectionBibiTobiFrombicomapbiOconvOcoconvOinOinO2inO3fmapFFfmapCCcofmapFCcofmapCFinFunAinFunA2biFlipinFlipinFlip2inFlip3biAppinAppinApp2inIdinId2biIdbiProdconvProdinProdinProd2inProd3$****#inProddinProdd2inArrwinArrw2inArrw3biFunconvFunbiConstinConstinConst2inConst3biEndoinEndo:->:ArrwunArrw::*::ProddunProdd:*:ProdunProdIdunIdApp:$unAppToOItoOIOIFlipunFlipMonoid_fmempty_f mappend_fFunAblearrFunfirstFun secondFun***%&&&%FunAunFunAOOunOOO:.unO CofunctorcofmapBinopUnopTitle_ftitle_fTitletitle biCxMonoidCxMonoid unCxMonoid MonoidDictapPairppPairarPaircopairpairEdit pairEditMCopaircofstcosndUnpairunpairpfstpsndUnpairTyPairpairPairTyvalppvalpUnEltpUnArgpUnRespUnSrcPartialXPartialColambdacoresUnlambdaunlambdafsrcfresLambdalambdaLambdaTyarrFunctorArrowMonoidStringunzipzip ApplicativeidmemptyEndoapLambdaarLambda