úÎÔČĘķĒ      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ Ą ĸ Ŗ ¤ Ĩ Ļ § ¨ Š portable experimentalconal@conal.netMPTC experimentalconal@conal.net!Class of monads with references. Change the contents of a ref  TypeOperators experimentalconal@conal.net Bijective functions A 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 bijection Bijections on functors Bijections on arrows. AApply a function in an alternative (monomorphic) representation.        see LANGUAGE pragma experimentalconal@conal.net]0Arrow-like type between type constructors (doesn' t enforce Arrow  (~>) here). $Pairing of binary type constructors #Pairing of unary type constructors '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.  Compatibility synonym for (:$). Type 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  Convert to an ". !"(-> IO ()) as a $#. A Cofunctor. #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: J instance Monoid_f f where { mempty_f = mempty ; mappend_f = mappend } '()Support needed for a 0/ to be an Ģ. *for Ē +,-./Common pattern for Ģs. 012=Composition of type constructors: unary with binary. Called   StaticArrow in [1]. 345Compatibility synonym 6'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).  C -- standard Monoid instance for Applicative applied to Monoid L 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 5 { mempty = O mempty; mappend = inO2 mappend } 9Corresponding to the first and second definitions above,  E instance (Applicative g, Monoid_f f) => Monoid_f (g :. f) where M { mempty_f = O (pure mempty_f); mappend_f = inO2 (liftA2 mappend_f) } 4 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 9 instances.  Q instance ( Functor g, Functor f) => Functor (g :. f) where fmap = fmapFF Q instance (Cofunctor g, Cofunctor f) => Functor (g :. f) where fmap = fmapCC  U instance (Functor g, Cofunctor f) => Cofunctor (g :. f) where cofmap = cofmapFC U 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. 789*Contravariant functors. often useful for  acceptors (consumers,  sinks) of values. :;Binary functions <Unary functions =%Bijections on contravariant functors >newtype bijection ?#Compose a bijection, Functor style @%Compose a bijection, Cofunctor style A"Apply a unary function within the 75 constructor. B#Apply a binary function within the 75 constructor. C$Apply a ternary function within the 75 constructor. DHandy combination of 75 and Ž. EHandy combination of A and ¯. FHandy combination of B and °. GHandy combination of C and ą. H Used for the Functor :. Functor instance of ­ I Used for the Cofunctor :. Cofunctor instance of ­ J Used for the Functor :. Cofunctor instance of ­ K Used for the Cofunctor :. Functor instance of ­ LApply unary function in side a 0/ representation. M Apply binary function in side a 0/ representation. Nnewtype bijection OPQRnewtype bijection STUVWnewtype bijection Xnewtype bijection YCompose a bijection ZApply 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. aApply unary function inside of Arrw representation. b Apply binary function inside of  Arrw (~>) f g representation. c!Apply ternary function inside of  Arrw (~>) f g representation. dnewtype bijection eCompose a bijection fnewtype bijection ghijnewtype bijection k/Convenience for partial-manipulating functions ] !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijk]<;9:=6785>?@ABCDEFGHIJK234/01LM)*+,-.&'(#$%NOPQ" !RSTWUVXY^]Z[\_`deabcfghijk] !!"#$%$%&'('()*+,-.*+,-./0101234345678789::;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijkportable experimentalconal@conal.netlmo for all applications of f nFProvide a title on a value. If you can title polymorphically, please  instantiate l instead of Title. Then you'll automatically  get a n. 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 "". olmnonolmlmmnoosynonym instance experimentalconal@conal.netpDType of context-dependent monoid. Includes an explicit dictionary. qrsDictionary for qp. tnewtype bijection pqrstspqrtpqrqrstGHC experimentalconal@conal.netuDual to x. . Especially handy for contravariant functors (9) . Use this  template (filling in f) : + instance Cofunctor f => Copair f where 4 { cofsts = cofmap fst ; cosnds = cofmap snd } v Pair-like value from first part w!Pair-like value from second part x6Unpairpable. Minimal instance definition: either (a) y or (b)  both of z and {). A standard template to substitute any  ­ f. But watch out for effects! M instance Functor f => Unpair f where {fsts = fmap fst; snds = fmap snd} ygeneralized unpair zFirst part of pair-like value {Second part of pair-like value |Type of y method. Generalizes y. }Type constructor class for ~-like things. 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 : instance (Functor g, Pair g, Pair f) => Pair (g :. f)  where pair = ppPair J instance (Arrow (~>), Unpair f, Pair g) => Pair (Arrw (~>) f g) where  pair = arPair 4 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. ~ Generalized ~ 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 u) 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 „. uvwxyz{|}~€‚ƒ„…}~€‚|xyz{uvwƒ„…uvwvwxyz{yz{|}~~€‚ƒ„…GHC experimentalconal@conal.net†Dual to ‰. . Especially handy for contravariant functors (9) . Use this  template (filling in f) : * instance Cofunctor f => Cozip f where 4 { cofsts = cofmap fst ; cosnds = cofmap snd } ‡Zip-like value from first part ˆ Zip-like value from second part ‰5Unzippable. Minimal instance definition: either (a) Š or (b)  both of ‹ and Œ). A standard template to substitute any  ­ f. But watch out for effects! L instance Functor f => Unzip f where {fsts = fmap fst; snds = fmap snd} Šgeneralized unzip ‹First part of pair-like value ŒSecond part of pair-like value Type of Š method. Generalizes ´. ŽType constructor class for -like things. 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 => Zip f where  zip = liftA2 (,) : instance (Applicative h, Zip f) => Zip (h :. f) where  zip = apZip 7 instance (Functor g, Zip g, Zip f) => Zip (g :. f)  where zip = ppZip G instance (Arrow (~>), Unzip f, Zip g) => Zip (Arrw (~>) f g) where  zip = arZip 2 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.  Generalized ĩ Type of  method ‘ Generalized ļ ’ Generalized ļ “ 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 —. †‡ˆ‰Š‹ŒŽ‘’“”•–—˜Ž‘’“”•‰Š‹Œ†‡ˆ–—˜†‡ˆ‡ˆ‰Š‹ŒŠ‹ŒŽ‘’“”•–—˜portable experimentalconal@conal.net ™š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 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. œ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. ģŧŊ™š›œžŸ š™›œžŸ ™š›œžŸ  multi-parameter type classes experimentalconal@conal.net Ą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. ¨Form a function-like value Š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 ž Handy for ŗ functor instances of § ŋ with . Warning: definition uses Ē , so only ! use if your arrow has a working Ē. ĄĸŖ¤Ĩϧ¨Š Ч¨Ŗ¤ĨĻĄĸ ĄĸĸŖ¤ĨϤĨϧ¨¨ŠÁ    !"##$%&%'()*++,-./012345667889:;:<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrsttuvwxyz{|}~€‚ƒ„…†‡ˆ‰yzŠ‹}~ŒŽ‘’“”•‡ˆ–—˜™š›œ ž Ÿ   Ą ĸ Ŗ ¤ Ĩ ϧ¨Š§¨ǧĢŦ§­ާ¯°§­ą§¯˛§¯ŗ§­´§¯ĩ§ļ‹§ļާ­ˇ§Ģ¸§Ģš§Ģšēģŧ Ŋ ž ŋĀTypeCompose-0.6.7 Data.RefMonadData.BijectionControl.Compose Data.Title Data.CxMonoid Data.PairData.Zip Data.Partial Data.LambdaControl.InstancesRefMonadnewRefreadRefwriteRef modifyRef:<->: BijectionBibiTobiFromidbinversebimap--->inBi:->:ArrwunArrw::*::ProddunProdd:*:ProdunProdIdunIdApp:$unAppToOItoOIOIFlipunFlipMonoid_fmempty_f mappend_fFunAblearrFunfirstFun secondFun***%&&&%FunAunFunAOOunOOO:.unO CofunctorcofmapBinopUnopbicomapbiOconvOcoconvOinOinO2inO3oPureoFmapoLiftA2oLiftA3fmapFFfmapCCcofmapFCcofmapCFinFunAinFunA2biFlipinFlipinFlip2inFlip3biAppinAppinApp2inIdinId2biIdbiProdconvProdinProdinProd2inProd3$****#inProddinProdd2inArrwinArrw2inArrw3biFunconvFunbiConstinConstinConst2inConst3biEndoinEndoTitle_ftitle_fTitletitleCxMonoid unCxMonoid MonoidDict biCxMonoidCopaircofstscosndsUnpairunpairfstssndsUnpairTyPairpairPairTyapPairppPairarPaircopairpairEdit pairEditMCozipUnzipunzipUnzipTyZipzipZipTyzipWithzipWith3apZipppZiparZipcozipPartialXPartialvalppvalpUnEltpUnArgpUnRespUnSrcColambdacoresUnlambdaunlambdafsrcfresLambdalambdaLambdaTybase Control.ArrowarrArrow Data.MonoidMonoidGHC.BaseFunctorControl.ApplicativepurefmapliftA2liftA3String ApplicativeGHC.ListidmemptyEndopArrpFirstpSecondapLambda apLambda'arLambda