{-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE IncoherentInstances #-} {-# LANGUAGE OverlappingInstances #-} module QuickAnnotate where type Loc = String class Annotatable a where annotate :: Loc -> a -> a instance Annotatable a where annotate _ = id instance Annotatable b => Annotatable (a -> b) where annotate l f = \x -> annotate l (f x)