[Haskell-cafe] Re: Cyclic data declarations

Heinrich Apfelmus apfelmus at quantentunnel.de
Tue Aug 4 04:23:50 EDT 2009

Job Vranish wrote:
> I think that in an ideal world haskell would have some way of allowing
> infinite types if you asked for them explicitly (say in the type signature
> somehow) and then just automatically wrap/unwrap everything with newtypes
> behind the scenes (well maybe in an ideal world it wouldn't have to do this
> either). This wouldn't change the underlying semantics, but would get rid of
> alot of messyness.
> Infinite types are possible, My toy language infers infinite types just fine
> :) and I think Ocaml has an option for them, but niether of those have type
> classes so I'm not sure how compatable the idea is with haskell in general.

There was a thread with a compelling reason against vanilla infinite
types some time ago:


Of course, you can have all the recursion you want by using  newtype ,
it's just that you need to annotate them with the extraneous
constructor. In fact, that's exactly the purpose of the constructor;
think of it as an aid for the type checker.



More information about the Haskell-Cafe mailing list