Using catamorphism 0.5.0.1, the following program fails to compile:
{-# LANGUAGE TemplateHaskell #-}
import Data.Morphism.Cata
data List a = Empty | Cons a (List (List a))
$(makeCata defaultOptions ''List)
main = return ()
The makeCata invocation generates code yielding the error message
treecata.hs:6:3:
Couldn't match type ‘a1’ with ‘List a1’
‘a1’ is a rigid type variable bound by
the type signature for list :: a -> (a1 -> a -> a) -> List a1 -> a
at treecata.hs:6:3
Expected type: List a1
Actual type: List (List a1)
Relevant bindings include
a_a2p8 :: List (List a1) (bound at treecata.hs:6:3)
a_a2p7 :: a1 (bound at treecata.hs:6:3)
x_a2p6 :: List a1 (bound at treecata.hs:6:3)
c_a2p5 :: a1 -> a -> a (bound at treecata.hs:6:3)
list :: a -> (a1 -> a -> a) -> List a1 -> a
(bound at treecata.hs:6:3)
In the third argument of ‘list’, namely ‘a_a2p8’
In the second argument of ‘c_a2p5’, namely
‘list c_a2p4 c_a2p5 a_a2p8’
Using catamorphism 0.5.0.1, the following program fails to compile:
The
makeCata
invocation generates code yielding the error message