Polymorphic recursion does not appear to be supported by ghc 2.01
running on an Alpha/OSF1V2.0 with GCC 2.7.0.
Trying to compile the sample program described in the Haskell 1.3 Report
at the end of Section 4.4.1 produces the error:
"polyrec.lhs", line 3: Couldn't match the *signature/existential* type variable
a{-aZE-} with the type Prelude.Int
Expected: T a{-aZE-}
Inferred: T Prelude.Int
In the first argument of f namely x{-r8-}
In the first argument of (==) namely f x{-r8-}
In an equation for function f:
f (K x{-r8-} y{-r9-})
= if f x{-r8-} == 1 then f y{-r9-} else undefined
The program is
>data T a = K (T Int) (T a)
>f :: T a -> a
>f (K x y) = if f x == 1 then f y else undefined
>main = print True
Every other attempt I've made to use polymorphic recursion returns a similar
error.
Chris