category-theory-presentation/categories/30_How/300_Catamorphisms/050_morphism_Type_work.html
2013-02-28 16:49:12 +01:00

19 lines
452 B
HTML

<h2 id="κατα-morphism-type-work">κατα-morphism: Type work</h2>
<pre class="haskell"><code>
data StrF a = Cons Char a | Nil
data Str = StrF Str
-- generalize the construction of Str to other datatype
-- Mu :: type fixed point
data Mu f = InF { outF :: f (Mu f) }
data Str = Mu StrF
-- Example
foo=InF { outF = Cons 'f'
(InF { outF = Cons 'o'
(InF { outF = Cons 'o'
(InF { outF = Nil })})})}</code></pre>