Îõ³h%P¾Î      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNone789;ÁÃÄÈËÖØÙÛó  recursion Base functor for a list of type [a]. recursion&Catamorphism. Folds a structure. (see  Ñhttp://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.41.125&rep=rep1&type=pdfhere):{let { sum' :: (Num a) => [a] -> a ; sum' = cata a where a Nil = 0 a (Cons x xs) = x + xs}:} sum' [1..100]5050 recursion7Anamorphism, meant to build up a structure recursively. recursion4Hylomorphism; fold a structure while building it up. recursionSee  Ïhttp://hackage.haskell.org/package/cpkg-0.2.3.1/src/src/Package/C/Build/Tree.hshere for an example! recursionÖPrepromorphism. Fold a structure while applying a natural transformation at each step." recursion×Postpromorphism. Build up a structure, applying a natural transformation along the way.# recursionA mutumorphism.:{ let { even' :: Natural -> Bool ; even' = mutu o e where% o :: Maybe (Bool, Bool) -> Bool o Nothing = False o (Just (_, b)) = b% e :: Maybe (Bool, Bool) -> Bool e Nothing = True e (Just (_, b)) = b}:}even' 10True& recursion String ; spongebobZygo = zygo a pa where" a :: ListF Char Bool -> Bool a Nil = False a (Cons ' ' b) = b a (Cons ',' b) = b a (Cons _ b) = not b/ pa :: ListF Char (Bool, String) -> String! pa Nil = "", pa (Cons c (True, s)) = toUpper c : s, pa (Cons c (False, s)) = toLower c : s}:}spongebobZygo "Hello, World""HeLlO, wOrLd":set -XFlexibleContexts:{ let {( succDiff :: Integral a => [a] -> [a] ; succDiff = zygo a pa where a Nil = Nothing! a (Cons i _) = Just i pa Nil = []* pa (Cons x (Nothing, xs)) = []3 pa (Cons x (Just y, xs)) = (y - x) : xs}:}succDiff [ i^2 | i <- [1..10] ][3,5,7,9,11,13,15,17,19]( recursion Paramorphism:{ let { dedup :: Eq a => [a] -> [a] ; dedup = para pa where- pa :: Eq a => ListF a ([a], [a]) -> [a] pa Nil = []Á pa (Cons x (past, xs)) = if x `elem` past then xs else x:xs}:} dedup [1,1,2][1,2]) recursionÝGibbons' metamorphism. Tear down a structure, transform it, and then build up a new structure* recursion›Erwig's metamorphism. Essentially a hylomorphism with a natural transformation in between. This allows us to use more than one functor in a hylomorphism.+ recursionMendler's catamorphismimport Data.Word (Word64)let asFix = cata Fix'let base = (2 ^ (64 :: Int)) :: Integer:{let {, wordListToInteger :: [Word64] -> Integer ;& wordListToInteger = mcata ma . asFix where5 ma f (Cons x xs) = fromIntegral x + base * f xs ma _ Nil = 0}:}wordListToInteger [1,0,1]'340282366920938463463374607431768211457, recursionMendler's histomorphismSee  *https://dl.acm.org/doi/pdf/10.1145/3409004here for an example- recursionElgot algebra (see  https://arxiv.org/abs/cs/0609040 this paper):{let {' collatzLength :: Integer -> Integer ; collatzLength = elgot a pc where= pc :: Integer -> Either Integer (ListF Integer Integer) pc 1 = Left 1 pc n3 | n `mod` 2 == 0 = Right $ Cons n (div n 2)0 | otherwise = Right $ Cons n (3 * n + 1)+ a :: ListF Integer Integer -> Integer a Nil = 0 a (Cons _ x) = x + 1}:}collatzLength 2223183. recursion(Anamorphism allowing shortcuts. Compare 0:{ let {+ collatzSequence :: Integer -> [Integer] ; collatzSequence = micro pc where? pc :: Integer -> Either [Integer] (ListF Integer Integer) pc 1 = Left [1] pc n3 | n `mod` 2 == 0 = Right $ Cons n (div n 2)0 | otherwise = Right $ Cons n (3 * n + 1)}:}collatzSequence 13[13,40,20,10,5,16,8,4,2,1]/ recursionCo-(Elgot algebra)import Data.Word (Word64)'let base = (2 ^ (64 :: Int)) :: Integer:{ let {, integerToWordList :: Integer -> [Word64] ;" integerToWordList = coelgot pa c where× c i = Cons (fromIntegral (i `mod` (2 ^ (64 :: Int)))) (i `div` (2 ^ (64 :: Int)))9 pa (i, ws) | i < 2 ^ (64 :: Int) = [fromIntegral i]' | otherwise = embed ws}:}9integerToWordList 340282366920938463463374607431768211457[1,0,1]0 recursionApomorphism. Compare ..:{let {* isInteger :: (RealFrac a) => a -> Bool ;' isInteger = idem (realToFrac . floor) where idem f x = x == f x}:}:{ let {= continuedFraction :: (RealFrac a, Integral b) => a -> [b] ; continuedFraction = apo pc where pc x$ | isInteger x = go $ Left []( | otherwise = go $ Right alpha where2 alpha = 1 / (x - realToFrac (floor x))" go = Cons (floor x)}:}take 13 $ continuedFraction pi[3,7,15,1,292,1,1,1,2,1,3,1,14]:{let {4 integerToWordList :: Integral a => a -> a -> [a] ;! integerToWordList base = apo pc where8 pc i | i < base = Cons (fromIntegral i) (Left [])Ò | otherwise = Cons (fromIntegral (i `mod` base)) (Right (i `div` base))}:}integerToWordList 2 5[1,0,1]1 recursion Hypomorphism.3  !"#$%&'()*+,-./0123  !"#'(01-/.)*&,+$% 2NoneÖÛ´K recursionShould satisfy: K N = O KLMKLMÐ      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOMPQÒrecursion-2.2.4.3-inplaceControl.RecursionControl.Recursion.GHCMuNuFixunFix NonEmptyFListFConsNil Corecursiveembed RecursiveprojectBasecataanahylocataMparaMzygoMzygoM'scolioMscolioM'anaMhyloMelgotMmicroMcoelgotMlambekcolambekprepropostpromutumutuMmutuM'scoliozygoparametameta'mcatamhistoelgotmicrocoelgotapohyporefix$fHCoerce:+::+:$fHCoerce:*::*: $fHCoerceV1V1 $fHCoerceU1U1 $fHCoerceK1K1 $fHCoerceM1M1$fCorecursiveFix$fCorecursiveNonEmpty$fCorecursive[]$fCorecursiveMu$fCorecursiveNu$fCorecursiveNatural$fRecursiveFix$fRecursiveNonEmpty $fRecursive[] $fRecursiveMu $fRecursiveNu$fRecursiveNatural$fFunctorNonEmptyF$fFoldableNonEmptyF$fTraversableNonEmptyF$fFunctorListF$fFoldableListF$fTraversableListF transverse cotransversehoistbaseData.Traversable sequenceAGHC.Basepure