In a lot of cases though annotating all the recursive aspects with newtypes is a _royal_ pain, and is even worse if you want the datatypes to be instances of common type classes like Functor, Applicative, etc... (try it sometime)
I don't advocate allowing infinite types wholesale, just in specific cases with a special annotation (like a type signature specifying the allowed infinite type). I think this would be the best of both worlds.
- Job
Job Vranish wrote:There was a thread with a compelling reason against vanilla infinite
>
> 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.
types some time ago:
http://thread.gmane.org/gmane.comp.lang.haskell.cafe/17103
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.
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe