[Haskell-cafe] Re: exceptions vs. Either

MR K P SCHUPKE k.schupke at imperial.ac.uk
Fri Aug 6 06:47:17 EDT 2004


>>Static guarantees are great, but if you have to explicitly change your
>>style of coding to cope with those extra constraints, it can become (very)
>>cumbersome.

I had to change coding style moving from imperative to declarative languages,
but I think it was worth it... Likewise I think having the ability to make
strong static guaranees is worth it - you may not, which is why it is 
important not to break any existing programs with language extensions
(if any are necessary). My programs will have less bugs though!

>"worse-is-better, even in its strawman form, has better survival

I fully subscribe to the 'worse is better' approach, but I don't see
how it contradicts the principle of static guarantees - you can have
both. Simplicity is about algorithmic complexity not about whether
type signatures are provided by the programmer. Infact type
signatures are in themselves an embodyment of the simple is better
principle. A type signature expresses certain static guarantees about
the function in a vary compact way. Consider the sort example...
being able to declare a type signature on a sort algorith that enforces
ordering of the output would prove the sort algorithm can _only_ output
correctly sorted lists under _all_ circunstances. This type signature
is much simpler than the actual sort - hence is useful.

	sort :: (HList l,HOrderedList l') => l -> l'

Nice and readable, and much simpler than the actual algorithm (be
it bubble sort, or a quick sort)

	Keean.


More information about the Haskell-Cafe mailing list