summaryrefslogtreecommitdiff
path: root/compiler/codeGen
diff options
context:
space:
mode:
authorAustin Seipp <austin@well-typed.com>2014-04-22 06:09:40 -0500
committerAustin Seipp <austin@well-typed.com>2014-09-09 08:13:27 -0500
commitd94de87252d0fe2ae97341d186b03a2fbe136b04 (patch)
tree1cac19f2786b1d8a1626886cd6373946a3a276b0 /compiler/codeGen
parentfdfe6c0e50001add357475a1a3a7627243a28a70 (diff)
downloadhaskell-d94de87252d0fe2ae97341d186b03a2fbe136b04.tar.gz
Make Applicative a superclass of Monad
Summary: This includes pretty much all the changes needed to make `Applicative` a superclass of `Monad` finally. There's mostly reshuffling in the interests of avoid orphans and boot files, but luckily we can resolve all of them, pretty much. The only catch was that Alternative/MonadPlus also had to go into Prelude to avoid this. As a result, we must update the hsc2hs and haddock submodules. Signed-off-by: Austin Seipp <austin@well-typed.com> Test Plan: Build things, they might not explode horribly. Reviewers: hvr, simonmar Subscribers: simonmar Differential Revision: https://phabricator.haskell.org/D13
Diffstat (limited to 'compiler/codeGen')
-rw-r--r--compiler/codeGen/StgCmmBind.hs4
-rw-r--r--compiler/codeGen/StgCmmExpr.hs4
-rw-r--r--compiler/codeGen/StgCmmExtCode.hs5
-rw-r--r--compiler/codeGen/StgCmmForeign.hs5
-rw-r--r--compiler/codeGen/StgCmmHeap.hs4
-rw-r--r--compiler/codeGen/StgCmmLayout.hs4
-rw-r--r--compiler/codeGen/StgCmmMonad.hs20
-rw-r--r--compiler/codeGen/StgCmmPrim.hs4
-rw-r--r--compiler/codeGen/StgCmmUtils.hs2
9 files changed, 40 insertions, 12 deletions
diff --git a/compiler/codeGen/StgCmmBind.hs b/compiler/codeGen/StgCmmBind.hs
index 4631b2dc14..444112f967 100644
--- a/compiler/codeGen/StgCmmBind.hs
+++ b/compiler/codeGen/StgCmmBind.hs
@@ -53,6 +53,10 @@ import DynFlags
import Data.Maybe
import Control.Monad
+#if __GLASGOW_HASKELL__ >= 709
+import Prelude hiding ((<*>))
+#endif
+
------------------------------------------------------------------------
-- Top-level bindings
------------------------------------------------------------------------
diff --git a/compiler/codeGen/StgCmmExpr.hs b/compiler/codeGen/StgCmmExpr.hs
index ad34b5ba19..b2b64f8650 100644
--- a/compiler/codeGen/StgCmmExpr.hs
+++ b/compiler/codeGen/StgCmmExpr.hs
@@ -48,6 +48,10 @@ import Outputable
import Control.Monad (when,void)
+#if __GLASGOW_HASKELL__ >= 709
+import Prelude hiding ((<*>))
+#endif
+
------------------------------------------------------------------------
-- cgExpr: the main function
------------------------------------------------------------------------
diff --git a/compiler/codeGen/StgCmmExtCode.hs b/compiler/codeGen/StgCmmExtCode.hs
index 5f412b3cf8..931b55624b 100644
--- a/compiler/codeGen/StgCmmExtCode.hs
+++ b/compiler/codeGen/StgCmmExtCode.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP #-}
+
-- | Our extended FCode monad.
-- We add a mapping from names to CmmExpr, to support local variable names in
@@ -49,8 +51,9 @@ import UniqFM
import Unique
import Control.Monad (liftM, ap)
+#if __GLASGOW_HASKELL__ < 709
import Control.Applicative (Applicative(..))
-
+#endif
-- | The environment contains variable definitions or blockids.
data Named
diff --git a/compiler/codeGen/StgCmmForeign.hs b/compiler/codeGen/StgCmmForeign.hs
index 6937c85d01..eb1c7da76d 100644
--- a/compiler/codeGen/StgCmmForeign.hs
+++ b/compiler/codeGen/StgCmmForeign.hs
@@ -41,7 +41,12 @@ import Outputable
import BasicTypes
import Control.Monad
+
+#if __GLASGOW_HASKELL__ >= 709
+import Prelude hiding( succ, (<*>) )
+#else
import Prelude hiding( succ )
+#endif
-----------------------------------------------------------------------------
-- Code generation for Foreign Calls
diff --git a/compiler/codeGen/StgCmmHeap.hs b/compiler/codeGen/StgCmmHeap.hs
index 7ac2c7a0bd..eca118fd25 100644
--- a/compiler/codeGen/StgCmmHeap.hs
+++ b/compiler/codeGen/StgCmmHeap.hs
@@ -47,6 +47,10 @@ import Module
import DynFlags
import FastString( mkFastString, fsLit )
+#if __GLASGOW_HASKELL__ >= 709
+import Prelude hiding ((<*>))
+#endif
+
import Control.Monad (when)
import Data.Maybe (isJust)
diff --git a/compiler/codeGen/StgCmmLayout.hs b/compiler/codeGen/StgCmmLayout.hs
index d62101f27e..af2d6619ea 100644
--- a/compiler/codeGen/StgCmmLayout.hs
+++ b/compiler/codeGen/StgCmmLayout.hs
@@ -25,6 +25,10 @@ module StgCmmLayout (
#include "HsVersions.h"
+#if __GLASGOW_HASKELL__ >= 709
+import Prelude hiding ((<*>))
+#endif
+
import StgCmmClosure
import StgCmmEnv
import StgCmmArgRep -- notably: ( slowCallPattern )
diff --git a/compiler/codeGen/StgCmmMonad.hs b/compiler/codeGen/StgCmmMonad.hs
index 22c89d7e05..57120cf5ce 100644
--- a/compiler/codeGen/StgCmmMonad.hs
+++ b/compiler/codeGen/StgCmmMonad.hs
@@ -393,7 +393,7 @@ addCodeBlocksFrom :: CgState -> CgState -> CgState
-- Add code blocks from the latter to the former
-- (The cgs_stmts will often be empty, but not always; see codeOnly)
s1 `addCodeBlocksFrom` s2
- = s1 { cgs_stmts = cgs_stmts s1 <*> cgs_stmts s2,
+ = s1 { cgs_stmts = cgs_stmts s1 MkGraph.<*> cgs_stmts s2,
cgs_tops = cgs_tops s1 `appOL` cgs_tops s2 }
@@ -697,7 +697,7 @@ newLabelC = do { u <- newUnique
emit :: CmmAGraph -> FCode ()
emit ag
= do { state <- getState
- ; setState $ state { cgs_stmts = cgs_stmts state <*> ag } }
+ ; setState $ state { cgs_stmts = cgs_stmts state MkGraph.<*> ag } }
emitDecl :: CmmDecl -> FCode ()
emitDecl decl
@@ -724,7 +724,7 @@ emitProcWithStackFrame _conv mb_info lbl _stk_args [] blocks False
emitProcWithStackFrame conv mb_info lbl stk_args args blocks True -- do layout
= do { dflags <- getDynFlags
; let (offset, live, entry) = mkCallEntry dflags conv args stk_args
- ; emitProc_ mb_info lbl live (entry <*> blocks) offset True
+ ; emitProc_ mb_info lbl live (entry MkGraph.<*> blocks) offset True
}
emitProcWithStackFrame _ _ _ _ _ _ _ = panic "emitProcWithStackFrame"
@@ -778,21 +778,21 @@ mkCmmIfThenElse e tbranch fbranch = do
endif <- newLabelC
tid <- newLabelC
fid <- newLabelC
- return $ mkCbranch e tid fid <*>
- mkLabel tid <*> tbranch <*> mkBranch endif <*>
- mkLabel fid <*> fbranch <*> mkLabel endif
+ return $ mkCbranch e tid fid MkGraph.<*>
+ mkLabel tid MkGraph.<*> tbranch MkGraph.<*> mkBranch endif MkGraph.<*>
+ mkLabel fid MkGraph.<*> fbranch MkGraph.<*> mkLabel endif
mkCmmIfGoto :: CmmExpr -> BlockId -> FCode CmmAGraph
mkCmmIfGoto e tid = do
endif <- newLabelC
- return $ mkCbranch e tid endif <*> mkLabel endif
+ return $ mkCbranch e tid endif MkGraph.<*> mkLabel endif
mkCmmIfThen :: CmmExpr -> CmmAGraph -> FCode CmmAGraph
mkCmmIfThen e tbranch = do
endif <- newLabelC
tid <- newLabelC
- return $ mkCbranch e tid endif <*>
- mkLabel tid <*> tbranch <*> mkLabel endif
+ return $ mkCbranch e tid endif MkGraph.<*>
+ mkLabel tid MkGraph.<*> tbranch MkGraph.<*> mkLabel endif
mkCall :: CmmExpr -> (Convention, Convention) -> [CmmFormal] -> [CmmActual]
@@ -803,7 +803,7 @@ mkCall f (callConv, retConv) results actuals updfr_off extra_stack = do
let area = Young k
(off, _, copyin) = copyInOflow dflags retConv area results []
copyout = mkCallReturnsTo dflags f callConv actuals k off updfr_off extra_stack
- return (copyout <*> mkLabel k <*> copyin)
+ return (copyout MkGraph.<*> mkLabel k MkGraph.<*> copyin)
mkCmmCall :: CmmExpr -> [CmmFormal] -> [CmmActual] -> UpdFrameOffset
-> FCode CmmAGraph
diff --git a/compiler/codeGen/StgCmmPrim.hs b/compiler/codeGen/StgCmmPrim.hs
index e6f4e48425..a86caf1a9d 100644
--- a/compiler/codeGen/StgCmmPrim.hs
+++ b/compiler/codeGen/StgCmmPrim.hs
@@ -43,6 +43,10 @@ import FastString
import Outputable
import Util
+#if __GLASGOW_HASKELL__ >= 709
+import Prelude hiding ((<*>))
+#endif
+
import Data.Bits ((.&.), bit)
import Control.Monad (liftM, when)
diff --git a/compiler/codeGen/StgCmmUtils.hs b/compiler/codeGen/StgCmmUtils.hs
index 985c6db900..d47a01661a 100644
--- a/compiler/codeGen/StgCmmUtils.hs
+++ b/compiler/codeGen/StgCmmUtils.hs
@@ -709,7 +709,7 @@ label_code :: BlockId -> CmmAGraph -> FCode BlockId
-- and returns L
label_code join_lbl code = do
lbl <- newLabelC
- emitOutOfLine lbl (code <*> mkBranch join_lbl)
+ emitOutOfLine lbl (code MkGraph.<*> mkBranch join_lbl)
return lbl
--------------