
7 Nov
2012
7 Nov
'12
2:51 a.m.
Hi Emmanuel! Have you looked at http://hackage.haskell.org/packages/archive/loch-th/0.2.1/doc/html/Debug-Tra... ? With the loch-th package you can write your own head function like this: {-# LANGUAGE TemplateHaskell #-} module Main where import Debug.Trace.LocationTH myHead a = $check $ head a and then something like myHead ([] :: [Char]) will print something like this: test: test.hs:21:12-17: Prelude.head: empty list In docs there is another useful function $failure that is "a location-emitting error call". Hope that helps.