diff options
Diffstat (limited to 'compiler/hsSyn/Convert.lhs')
-rw-r--r-- | compiler/hsSyn/Convert.lhs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler/hsSyn/Convert.lhs b/compiler/hsSyn/Convert.lhs index 383b641262..8a4f7d8783 100644 --- a/compiler/hsSyn/Convert.lhs +++ b/compiler/hsSyn/Convert.lhs @@ -32,7 +32,8 @@ import FastString import Outputable import qualified Data.ByteString as BS -import Control.Monad( unless ) +import Control.Monad( unless, liftM, ap ) +import Control.Applicative (Applicative(..)) import Language.Haskell.TH as TH hiding (sigP) import Language.Haskell.TH.Syntax as TH @@ -72,6 +73,13 @@ newtype CvtM a = CvtM { unCvtM :: SrcSpan -> Either MsgDoc a } -- In particular, we want it on binding locations, so that variables bound in -- the spliced-in declarations get a location that at least relates to the splice point +instance Functor CvtM where + fmap = liftM + +instance Applicative CvtM where + pure = return + (<*>) = ap + instance Monad CvtM where return x = CvtM $ \_ -> Right x (CvtM m) >>= k = CvtM $ \loc -> case m loc of |