On May 9, 2010, at 1:04 AM, wren ng thornton wrote:

> If you're structuring your code with that invariant, then why aren't you 
> using the correct type?

I do try to use the type system as much as possible to enforce constraints.  
However. it is not always so simple as making sure that a list always has two 
elements;  you might be working with some kind of complicated data structure 
such that if you see that it satisfies some property then if you preserved the 
invariant correctly then you know that a given list must have at least two 
elements.

> If your response is that you use too many of the standard list functions, 
> then write a module with ALT versions (because evidently you need one)


While, again, I do agree that it is smart to use the type system as much as 
possible to enforce constraints in order to avoid refutable pattern matches, I 
would argue that when you start creating duplicates of entire pre-existing 
modules towards this end then the cure may be starting to become worse that the 
disease.

Cheers,
Greg

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to