[Haskell-cafe] Re: Cyclic data declarations
jvranish at gmail.com
Tue Aug 4 10:34:24 EDT 2009
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
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.
On Tue, Aug 4, 2009 at 4:23 AM, Heinrich Apfelmus <apfelmus at quantentunnel.de
> 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
> > 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
> > either). This wouldn't change the underlying semantics, but would get rid
> > alot of messyness.
> > Infinite types are possible, My toy language infers infinite types just
> > :) and I think Ocaml has an option for them, but niether of those have
> > classes so I'm not sure how compatable the idea is with haskell in
> 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.
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe