!"#$%&'()*+,-./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 _a constructor. #Apply a binary function within the _a constructor. $Apply a ternary function within the _a 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 YZ representation.  Apply binary function in side a YZ 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. / Apply binary function inside of  Arrw (~>) f g representation. 0!Apply ternary function inside of  Arrw (~>) f g representation. 1newtype bijection 2Compose a bijection 3newtype bijection 7newtype bijection 8/Convenience for partial-manipulating functions :0Arrow-like type between type constructors (doesn' t enforce Arrow  (~>) here). =$Pairing of binary type constructors @#Pairing of unary type constructors C'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. F Compatibility synonym for (:$). GType 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 JConvert to an L. L(-> IO ()) as a MN. A Cofunctor. MFlip type arguments PSimulates 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 } SSupport needed for a YZ to be an  . YCommon pattern for  s. \=Composition of type constructors: unary with binary. Called   StaticArrow in [1]. _Compatibility synonym `'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 c 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. c*Contravariant functors. often useful for  acceptors (consumers,  sinks) of values. eBinary functions fUnary functions X !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefXfecd`ab_\]^YZ[STUVWXPQRMNOLJKGHIF !"CDE$#@AB%&+*'()=>?,-:;<912./0345678portable experimentalconal@conal.nethj for all applications of f iFProvide a title on a value. If you can title polymorphically, please  instantiate g instead of Title. Then you'll automatically  get a i. 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 "". ghijijghsynonym instance experimentalconal@conal.netknewtype bijection lDType of context-dependent monoid. Includes an explicit dictionary. oDictionary for lm. klmnoolmnkGHC experimentalconal@conal.net p Handy for | instances q Handy for | instances r Pairing of :; values. Warning: definition uses   , so only ! use if your arrow has a working  . s Pairing of t) values. Combines contribution of each. tDual to w. . Especially handy for contravariant functors (c) . Use this  template (filling in f) :  * instance Cofunctor f => Copair f where 1 { cofst = cofmap fst ; cosnd = cofmap snd } w?Dissectable as pairs. Minimal instance definition: either (a)  x or (b) both of y and z. ' 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 x 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 ~Type of } method pqrstuvwxyz{|}~~|}pqr{wxyztuvsportable 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 |, w, t, 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:;<=>?@ABCDEFGHIJJKLMNOPQRRSTUTVWXYZZ[\]^_`abcdeefgghijiklmnopqrstuuvwxyz{|}~         TypeCompose-0.3 Data.RefMonadData.BijectionControl.Compose Data.Title Data.CxMonoid Data.Pair Data.Partial Data.LambdaControl.Instancesbase Control.ArrowGHC.Base Data.MonoidGHC.ListControl.Applicative modifyRefRefMonadnewRefreadRefwriteRefidbinversebimap--->inBi:<->: BijectionBibiTobiFrombicomapbiOconvOcoconvOinOinO2inO3fmapFFfmapCCcofmapFCcofmapCFinFunAinFunA2biFlipinFlipinFlip2inFlip3biAppinAppinApp2inIdbiIdbiProdconvProdinProdinProd2inProd3$****#inProddinProdd2inArrwinArrw2inArrw3biFunconvFunbiConstinConstinConst2inConst3biEndoinEndo:->:ArrwunArrw::*::ProddunProdd:*:ProdunProdIdunIdApp:$unAppToOItoOIOIFlipunFlipMonoid_fmempty_f mappend_fFunAblearrFunfirstFun secondFun***%&&&%FunAunFunAOOunOOO:.unO CofunctorcofmapBinopUnopTitle_ftitle_fTitletitle biCxMonoidCxMonoid unCxMonoid MonoidDictapPairppPairarPaircopairCopaircofstcosndUnpairunpairpfstpsndUnpairTyPairpairPairTyvalppvalpUnEltpUnArgpUnRespUnSrcPartialXPartialColambdacoresUnlambdaunlambdafsrcfresLambdalambdaLambdaTyarrFunctorArrowMonoidStringunzipzipidmemptyEndoapLambda ApplicativearLambda