aP\E      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                           ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D  non-portable experimentalhpacheco@di.uminho.ptThe final object. ! The only possible value of type  is . The bottom value for any type. 2 It is many times used just for type annotations. (Creates a point to the terminal object. Converts elements into points. The infix split combinator. &Injects a value to the left of a sum. 'Injects a value to the right of a sum. The infix either combinator. The infix sum combinator. $Alias for the infix sum combinator. The application combinator. $The left exponentiation combinator. %The right exponentiation combinator. +The infix combinator for a constant point. 4Guard combinator that operates on Haskell booleans. :Infix guarc combinator that simulates the postfix syntax.  The uncurried split combinator. !The uncurried either combinator. &The uncurried composition combinator.  Swap the elements of a product. Swap the elements of a sum. +Distribute products over the left of sums. +Distribute sums over the left of products. ,Distribute products over the right of sums. ,Distribute sums over the right of products. 'Associate nested products to the left. )Associates nested products to the right. $Associates nested sums to the left. %Associates nested sums to the right.     non-portable experimentalhpacheco@di.uminho.pt9 !Semantically, we can say that 87 f :@!: 87 g = 87 (f ':@: g). "#$Semantically, we can say that 87 f :*!: 87 g = 87 (f :*: g). %&'Semantically, we can say that 87 f :+!: 87 g = 87 (f :+: g). ()*Semantically, we can say that * t = 87 (B t). +,-In order to simplify type-level composition of functors, we can create fixpoint combinators that implicitely assume fixpoint application. Semantically, we can say that - = 87 FE. ./The /i class provides the value-level translation between data types and their sum of products representations 06Packs a sum of products into one equivalent data type 18unpacks a data type into the equivalent sum of products 2VShort alias to express the structurally equivalent sum of products for some data type 3 Polytypic Prelude.Functor# class for functor representations 4aFor desambiguation purposes, the type of the functor must be passed as an explicit paramaeter to 4 !The mapping over representations 5#Family of functor representations. The 5 family implements the implicit coercion between the application of a functor and the structurally equivalent sum of products. BFunctors applied to types can be represented as sums of products. 6+Family of patterns functors of data types. nThe type function is not necessarily injective, this is, different data types can have the same base functor. Semantically, we can say that a = 87 f. 7Explicit fixpoint operator. 89SThe unfolding of the fixpoint of a functor is the functor applied to its fixpoint. 9( is specialized with the application of 5) in order to subsume functor application :Composition of functors. ;<=Product of functors. >?Sum of functors. @ABConstant functor. CDEIdentity functor. FGHPolytypic map function FA value of a data type that is the fixed point of the desired functor 0The mapping over the equivalent sum of products IJKLMNOE ExpandingAcontracting the fixed point of a functor is the same as consuming applying it's single type constructor F#The list functor maps the specific G function over lists of types HjThe composition functor applies in the nesting of the mapping function to the nested functor applications IKThe product functor recursively applies the mapping function to both sides JMThe sum functor recursively applies the mapping function to each alternative K1The constant functor preserves the argument type LDThe identity functor applies the mapping function the argument type 2 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO2EFGBCD?A@=>:;<78965342H/01-.*+,'()$%&!"#IJ KLMNO2  !"#"#$%&%&'()()*+,+,-../010123445678989:;<;<=>>?A@@ABCDCDEFGFGHIJKLMNO non-portable experimentalhpacheco@di.uminho.ptP2In futumorphisms we add an alternative annotation c to the base functor of type b. Q-In histomorphisms we add an extra annotation c to the base functor of type a. R,In accumulations we add an extra annotation b to the base functor of type a. SXIn zygomorphisms we extend the recursive occurences in the base functor functor of type a with an extra annotation b. T\The functor of the intermediate type of an apomorphism is the functor of the generated type b D with an alternative annotation to itself in recursive definitions. U[The functor of the intermediate type of a paramorphism is the functor of the consumed type a G extended with an extra annotation to itself in recursive definitions. VDefinition of an hylomorphism W1Definition of a catamorphism as an hylomorphism. Catamorphisms model the fundamental pattern of iteration, where constructors for recursive datatypes are repeatedly consumed by arbitrary functions.  They are usually called folds. X(Recursive definition of a catamorphism. Y1Definition of an anamorphism as an hylomorphism. ]Anamorphisms resembles the dual of iteration and, hence, dene the inverse of catamorphisms. K Instead of consuming recursive types, they produce values of those types. Z(Recursive definition of an anamorphism. [Definition of a paramorphism. _Paramorphisms supply the gene of a catamorphism with a recursively computed copy of the input. 7The first introduction to paramorphisms is reported in  >http://www.cs.uu.nl/research/techreps/repo/CS-1990/1990-04.pdf. \(Recursive definition of a paramorphism. ]1Definition of an apomorphism as an hylomorphism. Apomorphisms are the dual recursion patterns of paramorphisms, and therefore they can express functions defined by primitive corecursion. &They were introduced independently in  .http://www.cs.ut.ee/~varmo/papers/nwpt97.ps.gz and HProgram Construction and Generation Based on Recursive Types, MSc thesis. ^(Recursive definition of an apomorphism. _1Definition of a zygomorphism as an hylomorphism. !Zygomorphisms were introduced in  Bhttp://dissertations.ub.rug.nl/faculties/science/1990/g.r.malcolm/. They can be seen as the asymmetric form of mutual iteration, where both a data consumer and an auxiliary function are defined ( 0http://www.fing.edu.uy/~pardo/papers/njc01.ps.gz). `2Definition of an accumulation as an hylomorphism. Accumulations  1http://www.fing.edu.uy/~pardo/papers/wcgp02.ps.gzS are binary functions that use the second parameter to store intermediate results. The so called accumulation techniquen is tipically used in functional programming to derive efficient implementations of some recursive functions. aoDefinition of an histomorphism as an hylomorphism (as long as the catamorphism is defined as an hylomorphism). Histomorphisms ( (http://cs.ioc.ee/~tarmo/papers/inf.ps.gz) capture the powerfull schemes of course-of-value iteration, and differ from catamorphisms for being able to apply the gene function at a deeper depth of recursion. B In other words, they allow to reuse sub-sub constructor results. bThe combinator bE unpacks the functor of an histomorphism and selects the annotation. cThe combinator cF unpacks the functor of an histomorphism and discards the annotation. dlDefinition of a futumorphism as an hylomorphism (as long as the anamorphism is defined as an hylomorphism). AFutumorphisms are the dual of histomorphisms and are proposed as 'cocourse-of-argument' coiterators by their creators ( (http://cs.ioc.ee/~tarmo/papers/inf.ps.gz). xIn the same fashion as histomorphisms, it allows to seed the gene with multiple levels of depth instead of having to do ' all at once' with an anamorphism. eThe combinator e< packs the functor of a futumorphism from the base functor. fThe combinator f: packs the functor of an futumorphism from an annotation. g2Definition of a dynamorphism as an hylomorphisms. Dynamorphisms ( 1http://math.ut.ee/~eugene/kabanov-vene-mpc-06.pdf^) are a more general form of histomorphisms for capturing dynaming programming constructions. iInstead of following the recursion pattern of the input via structural recursion (as in histomorphisms), i dynamorphisms allow us to reuse the annotated structure in a bottom-up approach and avoiding rebuilding Z it every time an annotation is needed, what provides a more efficient dynamic algorithm. h3Definition of a chronomorphism as an hylomorphism. PThis recursion pattern subsumes histomorphisms, futumorphisms and dynamorphisms r and can be seen as the natural hylomorphism generalization from composing an histomorphism after a futumorphism.  Therefore, chronomorphisms can ' look back' when consuming a type and ' jump forward' when generating one, via it's fold/!unfold operations, respectively. UThe notion of chronomorphism is a recent recursion pattern (at least known as such). - The first and single reference available is  8http://comonad.com/reader/2008/time-for-chronomorphisms/. i,The Fixpoint combinator as an hylomorphism. i is a fixpoint combinator if i =   M (N  i). "After expanding the denitions of M,  and  A we see that this corresponds to the expected pointwise equation i f = f (i f). PQRSTUVWXYZ[\]^_`abcdefghiOVWXYZU[\T]^S_R`QabcPdefghiPQRSTUVWXYZ[\]^_`abcdefghi non-portable experimentalhpacheco@di.uminho.ptj=Class for mapping observations over functor representations. kfDerives a type representation for a functor. This is used for showing the functor for reursion trees. ldWatch values of a functor. Since the fixpoint of a functor recurses over himself, we cannot use the P8 instance for functor values applied to their fixpoint. m3Maps an observation over a functor representation. n#Polytypic mapping of observations. jklmnjklmnjklmklmn non-portable experimentalhpacheco@di.uminho.pt oNRedefinition of hylomorphisms with observation of the intermediate data type. p;Redefinition of catamorphisms as observable hylomorphisms. q:Redefinition of anamorphisms as observable hylomorphisms. r;Redefinition of paramorphisms as observable hylomorphisms. s:Redefinition of apomorphisms as observable hylomorphisms. t;Redefinition of zygomorphisms as observable hylomorphisms. u;Redefinition of accumulations as observable hylomorphisms. v<Redefinition of histomorphisms as observable hylomorphisms. w;Redefinition of futumorphisms as observable hylomorphisms. x;Redefinition of dynamorphisms as observable hylomorphisms. y=Redefinition of chronomorphisms as observable hylomorphisms. opqrstuvwxy opqrstuvwxy opqrstuvwxy non-portable experimentalhpacheco@di.uminho.ptvz%Datatype declaration of a rose tree. {|%Datatype declaration of a leaf tree. }~'Datatype declaration of a binary tree. (The fixpoint of the functor of streams. The fixpoint of the functor that represents a virtual matrix used to accumulate and look up values for the edit distance algorithm. Since matrixes are not inductive types, a walk-through of a matrix is used, consisting in a list of values from the matrix ordered predictability. 1For a more detailed explanation, please refer to  1http://math.ut.ee/~eugene/kabanov-vene-mpc-06.pdf. CThe fixpoint of the list functor with a specific terminal element. UThe fixpoint of the functor representing trees with maximal branching factor of two. 5The fixpoint of the functor for a binary shape tree. NThe fixpoint of the functor that is either a constant or defined recursively.  Pre-defined algebraic addition. LDefinition of algebraic addition as an anamorphism in the point-wise style. 2Defition of algebraic addition as an anamorphism. 5Definition of algebraic addition as an hylomorphism. 5Definition of algebraic addition as an accumulation. 4Definition of algebraic addition as an apomorphism. Pre-defined algebraic product. 3Definition of algebraic product as an hylomorphism  Pre-defined ' greater than' comparison. Definition of ' greater than' as an hylomorphism. 7Native recursive definition of the factorial function. HRecursive definition of the factorial function in the point-free style. bRecursive definition of the factorial function in the point-free style with structural recursion. 9Definition of the factorial function as an hylomorphism. 8Definition of the factorial function as a paramorphism. 8Definition of the factorial function as a zygomorphism. 7Native recursive definition of the fibonacci function. HRecursive definition of the fibonacci function in the point-free style. bRecursive definition of the fibonacci function in the point-free style with structural recursion. 9Definition of the fibonacci function as an hylomorphism. :Definition of the fibonacci function as an histomorphism. 8Definition of the fibonacci function as a dynamorphism. CNative recursive definition for the binary partitions of a number. YThe number of binary partitions for a number n is the number of unique ways to partition 4 this number (ignoring the order) into powers of 2. I | Definition of the binary partitioning of a number as an hylomorphism. FDefinition of the binary partitioning of a number as an hylomorphism. EDefinition of the binary partitioning of a number as a dynamorphism. :Recursive definition of the average of a set of integers. BDefinition of the average of a set of integers as a catamorphism. 0Pre-defined wrapping of an element into a list. 0Definition of wrapping in the point-free style. 6Definition of the tail of a list as a total function. :Definition of the tail of a list in the point-free style. 4Definition of the tail of a list as an anamorphism. 4Definition of the tail of a list as a paramorphism. ,Native recursion definition of list length. =Recursive definition of list length in the point-free style. WRecursive definition of list length in the point-free style with structural recursion. .Definition of list length as an hylomorphism. -Definition of list length as an anamorphism. -Definition of list length as a catamorphism. /Native recursive definition of list filtering. 1Definition of list filtering as an catamorphism. 0Generation of infinite lists as an anamorphism. 4Finite replication of an element as an anamorphism. 2Generation of a downwards list as an anamorphism. *Ordered list insertion as an apomorphism. *Ordered list insertion as a paramorphism. ;Append an element to the end of a list as an hylomorphism. :Append an element to the end of a list as an apomorphism. ACreates a bubble from a list. Used in the bubble sort algorithm. BExtraction of a number of elements from a list as an anamorphism. LNative recursive definition for partitioning a list at a specified element. NDefinition for partitioning a list at a specified element as an hylomorphism. )Incremental summation as a catamorphism. KIncrementation the elements of a list by a specified value a catamorphism. .Definition of list mapping as a catamorphism. 0Definition of list reversion as a catamorphism. :Definition of the quicksort algorithm as an hylomorphism. ;Definition of the bubble sort algorithm as an anamorphism. >Definition of the insertion sort algorithm as a catamorphism. :Definition of the heap sort algorithm as an hylomorphism. *Malcolm downwards accumulations on lists. ;Malcom downwards accumulations on lists as an anamorphism. PUncurried version of Malcom downwards accumulations on lists as an anamorphism. <Definition of the zip for lists of pairs as an anamorphism. <Definition of the subsequences of a list as a catamorphism.  Pre-defined list concatenation. &List concatenation as a catamorphism. 'List concatenation as an hylomorphism. =Native recursive definition of lists-of-lists concatenation. >Definition of lists-of-lists concatenation as an anamorphism. 6Sorted concatenation of two lists as an hylomorphism. 0Definition of inter addition as a catamorphism. 7Native recursive definition of integer multiplication. 8Definition of integer multiplication as a catamorphism. <Native recursive definition of the edit distance algorithm. KEdit distance is a classical dynamic programming algorithm that calculates P a measure of distance or dierence between lists with comparable elements. 0The edit distance algorithm as an hylomorphism. /The edit distance algorithm as a dynamorphism.  Stream head.  Stream tail. >Definition of a stream sequence generator as an anamorphism. &Identity o streams as an anamorphism. (Mapping over streams as an anamorphism. ,Malcolm downwards accumulations on streams. =Malcom downwards accumulations on streams as an anamorphism. RUncurried version of Malcom downwards accumulations on streams as an anamorphism. <Promotes streams elements to streams of singleton elements. =Definition of parwise exchange on streams as a futumorphism. BCounting the number of leaves in a binary tree as a catamorphism. ACounting the number of nodes in a binary tree as a catamorphism. GGeneration of a binary tree with a specified height as an anamorphism. :The preorder traversal on binary trees as a catamorphism. ;The postorder traversal on binary trees as a catamorphism. 5Extract the leaves of a leaf tree as a catamorphism. DGeneration of a leaft tree of a specified height as an anamorphism. 7Calculate the height of a leaf tree as a catamorphism. 9The postorder traversal on rose trees as a catamorphism. CGeneration of a rose tree of a specified height as an anamorphism. wz{|}~Qv|~}z{vz{{|~}}~ non-portable experimentalhpacheco@di.uminho.pt ADefinition of the observable length function as an hylomorphism. @Definition of the observable length function as an anamorphism. @Definition of the observable length function as a catamorphism. DDefinition of the observable factorial function as an hylomorphism. CDefinition of the observable factorial function as a paramorphism. CDefinition of the observable factorial function as a zygomorphism. DDefinition of the observable fibonacci function as an hylomorphism. EDefinition of the observable fibonacci function as an histomorphism. CDefinition of the observable fibonacci function as a dynamorphism. DDefinition of the observable quicksort function as an hylomorphism. >Definition of the observable tail function as a paramorphism. >Definition of the observable add function as an accumulation.  non-portable experimentalhpacheco@di.uminho.pt !Class of representable functors. 0Functor GADT for polytypic recursive functions. % At the moment it does not rely on a Typeable instance for constants. )The fixpoint of a representable functor. ?The representation of the fixpoint of a representable functor.     non-portable experimentalhpacheco@di.uminho.pt .The left-to-right monadic binding combinator. Higher-order monadic binding. ,The monadic left exponentiation combinator.  -The monadic right exponentiation combinator.  The monadic sum combinator.  +The strength combinator for strong monads. , In Haskell, every monad is a strong monad:  @http://comonad. com/reader/2008/deriving-strength-from-laziness/.  The monadic fusion combinator. G Performs left-to-right distribution of a strong monad over a product.  The monadic split combinator.  The monadic product combinator.                    non-portable experimentalhpacheco@di.uminho.pt+ !"#$%&'()*+,-./0123456789+ !"#$%&'()*+,-./0123456789+678345012-/.+,()*%&'$#!" 9+ !""#$%&'&'()*)*+,,-/../0121234545678789  non-portable experimentalhpacheco@di.uminho.pt :#Class of representable bifunctors. ;<2Functor GADT for polytypic recursive bifunctions. % At the moment it does not rely on a Typeable instance for constants. =>?@ABC+The fixpoint of a representable bifunctor. D?The representation of the fixpoint of a representable functor. :;<=>?@ABCD <BA@?>=:;CD :;;<BA@?>==>?@ABCDR   !"#$%&'()*+,-./0123456789:;<=>?@ABCCDEFGHIJKLMNOPPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~-3069                        ! " # $ % & ' ( ) * * + , - . / 0 1 2 3 4 5 6 7 7 8 9 9 : ; < = >    ?   @ ABCDEFGHIJKDELDEMNDOPQRpointless-haskell-0.0.2Generics.Pointless.CombinatorsGenerics.Pointless.Functors$Generics.Pointless.RecursionPatterns#Generics.Pointless.Observe.Functors,Generics.Pointless.Observe.RecursionPatterns$Generics.Pointless.Examples.Examples#Generics.Pointless.Examples.ObserveGenerics.Pointless.Fctrable#Generics.Pointless.MonadCombinatorsGenerics.Pointless.BifunctorsGenerics.Pointless.BifctrableOne_Lbangpnt/\><inlinr\/-|-<>applexprexp!grd?spliteithrcompswapcoswapdistlundistldistrundistrassoclassocrcoassoclcoassocrNatSuccZero:@!:FixComp unFixComp:*!:FixProd unFixProd:+!:FixSumunFixSumKFixConst unFixConstIFixIdMuinnoutFFunctorfmapRepPFFixunFix:@:CompunComp:*:Prod:+:InrInlConstConsunConsIdunIdpmapnilconszerosucktruefalse maybe2boolFutuHistoAccumZygoApoParahylocatacataRecanaanaRecparaparaRecapoapoReczygoaccumhistooutloutrfutuinnlinnrdynachronofixFunctorO functorOfwatchfmapOomaphyloOcataOanaOparaOapoOzygoOaccumOhistoOfutuOdynaOchronoORoseForestLTreeBranchLeafTreeNodeEmptyStream EditDistLEditDistNeListBTreeBSTreeFromaddaddAnaPWaddAnaaddHyloaddAccumaddApoPWaddApoprodprodHylogtgtHylofactfactPFfactPF'factHylofactParafactZygofibfibPFfibPF'fibHylofibHistofibDynabpbpHylobpDynaaverage averageCatawrapwrapPFtailtailPFtailCatatailParalengthlengthPF lengthPF' lengthHylo lengthAna lengthCatafilter filterCata repeatAna replicateAna downtoAna insertApo insertParasnocsnocApobubbletakeAna partition partitionHyloisumfisummapCata reverseAnaqsortbsortisortmsplitmsorthsorthsplitmalcolm malcolmAna malcolmAna'zipAna subsequencescatcatCatacatHyloconcat concatCatamergesumCatamultmultCatasortededitdist editdistHylo editDistDynaheadStailSgenerateidStream mapStreammalcolmS malcolmSAna malcolmSAna'initsexchFutunleavesnnodesgenTreepreTreepostTreeleavesgenLTreeheightpreRosepostRosegenRose lengthHyloO lengthAnaO lengthCataO factHyloO factParaO factZygoOfibHyloO fibHistoOfibDynaO qsortHyloO tailParaO addAccumOFctrablefctrFctrfixFfctrF<<=bindmlexpmrexp-||- mstrengthmfuse/|\>|<:@!|FixBComp unFixBComp:*!|FixBProd unFixBProd:+!|FixBSum unFixBSumBK FixBConst unFixBConstBIFixBIdBimubinnboutB BifunctorbmapBRepBFBFixunBFix:@|BCompunBComp:*|BProd:+|BInrBInlBParParunParBConstunBConstBIdunBIdpbmap BifctrablebctrBifctrBPfixBfctrB$fMuFix $fFunctor[]baseGHC.Basemap $fFunctor:@: $fFunctor:*: $fFunctor:+:$fFunctorConst $fFunctorId.idnuGHC.ShowShowone