
On Thu, Feb 25, 2010 at 03:32:25AM +0000, Jon Harrop wrote:
On Thursday 25 February 2010 00:31:59 Brent Yorgey wrote:
On Wed, Feb 24, 2010 at 11:53:50PM +0000, Jon Harrop wrote:
Haskell has recursive types, but they are iso-recursive rather than equi-recursive; the recursion must always be guarded by a data constructor. I am not sure what you mean by saying that Data.Function contains a "workaround".
Guarding the recursion with a constructor is the workaround I was referring to, like this:
# let fix f = (fun (`X x) -> f(x (`X x))) (`X(fun (`X x) y -> f(x (`X x)) y));; val fix : (('a -> 'b) -> 'a -> 'b) -> 'a -> 'b = <fun>
What exactly are you trying to do?
I'm wondering if it is possible to get this to type in Haskell without altering the code, i.e. by enabling recursive types in the compiler as I did with OCaml using -rectypes.
No, it isn't. There's no equivalent of -rectypes in any Haskell compiler I'm aware of. -Brent