summaryrefslogtreecommitdiff
path: root/compiler/utils/IOEnv.hs
diff options
context:
space:
mode:
authorKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2019-06-08 20:48:07 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-06-12 07:37:12 -0400
commit1219f8e8a3d1b58263bea76822322b746a632778 (patch)
treebd93bdf1e09cd26a7c6104ba37c6734a74e8a7bc /compiler/utils/IOEnv.hs
parent217e6db4af6752b13c586d4e8925a4a9a2f47245 (diff)
downloadhaskell-1219f8e8a3d1b58263bea76822322b746a632778.tar.gz
Use DeriveFunctor throughout the codebase (#15654)
Diffstat (limited to 'compiler/utils/IOEnv.hs')
-rw-r--r--compiler/utils/IOEnv.hs6
1 files changed, 2 insertions, 4 deletions
diff --git a/compiler/utils/IOEnv.hs b/compiler/utils/IOEnv.hs
index d6807da71a..e62a2bcddf 100644
--- a/compiler/utils/IOEnv.hs
+++ b/compiler/utils/IOEnv.hs
@@ -1,4 +1,5 @@
{-# LANGUAGE CPP #-}
+{-# LANGUAGE DeriveFunctor #-}
--
-- (c) The University of Glasgow 2002-2006
--
@@ -51,7 +52,7 @@ import Control.Applicative (Alternative(..))
----------------------------------------------------------------------
-newtype IOEnv env a = IOEnv (env -> IO a)
+newtype IOEnv env a = IOEnv (env -> IO a) deriving (Functor)
unIOEnv :: IOEnv env a -> (env -> IO a)
unIOEnv (IOEnv m) = m
@@ -71,9 +72,6 @@ instance Applicative (IOEnv m) where
IOEnv f <*> IOEnv x = IOEnv (\ env -> f env <*> x env )
(*>) = thenM_
-instance Functor (IOEnv m) where
- fmap f (IOEnv m) = IOEnv (\ env -> fmap f (m env))
-
returnM :: a -> IOEnv env a
returnM a = IOEnv (\ _ -> return a)