[Haskell-cafe] exceptions vs. Either

MR K P SCHUPKE k.schupke at imperial.ac.uk
Wed Aug 4 04:49:04 EDT 2004

>Yes, in principle.  But that means you still need to write more and
>tedious code to deal with it.

Just because code is tedious does not mean it is not necessary to
handle all corner cases. A robust application does not fail when
given unexpected input.

>Are you going to discard lists in favor of tuples,

Of course not... You can actually define constrained datatypes where
the maximum length is a parameter of the type. Unfortunately in haskell
because these values have to be at the type level we end up encoding
them as Peano numbers... See Conor McBrides "Faking It" paper for
some examples of how to do this. Also see Oleg, Ralf and My paper
"Stronly Typed Heterogeneous Lists" to se how far you can get with
these techniques (we define a heterogeneous list that can be constrained
in many ways, including by length, or content type).

I guess in a way you are nearly right as these techniques fundamentaly
us binary products like (,) - but thats also exactly what any binary
constructor including ':' is anyway...

>The only difference is that I want to do it automatically

My point was that you can manually label some functions, but to automatically
do it for all functions is going to cause big stack space problems - think
about recursive functions... or mutually recursive functions... 


More information about the Haskell-Cafe mailing list