[Haskell-cafe] Re: Cyclic data declarations

Job Vranish 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.

- Job

On Tue, Aug 4, 2009 at 4:23 AM, Heinrich Apfelmus <apfelmus at quantentunnel.de
> wrote:

> 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:
>    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.
> Regards,
> apfelmus
> --
> http://apfelmus.nfshost.com
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090804/b9753d08/attachment.html

More information about the Haskell-Cafe mailing list