diff options
Diffstat (limited to 'compiler/basicTypes/UniqSupply.hs')
-rw-r--r-- | compiler/basicTypes/UniqSupply.hs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/compiler/basicTypes/UniqSupply.hs b/compiler/basicTypes/UniqSupply.hs index 8780a52208..9697566efc 100644 --- a/compiler/basicTypes/UniqSupply.hs +++ b/compiler/basicTypes/UniqSupply.hs @@ -4,6 +4,7 @@ -} {-# LANGUAGE CPP #-} +{-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE PatternSynonyms #-} #if !defined(GHC_LOADED_INTO_GHCI) @@ -148,20 +149,18 @@ pattern UniqResult x y = (# x, y #) #else data UniqResult result = UniqResult !result {-# UNPACK #-} !UniqSupply + deriving (Functor) #endif -- | A monad which just gives the ability to obtain 'Unique's newtype UniqSM result = USM { unUSM :: UniqSupply -> UniqResult result } + deriving (Functor) instance Monad UniqSM where (>>=) = thenUs (>>) = (*>) -instance Functor UniqSM where - fmap f (USM x) = USM (\us0 -> case x us0 of - UniqResult r us1 -> UniqResult (f r) us1) - instance Applicative UniqSM where pure = returnUs (USM f) <*> (USM x) = USM $ \us0 -> case f us0 of |