module Debug.Trace.FunctionCall where
import Debug.Trace
class Traceable a
where traceFunction :: String -> a -> a
instance Show a => Traceable a
where traceFunction n x = trace (n ++ " = " ++ show x) x
instance (Showable a, Traceable b) => Traceable (a -> b)
where traceFunction n f x = traceFunction (n ++ " " ++ showFunction x) (f x)
class Showable a where showFunction :: a -> String
instance Show a => Showable a where showFunction x = showsPrec 11 x ""
instance Showable (a -> b) where showFunction _ = "_"