!oAd      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~Safe27 Krecursion-schemesBase Functor for (C) 2008-2015 Edward Kmett BSD-style (see the file LICENSE)"Samuel Glineau" <gelisam@gmail.com>, "Oleg Grenrus" <oleg.grenrus@iki.fi>, "Ryan Scott" <ryan.gl.scott@gmail.com> experimental non-portableSafe&'1278=>?@AHSUVXIrecursion-schemesBase functor of [].%recursion-schemesFokkinga's postpromorphism&recursion-schemesA generalized postpromorphism,recursion-schemesFokkinga's prepromorphism5recursion-schemesA generalized catamorphism6recursion-schemesA generalized catamorphism8recursion-schemesA generalized anamorphism9recursion-schemesA generalized anamorphism;recursion-schemesA generalized hylomorphism<recursion-schemesA generalized hylomorphismrecursion-schemes1Lambek's lemma provides a default definition for ( in terms of ) and "recursion-schemes>The dual of Lambek's lemma, provides a default definition for " in terms of # and (Drecursion-schemes!A specialized, faster version of B for .Erecursion-schemes!A specialized, faster version of B for .Nrecursion-schemesCourse-of-value iterationTrecursion-schemesMendler-style iterationUrecursion-schemes'Mendler-style course-of-value iterationVrecursion-schemesElgot algebrasWrecursion-schemesElgot coalgebras: 0http://comonad.com/reader/2008/elgot-coalgebras/Xrecursion-schemes!Zygohistomorphic prepromorphisms:&A corrected and modernized version of Chttp://www.haskell.org/haskellwiki/Zygohistomorphic_prepromorphismsYrecursion-schemes Effectful 2.!This is a type specialisation of )./An example terminating a recursion immediately:NcataA (\alg -> case alg of { Nil -> pure (); Cons a _ -> Const [a] }) "hello" Const "h"Zrecursion-schemesAn effectful version of B. Properties: Z  =   Examples:OThe weird type of first argument allows user to decide an order of sequencing:Btransverse (\x -> print (void x) *> sequence x) "foo" :: IO String Cons 'f' () Cons 'o' () Cons 'o' ()Nil"foo"Btransverse (\x -> sequence x <* print (void x)) "foo" :: IO StringNil Cons 'o' () Cons 'o' () Cons 'f' ()"foo"[recursion-schemesA coeffectful version of B. Properties: [ : =   Examples:Stateful transformations::{ cotransverse (\(u, b) -> case b of Nil -> Nil= Cons x a -> Cons (if u then toUpper x else x) (not u, a)) (True, "foobar") :: String:}"FoObAr"We can implement a variant of 'data Pair a = Pair a a deriving Functor:{2let zipWith' :: (a -> a -> b) -> [a] -> [a] -> [b]8 zipWith' f xs ys = cotransverse g (Pair xs ys) where* g (Pair Nil _) = Nil* g (Pair _ Nil) = Nil> g (Pair (Cons x a) (Cons y b)) = Cons (f x y) (Pair a b) :}zipWith' (*) [1,2,3] [4,5,6] [4,10,18]zipWith' (*) [1,2,3] [4,5,6,8] [4,10,18]zipWith' (*) [1,2,3,3] [4,5,6] [4,10,18]recursion-schemesLChurch encoded free monads are Recursive/Corecursive, in the same way that  is.recursion-schemes0Example boring stub for non-recursive data typesrecursion-schemes0Example boring stub for non-recursive data typesrecursion-schemes8Free transformations of monads are Recursive/Corecursiverecursion-schemes%Free monads are Recursive/Corecursiverecursion-schemes:Cofree tranformations of comonads are Recursive/Corecusiverecursion-schemes)Cofree comonads are Recursive/Corecursiverecursion-schemes/It may be better to work with the instance for  directly.#recursion-schemesa (Base t)-coalgebrarecursion-schemesseedrecursion-schemesresulting fixed point)recursion-schemesa (Base t)-algebrarecursion-schemes fixed pointrecursion-schemesresult5recursion-schemesa distributive lawrecursion-schemesa (Base t)-w-algebrarecursion-schemes fixed point6recursion-schemesa distributive lawrecursion-schemesa (Base t)-w-algebrarecursion-schemes fixed point8recursion-schemesa distributive lawrecursion-schemesa (Base t)-m-coalgebrarecursion-schemesseed9recursion-schemesa distributive lawrecursion-schemesa (Base t)-m-coalgebrarecursion-schemesseedGrecursion-schemes(A distributive for semi-mutual recursionD !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[D. ADE'()*+,-J5FHNO=>RS7/0GIPQ?@!"#$%&8:KLM1;BC26394<TUVWXYZ[SafeSXd recursion-schemesRules of renaming data namesrecursion-schemes9Build base functor with a sensible default configuration.e.g. `data Expr a = Lit a | Add (Expr a) (Expr a) | Expr a :* [Expr a] deriving (Show)  ''Expr  will create Gdata ExprF a x = LitF a | AddF x x | x :*$ [x] deriving (, , ) type instance Base (Expr a) = ExprF a instance  Recursive (Expr a) where project (Lit x) = LitF x project (Add x y) = AddF x y project (x :* y) = x :*$ y instance  Corecursive (Expr a) where embed (LitF x) = Lit x embed (AddF x y) = Add x y embed (x :*$ y) = x :* y   =   Notes:n works properly only with ADTs. Existentials and GADTs aren't supported, as we don't try to do better than  lhttps://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#deriving-functor-instancesGHC's DeriveFunctor.recursion-schemes/Build base functor with a custom configuration.recursion-schemesDefault  : append F or $, to data type, constructors and field names.recursion-schemes"How to name the base functor type.Default is to append F or $.recursion-schemes1How to rename the base functor type constructors.Default is to append F or $.recursion-schemes=How to rename the base functor type field names (in records).Default is to append F or $.recursion-schemes$makes clauses to rename constructorsrecursion-schemesExtract type variablesrecursion-schemes&Apply arguments to a type constructor.recursion-schemesProvides substitution for typesSafed       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~.recursion-schemes-5.1.3-JhnH2ykCSmS1gpM95h5C6hData.Functor.BaseData.Functor.FoldableData.Functor.Foldable.TH Data.ListNonEmptyPaths_recursion_schemes NonEmptyFheadtail$fBitraversableNonEmptyF$fBifoldableNonEmptyF$fBifunctorNonEmptyF$fTraversableNonEmptyF$fFoldableNonEmptyF$fFunctorNonEmptyF$fRead1NonEmptyF$fRead2NonEmptyF$fShow2NonEmptyF$fShow1NonEmptyF$fOrd1NonEmptyF$fOrd2NonEmptyF$fEq1NonEmptyF$fEq2NonEmptyF $fEqNonEmptyF$fOrdNonEmptyF$fShowNonEmptyF$fReadNonEmptyF$fGenericNonEmptyF$fGeneric1NonEmptyFNuMuFixListFNilCons Corecursiveembedanaapopostprogpostpro RecursiveprojectcataparagparapreprogpreproBasedistPara distParaThylofoldunfoldrefoldgcatagfolddistCataganagunfolddistAnaghylogrefoldfutugfutudistFutu distGFutuunfixhoistrefixhoistMuhoistNuzygodistZygogzygo distZygoTgapodistApodistGApo distGApoThistoghisto distHisto distGHistochronogchronomcatamhistoelgotcoelgotzygoHistoPreprocataA transverse cotransverse$fBitraversableListF$fBifoldableListF$fBifunctorListF$fTraversableListF$fFoldableListF$fFunctorListF $fRead1ListF $fRead2ListF $fShow2ListF $fShow1ListF $fOrd1ListF $fOrd2ListF $fEq1ListF $fEq2ListF $fReadFix $fShowFix$fOrdFix$fEqFix$fReadMu$fShowMu$fOrdMu$fEqMu$fReadNu$fShowNu$fOrdNu$fEqNu$fGCoerce:+::+:$fGCoerce:*::*: $fGCoerceV1V1 $fGCoerceU1U1 $fGCoerceK1K1 $fGCoerceM1M1 $fRecursiveNu$fCorecursiveNu$fCorecursiveF $fRecursiveF$fCorecursiveMu $fRecursiveMu$fCorecursiveFix$fRecursiveFix$fCorecursiveEither$fRecursiveEither$fCorecursiveMaybe$fRecursiveMaybe$fCorecursiveFreeT$fRecursiveFreeT$fCorecursiveFree$fRecursiveFree$fCorecursiveCofreeT$fRecursiveCofreeT$fCorecursiveCofree$fRecursiveCofree$fCorecursiveNatural$fRecursiveNatural$fCorecursiveNonEmpty$fRecursiveNonEmpty$fCorecursive[] $fRecursive[] $fEqListF $fOrdListF $fShowListF $fReadListF$fGenericListF$fGeneric1ListF $fDataFix BaseRulesmakeBaseFunctormakeBaseFunctorWith baseRules baseRulesType baseRulesConbaseRulesFieldlambekcolambekbaseData.Traversable sequenceAGHC.BasepureData.Functor.Identity runIdentityGHC.ListzipWith D:R:BaseFD:R:BaseEither D:R:BaseMaybe D:R:BaseFreeT D:R:BaseFreeD:R:BaseCofreeTD:R:BaseCofreefree-5.1-3LXEResUhJx6N2IlXyQ8KgControl.Monad.Free.ChurchFFunctor Data.FoldableFoldable Traversable mkMorphismtypeVarsconAppsT substTypeversion getBinDir getLibDir getDynLibDir getDataDir getLibexecDir getSysconfDirgetDataFileName