[Haskell-cafe] Re: Use unsafePerformIO to catch Exception?

Jason Dusek jason.dusek at gmail.com
Fri Mar 27 17:51:50 EDT 2009


2009/03/27 John Lato <jwlato at gmail.com>:
> From: Jules Bean <jules at jellybean.co.uk>
> > wren ng thornton wrote:
> > > The type of head should not be [a] -> a + Error, it should
> > > be (a:[a]) -> a. With the latter type the compiler can
> > > ensure the precondition will be proved before calling
> > > head, thus eliminating erroneous calls.
> >
> > Yes, but you know and I know that's not haskell.
> >
> > I'm talking about haskell.
> >
> > In haskell - a language which does not fully support
> > dependent types - head is both necessary and useful.
>
> I could follow the rest of this, but I don't understand why
> 'head' is necessary.  Couldn't you always replace it with a
> case statement, with undefined on [] if necessary?

  How would that be any different from head?

--
Jason Dusek


More information about the Haskell-Cafe mailing list