[Haskell-cafe] haskell programming guidelines

Robert Dockins robdockins at fastmail.fm
Mon Feb 20 14:06:43 EST 2006

On Feb 20, 2006, at 12:48 PM, Christian Maeder wrote:
> Hi,
> haskell admits many programming styles and I find it important that  
> several developers of a prject agree on a certain style to ease  
> code review.
> I've set up guidelines (still as plain text) for our (hets) project in
> http://www.informatik.uni-bremen.de/agbkb/forschung/formal_methods/ 
> CoFI/hets/src-distribution/versions/HetCATS/docs/Programming- 
> Guidelines.txt
> These were inspired by C programming guidelines, http://haskell.org/ 
> hawiki/ThingsToAvoid and the problems I came across myself.
> It like to get comments or proposals for our or other haskell  
> grogramming guidelines.

I personally disagree with your preference for custom datatypes with  
a value representing failure to lifting types with Maybe.  I tend to  
like using the Maybe monad for composing large partial functions from  
smaller ones, but your suggestion makes that impossible.  Also, if  
you bake in your failure case into your datatype, you can't use the  
type system to differentiate explicitly partial functions (which use  
Maybe X), from ones that are not expected to be partial (which just  
use X).  Final point, using Maybe gives you an easy route to go to  
"Either String X" or some other richer monad to represent failure.

Rob Dockins

Speak softly and drive a Sherman tank.
Laugh hard; it's a long way to the bank.
           -- TMBG

More information about the Haskell-Cafe mailing list