[Haskell-cafe] Cyclical Type Synonyms

Tom Hawkins tomahawkins at gmail.com
Thu Feb 16 08:52:14 EST 2006

I want to define a type for a function that returns its own type...

type F a = a -> (F a,a)

But the compiler gives me an error: "Cycle in type synonym declaration: ...".

Why is this a restriction?

Of course I can create a user defined type, but then I need an extra
mechanism to call the embedded function:

data F a = F (a -> (F a ,a))

call :: F a -> a -> (F a, a)
call (F f) a = f a


More information about the Haskell-Cafe mailing list