[Haskell-cafe] How to debug GHC

Monique Louise monique.louise at gmail.com
Tue Apr 26 18:44:23 EDT 2005


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

On 4/26/05, Ketil Malde <ketil+haskell at ii.uib.no> wrote:
> 
> "Claus Reinke" <claus.reinke at talk21.com> 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


More information about the Haskell-Cafe mailing list