Thanks, Ketil, your suggestion really helped me ! Thanks to Claus for the tips !

On 4/26/05, Ketil Malde <[EMAIL PROTECTED]> wrote:
> 
> "Claus Reinke" <[EMAIL PROTECTED]> writes:
> 
> > no direct answer to your question, but a general comment on the
> > original problem (speaking from bad experience;-): things like
> > "head" have no place in a Haskell program of any non-trivial size,
> > because of their useless error messages.
> 
> I must say I liked John Meacham's description of his "magic
> underscore".  My solution to this problem is redefining the
> troublesome functions as cpp macros, e.g:
> 
>  #define BUG(C_,M_) (error ("Program error - '"++C_++"' failed: "++M_++". 
> Location: '"++__FILE__++"' line "++show __LINE__))
>  #define head (\xs -> case xs of { (x:_) -> x ; _ -> BUG("head","empty 
> list")})
> 
> Ideally, I think something like this should be the default behavior
> for these functions.
> 
> -kzm
> 
> PS: If anybody wants, I can mail my additional cpp definitions for 'head',
> 'at' (array indexing, I couldn't work out how to redefine the bang),
> 'read' and 'fromJust'.
> --
> If I haven't seen further, it is by standing in the footprints of giants
> 
> 


-- 
________________________________
Monique Louise B.Monteiro
Msc Student in Computer Science
Center of Informatics
Federal University of Pernambuco
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to