
20 Jan
2011
20 Jan
'11
9:36 a.m.
On 20 January 2011 14:33, Bas van Dijk
On 20 January 2011 10:48, Evan Laforge
wrote: I still like the pragma...
Maybe Template Haskell can help:
module Location where
import Language.Haskell.TH import Data.Functor ((<$>))
loc :: Q Exp loc = LitE . StringL . show . loc_start <$> location
{-# LANGUAGE TemplateHaskell #-}
module Main where
import Location main = do putStrLn $loc putStrLn $loc putStrLn $loc
*Main> main (7,12) (8,12) (9,12)
Regards,
Bas
You should also take a look at the control-monad-exception package which provides, among other things, support for exception call traces (with source locations). Take a look at the description to see an example: http://hackage.haskell.org/package/control-monad-exception Regards, Bas