Ticket #4834: ghc_new_monad_hierarchy.dpatch

File ghc_new_monad_hierarchy.dpatch, 110.0 KB (added by basvandijk, 3 years ago)

Prepare GHC for the new monad hierarchy

Line 
15 patches for repository http://darcs.haskell.org/ghc:
2
3Wed Dec  8 15:40:50 CET 2010  Bas van Dijk <v.dijk.bas@gmail.com>
4  * Added (<>) = mappend to compiler/utils/Util.hs
5  This is going to be used for joining SDocs and for splicing AGraphs.
6
7Wed Dec  8 15:54:57 CET 2010  Bas van Dijk <v.dijk.bas@gmail.com>
8  * Make SDoc an abstract newtype and add a Monoid instance for it
9  The (<>) combinator of SDocs is removed and replaced by the
10  more general (<>) = mappend combinator from Util.
11
12Wed Dec  8 16:39:06 CET 2010  Bas van Dijk <v.dijk.bas@gmail.com>
13  * Add a Monoid instance for AGraph and remove the <*> splice operator
14  Instead of <*>, the (<>) = mappend operator is now used to splice AGraphs.
15  This change is needed because <*> clashes with the Applicative apply operator <*>,
16  which is probably going to be exported from the Prelude
17  when the new Monad hierarchy is going through.
18
19Wed Dec  8 20:13:19 CET 2010  Bas van Dijk <v.dijk.bas@gmail.com>
20  * Add Functor and Applicative instances for all monads in ghc
21
22Sun Dec 12 00:50:20 CET 2010  Bas van Dijk <v.dijk.bas@gmail.com>
23  * Require happy >= 1.18.7
24  happy-1.18.7 generates needed Functor and Applicative instances for HappyIdentity
25
26New patches:
27
28[Added (<>) = mappend to compiler/utils/Util.hs
29Bas van Dijk <v.dijk.bas@gmail.com>**20101208144050
30 Ignore-this: 47df9db594b5a32f7387ad381461a111
31 This is going to be used for joining SDocs and for splicing AGraphs.
32] {
33hunk ./compiler/utils/Util.lhs 9
34 \begin{code}
35 -- | Highly random utility functions
36 module Util (
37+        (<>),
38+
39         -- * Flags dependent on the compiler build
40         ghciSupported, debugIsOn, ghciTablesNextToCode, isDynamicGhcLib,
41         isWindowsHost, isWindowsTarget, isDarwinTarget,
42hunk ./compiler/utils/Util.lhs 115
43 import Data.Ord         ( comparing )
44 import Data.Bits
45 import Data.Word
46+import Data.Monoid      ( Monoid(mappend) )
47 import qualified Data.IntMap as IM
48 
49 infixr 9 `thenCmp`
50hunk ./compiler/utils/Util.lhs 119
51+
52+infixr 3 <>
53+
54+(<>) :: Monoid m => m -> m -> m
55+(<>) = mappend
56+
57 \end{code}
58 
59 %************************************************************************
60}
61[Make SDoc an abstract newtype and add a Monoid instance for it
62Bas van Dijk <v.dijk.bas@gmail.com>**20101208145457
63 Ignore-this: 200f03a71406cb6a0c4679ee987bf1b
64 The (<>) combinator of SDocs is removed and replaced by the
65 more general (<>) = mappend combinator from Util.
66] {
67hunk ./compiler/basicTypes/Module.lhs 261
68 pprModule :: Module -> SDoc
69 pprModule mod@(Module p n)  = pprPackagePrefix p mod <> pprModuleName n
70 
71-pprPackagePrefix :: PackageId -> Module -> PprStyle -> Pretty.Doc
72+pprPackagePrefix :: PackageId -> Module -> SDoc
73 pprPackagePrefix p mod = getPprStyle doc
74  where
75    doc sty
76hunk ./compiler/main/DynFlags.hs 755
77 
78         log_action = \severity srcSpan style msg ->
79                         case severity of
80-                          SevOutput -> printOutput (msg style)
81-                          SevInfo   -> printErrs (msg style)
82-                          SevFatal  -> printErrs (msg style)
83+                          SevOutput -> printOutput (runSDoc msg style)
84+                          SevInfo   -> printErrs (runSDoc msg style)
85+                          SevFatal  -> printErrs (runSDoc msg style)
86                           _         -> do
87                                 hPutChar stderr '\n'
88hunk ./compiler/main/DynFlags.hs 760
89-                                printErrs ((mkLocMessage srcSpan msg) style)
90+                                printErrs (runSDoc (mkLocMessage srcSpan msg) style)
91                      -- careful (#2302): printErrs prints in UTF-8, whereas
92                      -- converting to string first and using hPutStr would
93                      -- just emit the low 8 bits of each unicode char.
94hunk ./compiler/main/ErrUtils.lhs 70
95   -- would look strange.  Better to say explicitly "<no location info>".
96 
97 printError :: SrcSpan -> Message -> IO ()
98-printError span msg = printErrs (mkLocMessage span msg $ defaultErrStyle)
99+printError span msg = printErrs $ runSDoc (mkLocMessage span msg) defaultErrStyle
100 
101 
102 -- -----------------------------------------------------------------------------
103hunk ./compiler/nativeGen/AsmCodeGen.lhs 485
104                | otherwise
105                = Pretty.empty
106 
107-       doPpr lbl = (lbl, Pretty.render $ pprCLabel lbl astyle)
108+       doPpr lbl = (lbl, Pretty.render $ runSDoc (pprCLabel lbl) astyle)
109        astyle = mkCodeStyle AsmStyle
110 
111 
112hunk ./compiler/typecheck/TcRnMonad.lhs 1127
113 failIfM msg
114   = do         { env <- getLclEnv
115        ; let full_msg = (if_loc env <> colon) $$ nest 2 msg
116-       ; liftIO (printErrs (full_msg defaultErrStyle))
117+       ; liftIO (printErrs (runSDoc full_msg defaultErrStyle))
118        ; failM }
119 
120 --------------------
121hunk ./compiler/typecheck/TcRnMonad.lhs 1162
122                    ; return Nothing }
123        }}
124   where
125-    print_errs sdoc = liftIO (printErrs (sdoc defaultErrStyle))
126+    print_errs sdoc = liftIO (printErrs (runSDoc sdoc defaultErrStyle))
127 
128 forkM :: SDoc -> IfL a -> IfL a
129 forkM doc thing_inside
130hunk ./compiler/utils/Outputable.lhs 19
131 
132         -- * Pretty printing combinators
133        SDoc,
134+        runSDoc,
135        docToSDoc,
136        interppSP, interpp'SP, pprQuotedList, pprWithCommas, quotedListWithOr,
137        empty, nest,
138hunk ./compiler/utils/Outputable.lhs 77
139 import qualified Pretty
140 import Pretty          ( Doc, Mode(..) )
141 import Panic
142+import Util             ( (<>) )
143 
144 import Data.Char
145 import qualified Data.Map as M
146hunk ./compiler/utils/Outputable.lhs 83
147 import qualified Data.IntMap as IM
148 import Data.Word
149+import Data.Monoid      ( Monoid(..) )
150 import System.IO       ( Handle, stderr, stdout, hFlush )
151 import System.FilePath
152 
153hunk ./compiler/utils/Outputable.lhs 224
154 %************************************************************************
155 
156 \begin{code}
157-type SDoc = PprStyle -> Doc
158+newtype SDoc = SDoc {runSDoc :: PprStyle -> Doc}
159+
160+instance Monoid SDoc where
161+    mempty = empty
162+    d1 `mappend` d2 = SDoc $ \sty -> (Pretty.<>) (runSDoc d1 sty) (runSDoc d2 sty)
163+    -- ^ Join two 'SDoc' together horizontally without a gap
164 
165 withPprStyle :: PprStyle -> SDoc -> SDoc
166hunk ./compiler/utils/Outputable.lhs 232
167-withPprStyle sty d _sty' = d sty
168+withPprStyle sty d = SDoc $ \_ -> runSDoc d sty
169 
170 withPprStyleDoc :: PprStyle -> SDoc -> Doc
171hunk ./compiler/utils/Outputable.lhs 235
172-withPprStyleDoc sty d = d sty
173+withPprStyleDoc sty d = runSDoc d sty
174 
175 pprDeeper :: SDoc -> SDoc
176hunk ./compiler/utils/Outputable.lhs 238
177-pprDeeper _ (PprUser _ (PartWay 0)) = Pretty.text "..."
178-pprDeeper d (PprUser q (PartWay n)) = d (PprUser q (PartWay (n-1)))
179-pprDeeper d other_sty              = d other_sty
180+pprDeeper d = SDoc $ \sty -> case sty of
181+  (PprUser _ (PartWay 0)) -> Pretty.text "..."
182+  (PprUser q (PartWay n)) -> runSDoc d (PprUser q (PartWay (n-1)))
183+  other_sty               -> runSDoc d other_sty
184 
185 pprDeeperList :: ([SDoc] -> SDoc) -> [SDoc] -> SDoc
186 -- Truncate a list that list that is longer than the current depth
187hunk ./compiler/utils/Outputable.lhs 245
188-pprDeeperList f ds (PprUser q (PartWay n))
189-  | n==0      = Pretty.text "..."
190-  | otherwise = f (go 0 ds) (PprUser q (PartWay (n-1)))
191-  where
192-    go _ [] = []
193-    go i (d:ds) | i >= n    = [text "...."]
194-               | otherwise = d : go (i+1) ds
195+pprDeeperList f ds = SDoc work
196+    where
197+      work (PprUser q (PartWay n))
198+        | n==0      = Pretty.text "..."
199+        | otherwise = runSDoc (f (go 0 ds)) (PprUser q (PartWay (n-1)))
200+        where
201+          go _ [] = []
202+          go i (d:ds) | i >= n    = [text "...."]
203+                     | otherwise = d : go (i+1) ds
204 
205hunk ./compiler/utils/Outputable.lhs 255
206-pprDeeperList f ds other_sty
207-  = f ds other_sty
208+      work other_sty
209+        = runSDoc (f ds) other_sty
210 
211 pprSetDepth :: Depth -> SDoc -> SDoc
212hunk ./compiler/utils/Outputable.lhs 259
213-pprSetDepth depth  doc (PprUser q _) = doc (PprUser q depth)
214-pprSetDepth _depth doc other_sty     = doc other_sty
215+pprSetDepth depth doc = SDoc $ \sty -> case sty of
216+  PprUser q _ -> runSDoc doc (PprUser q depth)
217+  other_sty   -> runSDoc doc other_sty
218 
219 getPprStyle :: (PprStyle -> SDoc) -> SDoc
220hunk ./compiler/utils/Outputable.lhs 264
221-getPprStyle df sty = df sty sty
222+getPprStyle df = SDoc $ \sty -> runSDoc (df sty) sty
223 \end{code}
224 
225 \begin{code}
226hunk ./compiler/utils/Outputable.lhs 297
227 userStyle _other        = False
228 
229 ifPprDebug :: SDoc -> SDoc       -- Empty for non-debug style
230-ifPprDebug d sty@PprDebug = d sty
231-ifPprDebug _ _           = Pretty.empty
232+ifPprDebug d = SDoc $ \sty -> case sty of
233+                                PprDebug -> runSDoc d sty
234+                                _        -> Pretty.empty
235 \end{code}
236 
237 \begin{code}
238hunk ./compiler/utils/Outputable.lhs 306
239 -- Unused [7/02 sof]
240 printSDoc :: SDoc -> PprStyle -> IO ()
241 printSDoc d sty = do
242-  Pretty.printDoc PageMode stdout (d sty)
243+  Pretty.printDoc PageMode stdout (runSDoc d sty)
244   hFlush stdout
245 
246 -- I'm not sure whether the direct-IO approach of Pretty.printDoc
247hunk ./compiler/utils/Outputable.lhs 323
248 
249 hPrintDump :: Handle -> SDoc -> IO ()
250 hPrintDump h doc = do
251-   Pretty.printDoc PageMode h (better_doc defaultDumpStyle)
252+   Pretty.printDoc PageMode h (runSDoc better_doc defaultDumpStyle)
253    hFlush h
254  where
255    better_doc = doc $$ blankLine
256hunk ./compiler/utils/Outputable.lhs 329
257 
258 printForUser :: Handle -> PrintUnqualified -> SDoc -> IO ()
259-printForUser handle unqual doc
260-  = Pretty.printDoc PageMode handle (doc (mkUserStyle unqual AllTheWay))
261+printForUser handle unqual doc
262+  = Pretty.printDoc PageMode handle (runSDoc doc (mkUserStyle unqual AllTheWay))
263 
264 printForUserPartWay :: Handle -> Int -> PrintUnqualified -> SDoc -> IO ()
265 printForUserPartWay handle d unqual doc
266hunk ./compiler/utils/Outputable.lhs 334
267-  = Pretty.printDoc PageMode handle (doc (mkUserStyle unqual (PartWay d)))
268+  = Pretty.printDoc PageMode handle (runSDoc doc (mkUserStyle unqual (PartWay d)))
269 
270 -- printForC, printForAsm do what they sound like
271 printForC :: Handle -> SDoc -> IO ()
272hunk ./compiler/utils/Outputable.lhs 338
273-printForC handle doc = Pretty.printDoc LeftMode handle (doc (PprCode CStyle))
274+printForC handle doc = Pretty.printDoc LeftMode handle (runSDoc doc (PprCode CStyle))
275 
276 printForAsm :: Handle -> SDoc -> IO ()
277hunk ./compiler/utils/Outputable.lhs 341
278-printForAsm handle doc = Pretty.printDoc LeftMode handle (doc (PprCode AsmStyle))
279+printForAsm handle doc = Pretty.printDoc LeftMode handle (runSDoc doc (PprCode AsmStyle))
280 
281 pprCode :: CodeStyle -> SDoc -> SDoc
282 pprCode cs d = withPprStyle (PprCode cs) d
283hunk ./compiler/utils/Outputable.lhs 353
284 -- However, Doc *is* an instance of Show
285 -- showSDoc just blasts it out as a string
286 showSDoc :: SDoc -> String
287-showSDoc d = Pretty.showDocWith PageMode (d defaultUserStyle)
288+showSDoc d = Pretty.showDocWith PageMode (runSDoc d defaultUserStyle)
289 
290 -- This shows an SDoc, but on one line only. It's cheaper than a full
291 -- showSDoc, designed for when we're getting results like "Foo.bar"
292hunk ./compiler/utils/Outputable.lhs 359
293 -- and "foo{uniq strictness}" so we don't want fancy layout anyway.
294 showSDocOneLine :: SDoc -> String
295-showSDocOneLine d = Pretty.showDocWith PageMode (d defaultUserStyle)
296+showSDocOneLine d = Pretty.showDocWith PageMode (runSDoc d defaultUserStyle)
297 
298 showSDocForUser :: PrintUnqualified -> SDoc -> String
299hunk ./compiler/utils/Outputable.lhs 362
300-showSDocForUser unqual doc = show (doc (mkUserStyle unqual AllTheWay))
301+showSDocForUser unqual doc = show (runSDoc doc (mkUserStyle unqual AllTheWay))
302 
303 showSDocUnqual :: SDoc -> String
304 -- Only used in the gruesome isOperator
305hunk ./compiler/utils/Outputable.lhs 366
306-showSDocUnqual d = show (d (mkUserStyle neverQualify AllTheWay))
307+showSDocUnqual d = show (runSDoc d (mkUserStyle neverQualify AllTheWay))
308 
309 showsPrecSDoc :: Int -> SDoc -> ShowS
310hunk ./compiler/utils/Outputable.lhs 369
311-showsPrecSDoc p d = showsPrec p (d defaultUserStyle)
312+showsPrecSDoc p d = showsPrec p (runSDoc d defaultUserStyle)
313 
314 showSDocDump :: SDoc -> String
315hunk ./compiler/utils/Outputable.lhs 372
316-showSDocDump d = Pretty.showDocWith PageMode (d PprDump)
317+showSDocDump d = Pretty.showDocWith PageMode (runSDoc d PprDump)
318 
319 showSDocDumpOneLine :: SDoc -> String
320hunk ./compiler/utils/Outputable.lhs 375
321-showSDocDumpOneLine d = Pretty.showDocWith OneLineMode (d PprDump)
322+showSDocDumpOneLine d = Pretty.showDocWith OneLineMode (runSDoc d PprDump)
323 
324 showSDocDebug :: SDoc -> String
325hunk ./compiler/utils/Outputable.lhs 378
326-showSDocDebug d = show (d PprDebug)
327+showSDocDebug d = show (runSDoc d PprDebug)
328 
329 showPpr :: Outputable a => a -> String
330 showPpr = showSDoc . ppr
331hunk ./compiler/utils/Outputable.lhs 386
332 
333 \begin{code}
334 docToSDoc :: Doc -> SDoc
335-docToSDoc d = \_ -> d
336+docToSDoc d = SDoc $ \_ -> d
337 
338 empty    :: SDoc
339 char     :: Char       -> SDoc
340hunk ./compiler/utils/Outputable.lhs 399
341 double   :: Double     -> SDoc
342 rational :: Rational   -> SDoc
343 
344-empty _sty      = Pretty.empty
345-char c _sty     = Pretty.char c
346-text s _sty     = Pretty.text s
347-ftext s _sty    = Pretty.ftext s
348-ptext s _sty    = Pretty.ptext s
349-int n _sty      = Pretty.int n
350-integer n _sty  = Pretty.integer n
351-float n _sty    = Pretty.float n
352-double n _sty   = Pretty.double n
353-rational n _sty = Pretty.rational n
354+empty    = docToSDoc $ Pretty.empty
355+char     = docToSDoc . Pretty.char
356+text     = docToSDoc . Pretty.text
357+ftext    = docToSDoc . Pretty.ftext
358+ptext    = docToSDoc . Pretty.ptext
359+int      = docToSDoc . Pretty.int
360+integer  = docToSDoc . Pretty.integer
361+float    = docToSDoc . Pretty.float
362+double   = docToSDoc . Pretty.double
363+rational = docToSDoc . Pretty.rational
364 
365 parens, braces, brackets, quotes, doubleQuotes, angleBrackets :: SDoc -> SDoc
366 
367hunk ./compiler/utils/Outputable.lhs 412
368-parens d sty       = Pretty.parens (d sty)
369-braces d sty       = Pretty.braces (d sty)
370-brackets d sty     = Pretty.brackets (d sty)
371-doubleQuotes d sty = Pretty.doubleQuotes (d sty)
372-angleBrackets d    = char '<' <> d <> char '>'
373+parens        d = SDoc $ Pretty.parens       . runSDoc d
374+braces        d = SDoc $ Pretty.braces       . runSDoc d
375+brackets      d = SDoc $ Pretty.brackets     . runSDoc d
376+doubleQuotes  d = SDoc $ Pretty.doubleQuotes . runSDoc d
377+angleBrackets d = char '<' <> d <> char '>'
378 
379 cparen :: Bool -> SDoc -> SDoc
380hunk ./compiler/utils/Outputable.lhs 419
381-
382-cparen b d sty       = Pretty.cparen b (d sty)
383+cparen b d = SDoc $ Pretty.cparen b . runSDoc d
384 
385 -- quotes encloses something in single quotes...
386 -- but it omits them if the thing ends in a single quote
387hunk ./compiler/utils/Outputable.lhs 424
388 -- so that we don't get `foo''.  Instead we just have foo'.
389-quotes d sty = case show pp_d of
390+quotes d = SDoc $ \sty ->
391+           let pp_d = runSDoc d sty
392+           in case show pp_d of
393                 ('\'' : _) -> pp_d
394                 _other     -> Pretty.quotes pp_d
395hunk ./compiler/utils/Outputable.lhs 429
396-            where
397-              pp_d = d sty
398 
399 semi, comma, colon, equals, space, dcolon, arrow, underscore, dot :: SDoc
400 darrow, lparen, rparen, lbrack, rbrack, lbrace, rbrace, blankLine :: SDoc
401hunk ./compiler/utils/Outputable.lhs 433
402 
403-blankLine _sty = Pretty.ptext (sLit "")
404-dcolon _sty    = Pretty.ptext (sLit "::")
405-arrow  _sty    = Pretty.ptext (sLit "->")
406-darrow _sty    = Pretty.ptext (sLit "=>")
407-semi _sty      = Pretty.semi
408-comma _sty     = Pretty.comma
409-colon _sty     = Pretty.colon
410-equals _sty    = Pretty.equals
411-space _sty     = Pretty.space
412-underscore     = char '_'
413-dot           = char '.'
414-lparen _sty    = Pretty.lparen
415-rparen _sty    = Pretty.rparen
416-lbrack _sty    = Pretty.lbrack
417-rbrack _sty    = Pretty.rbrack
418-lbrace _sty    = Pretty.lbrace
419-rbrace _sty    = Pretty.rbrace
420+blankLine  = docToSDoc $ Pretty.ptext (sLit "")
421+dcolon     = docToSDoc $ Pretty.ptext (sLit "::")
422+arrow      = docToSDoc $ Pretty.ptext (sLit "->")
423+darrow     = docToSDoc $ Pretty.ptext (sLit "=>")
424+semi       = docToSDoc $ Pretty.semi
425+comma      = docToSDoc $ Pretty.comma
426+colon      = docToSDoc $ Pretty.colon
427+equals     = docToSDoc $ Pretty.equals
428+space      = docToSDoc $ Pretty.space
429+underscore = char '_'
430+dot       = char '.'
431+lparen     = docToSDoc $ Pretty.lparen
432+rparen     = docToSDoc $ Pretty.rparen
433+lbrack     = docToSDoc $ Pretty.lbrack
434+rbrack     = docToSDoc $ Pretty.rbrack
435+lbrace     = docToSDoc $ Pretty.lbrace
436+rbrace     = docToSDoc $ Pretty.rbrace
437 
438 nest :: Int -> SDoc -> SDoc
439 -- ^ Indent 'SDoc' some specified amount
440hunk ./compiler/utils/Outputable.lhs 453
441-(<>) :: SDoc -> SDoc -> SDoc
442--- ^ Join two 'SDoc' together horizontally without a gap
443 (<+>) :: SDoc -> SDoc -> SDoc
444 -- ^ Join two 'SDoc' together horizontally with a gap between them
445 ($$) :: SDoc -> SDoc -> SDoc
446hunk ./compiler/utils/Outputable.lhs 461
447 ($+$) :: SDoc -> SDoc -> SDoc
448 -- ^ Join two 'SDoc' together vertically
449 
450-nest n d sty    = Pretty.nest n (d sty)
451-(<>) d1 d2 sty  = (Pretty.<>)  (d1 sty) (d2 sty)
452-(<+>) d1 d2 sty = (Pretty.<+>) (d1 sty) (d2 sty)
453-($$) d1 d2 sty  = (Pretty.$$)  (d1 sty) (d2 sty)
454-($+$) d1 d2 sty = (Pretty.$+$) (d1 sty) (d2 sty)
455+nest n d    = SDoc $ \sty -> Pretty.nest n (runSDoc d sty)
456+(<+>) d1 d2 = SDoc $ \sty -> (Pretty.<+>)  (runSDoc d1 sty) (runSDoc d2 sty)
457+($$)  d1 d2 = SDoc $ \sty -> (Pretty.$$)   (runSDoc d1 sty) (runSDoc d2 sty)
458+($+$) d1 d2 = SDoc $ \sty -> (Pretty.$+$)  (runSDoc d1 sty) (runSDoc d2 sty)
459 
460 hcat :: [SDoc] -> SDoc
461 -- ^ Concatenate 'SDoc' horizontally
462hunk ./compiler/utils/Outputable.lhs 482
463 fcat :: [SDoc] -> SDoc
464 -- ^ This behaves like 'fsep', but it uses '<>' for horizontal conposition rather than '<+>'
465 
466-
467-hcat ds sty = Pretty.hcat [d sty | d <- ds]
468-hsep ds sty = Pretty.hsep [d sty | d <- ds]
469-vcat ds sty = Pretty.vcat [d sty | d <- ds]
470-sep ds sty  = Pretty.sep  [d sty | d <- ds]
471-cat ds sty  = Pretty.cat  [d sty | d <- ds]
472-fsep ds sty = Pretty.fsep [d sty | d <- ds]
473-fcat ds sty = Pretty.fcat [d sty | d <- ds]
474+hcat ds = SDoc $ \sty -> Pretty.hcat [runSDoc d sty | d <- ds]
475+hsep ds = SDoc $ \sty -> Pretty.hsep [runSDoc d sty | d <- ds]
476+vcat ds = SDoc $ \sty -> Pretty.vcat [runSDoc d sty | d <- ds]
477+sep  ds = SDoc $ \sty -> Pretty.sep  [runSDoc d sty | d <- ds]
478+cat  ds = SDoc $ \sty -> Pretty.cat  [runSDoc d sty | d <- ds]
479+fsep ds = SDoc $ \sty -> Pretty.fsep [runSDoc d sty | d <- ds]
480+fcat ds = SDoc $ \sty -> Pretty.fcat [runSDoc d sty | d <- ds]
481 
482 hang :: SDoc  -- ^ The header
483       -> Int  -- ^ Amount to indent the hung body
484hunk ./compiler/utils/Outputable.lhs 494
485       -> SDoc -- ^ The hung body, indented and placed below the header
486       -> SDoc
487-hang d1 n d2 sty   = Pretty.hang (d1 sty) n (d2 sty)
488+hang d1 n d2 = SDoc $ \sty -> Pretty.hang (runSDoc d1 sty) n (runSDoc d2 sty)
489 
490 punctuate :: SDoc   -- ^ The punctuation
491           -> [SDoc] -- ^ The list that will have punctuation added between every adjacent pair of elements
492hunk ./compiler/utils/Outputable.lhs 814
493 
494 pprPanicFastInt :: String -> SDoc -> FastInt
495 -- ^ Specialization of pprPanic that can be safely used with 'FastInt'
496-pprPanicFastInt heading pretty_msg = panicFastInt (show (doc PprDebug))
497+pprPanicFastInt heading pretty_msg = panicFastInt (show (runSDoc doc PprDebug))
498                             where
499                               doc = text heading <+> pretty_msg
500 
501hunk ./compiler/utils/Outputable.lhs 820
502 
503 pprAndThen :: (String -> a) -> String -> SDoc -> a
504-pprAndThen cont heading pretty_msg = cont (show (doc PprDebug))
505+pprAndThen cont heading pretty_msg = cont (show (runSDoc doc PprDebug))
506     where
507      doc = sep [text heading, nest 4 pretty_msg]
508 
509hunk ./compiler/utils/Outputable.lhs 828
510 -- ^ Panic with an assertation failure, recording the given file and line number.
511 -- Should typically be accessed with the ASSERT family of macros
512 assertPprPanic file line msg
513-  = panic (show (doc PprDebug))
514+  = panic (show (runSDoc doc PprDebug))
515   where
516     doc = sep [hsep[text "ASSERT failed! file",
517                           text file,
518hunk ./compiler/utils/Outputable.lhs 841
519 warnPprTrace _     _file _line _msg x | opt_NoDebugOutput = x
520 warnPprTrace False _file _line _msg x = x
521 warnPprTrace True   file  line  msg x
522-  = trace (show (doc defaultDumpStyle)) x
523+  = trace (show (runSDoc doc defaultDumpStyle)) x
524   where
525     doc = sep [hsep [text "WARNING: file", text file, text "line", int line],
526               msg]
527}
528[Add a Monoid instance for AGraph and remove the <*> splice operator
529Bas van Dijk <v.dijk.bas@gmail.com>**20101208153906
530 Ignore-this: fe944f0b230eafde5bdf6e3f38da4450
531 Instead of <*>, the (<>) = mappend operator is now used to splice AGraphs.
532 This change is needed because <*> clashes with the Applicative apply operator <*>,
533 which is probably going to be exported from the Prelude
534 when the new Monad hierarchy is going through.
535] {
536hunk ./compiler/cmm/CmmBuildInfoTables.hs 581
537     load_tso <- newTemp gcWord -- TODO FIXME NOW
538     let suspendThread = CmmLit (CmmLabel (mkCmmCodeLabel rtsPackageId (fsLit "suspendThread")))
539         resumeThread  = CmmLit (CmmLabel (mkCmmCodeLabel rtsPackageId (fsLit "resumeThread")))
540-        suspend = mkStore (CmmReg spReg) (CmmLit (CmmBlock infotable)) <*>
541-                  saveThreadState <*>
542-                  caller_save <*>
543+        suspend = mkStore (CmmReg spReg) (CmmLit (CmmBlock infotable)) <>
544+                  saveThreadState <>
545+                  caller_save <>
546                   mkUnsafeCall (ForeignTarget suspendThread
547                                   (ForeignConvention CCallConv [AddrHint, NoHint] [AddrHint]))
548                     -- XXX Not sure if the size of the CmmInt is correct
549hunk ./compiler/cmm/CmmBuildInfoTables.hs 590
550                     [id] [CmmReg (CmmGlobal BaseReg), CmmLit (CmmInt (fromIntegral (fromEnum interruptible)) wordWidth)]
551         resume = mkUnsafeCall (ForeignTarget resumeThread
552                                   (ForeignConvention CCallConv [AddrHint] [AddrHint]))
553-                    [new_base] [CmmReg (CmmLocal id)] <*>
554+                    [new_base] [CmmReg (CmmLocal id)] <>
555                  -- Assign the result to BaseReg: we
556                  -- might now have a different Capability!
557hunk ./compiler/cmm/CmmBuildInfoTables.hs 593
558-                 mkAssign (CmmGlobal BaseReg) (CmmReg (CmmLocal new_base)) <*>
559-                 caller_load <*>
560+                 mkAssign (CmmGlobal BaseReg) (CmmReg (CmmLocal new_base)) <>
561+                 caller_load <>
562                  loadThreadState load_tso
563     Graph tail' blocks' <-
564hunk ./compiler/cmm/CmmBuildInfoTables.hs 597
565-      liftUniq (graphOfAGraph (suspend <*> mkMiddle m <*> resume <*> mkZTail tail))
566+      liftUniq (graphOfAGraph (suspend <> mkMiddle m <> resume <> mkZTail tail))
567     return (state {s_blocks = s_blocks state `plusBlockEnv` blocks'}, tail')
568 lowerSafeForeignCall _ _ _ = panic "lowerSafeForeignCall was passed something else"
569hunk ./compiler/cmm/CmmCvt.hs 36
570 toZgraph fun_name args g@(ListGraph (BasicBlock id ss : other_blocks)) =
571            let (offset, entry) = mkEntry id NativeNodeCall args in
572            do g <- labelAGraph id $
573-                     entry <*> mkStmts ss <*> foldr addBlock emptyAGraph other_blocks
574+                     entry <> mkStmts ss <> foldr addBlock emptyAGraph other_blocks
575               return ((offset, Nothing), g)
576   where addBlock (BasicBlock id ss) g =
577hunk ./compiler/cmm/CmmCvt.hs 39
578-          mkLabel id <*> mkStmts ss <*> g
579+          mkLabel id <> mkStmts ss <> g
580         updfr_sz = 0 -- panic "upd frame size lost in cmm conversion"
581hunk ./compiler/cmm/CmmCvt.hs 41
582-        mkStmts (CmmNop        : ss)  = mkNop        <*> mkStmts ss
583-        mkStmts (CmmComment s  : ss)  = mkComment s  <*> mkStmts ss
584-        mkStmts (CmmAssign l r : ss)  = mkAssign l r <*> mkStmts ss
585-        mkStmts (CmmStore  l r : ss)  = mkStore  l r <*> mkStmts ss
586+        mkStmts (CmmNop        : ss)  = mkNop        <> mkStmts ss
587+        mkStmts (CmmComment s  : ss)  = mkComment s  <> mkStmts ss
588+        mkStmts (CmmAssign l r : ss)  = mkAssign l r <> mkStmts ss
589+        mkStmts (CmmStore  l r : ss)  = mkStore  l r <> mkStmts ss
590         mkStmts (CmmCall (CmmCallee f conv) res args (CmmSafe _) CmmMayReturn : ss) =
591             mkCall f (conv', conv') (map hintlessCmm res) (map hintlessCmm args) updfr_sz
592hunk ./compiler/cmm/CmmCvt.hs 47
593-            <*> mkStmts ss
594+            <> mkStmts ss
595               where conv' = Foreign (ForeignConvention conv [] []) -- JD: DUBIOUS
596         mkStmts (CmmCall (CmmPrim {}) _ _ (CmmSafe _) _ : _) =
597             panic "safe call to a primitive CmmPrim CallishMachOp"
598hunk ./compiler/cmm/CmmCvt.hs 54
599         mkStmts (CmmCall f res args CmmUnsafe CmmMayReturn : ss) =
600                       mkUnsafeCall (convert_target f res args)
601                        (strip_hints res) (strip_hints args)
602-                      <*> mkStmts ss
603+                      <> mkStmts ss
604         mkStmts (CmmCondBranch e l : fbranch) =
605             mkCmmIfThenElse e (mkBranch l) (mkStmts fbranch)
606         mkStmts (last : []) = mkLast last
607hunk ./compiler/cmm/CmmProcPointZ.hs 333
608            = case lookupBlockEnv protos id of
609                Just (Protocol c fs _area) ->
610                  do LGraph _ blocks <-
611-                      lgraphOfAGraph (mkLabel id <*> copyInSlot c fs <*> mkZTail t)
612+                      lgraphOfAGraph (mkLabel id <> copyInSlot c fs <> mkZTail t)
613                     return (map snd $ blockEnvToList blocks)
614                Nothing -> return [b]
615            | otherwise = return [b]
616hunk ./compiler/cmm/CmmSpillReload.hs 271
617             in  if isEmptyUniqSet used then Nothing
618                 else Just $ reloadTail used tail
619         reloadTail regset t = foldl rel t $ uniqSetToList regset
620-          where rel t r = mkMiddle (reload r) <*> t
621+          where rel t r = mkMiddle (reload r) <> t
622 
623 
624 insertLateReloads :: (LGraph Middle Last) -> FuelMonad (LGraph Middle Last)
625hunk ./compiler/cmm/CmmStackLayout.hs 489
626             if elemSlot liveSlots subarea then rst
627             else let store = mkStore (CmmStackSlot a off)
628                                      (stackStubExpr (widthFromBytes w))
629-                 in case rst of Nothing -> Just (mkMiddle m <*> store)
630-                                Just g  -> Just (g <*> store)
631+                 in case rst of Nothing -> Just (mkMiddle m <> store)
632+                                Just g  -> Just (g <> store)
633hunk ./compiler/cmm/MkZipCfg.hs 3
634 {-# LANGUAGE ScopedTypeVariables #-}
635 module MkZipCfg
636-    ( AGraph, (<*>), catAGraphs
637+    ( AGraph, (<>), catAGraphs
638     , freshBlockId
639     , emptyAGraph, withFreshLabel, withUnique
640     , mkMiddle, mkMiddles, mkLast, mkZTail, mkBranch, mkLabel, mkIfThenElse, mkWhileDo
641hunk ./compiler/cmm/MkZipCfg.hs 22
642 import Util
643 
644 import Prelude hiding (zip, unzip, last)
645+import Data.Monoid    (Monoid(..))
646 
647 #include "HsVersions.h"
648 
649hunk ./compiler/cmm/MkZipCfg.hs 39
650   * Last nodes (e.g. if b then goto L1 else goto L2)
651 
652 The constructors mkLabel, mkMiddle, and mkLast build single-node
653-AGraphs of the indicated type.  The composition operator <*> glues
654+AGraphs of the indicated type.  The composition operator <> glues
655 AGraphs together in sequence (in constant time).
656 
657 For example:
658hunk ./compiler/cmm/MkZipCfg.hs 57
659 
660 A 'AGraph m l' is simply an abstract version of a 'Graph m l' from
661 module 'ZipCfg'.  The only difference is that the 'AGraph m l'
662-supports a constant-time splicing operation, written infix <*>.
663+supports a constant-time splicing operation, written infix <>.
664 That splicing operation, together with the constructor functions in
665 this module (and with 'labelAGraph'), is the recommended way to build
666 large graphs.  Each construction or splice has constant cost, and to
667hunk ./compiler/cmm/MkZipCfg.hs 96
668   * A AGraph may be turned into a LGraph in time linear in the number
669     of nodes and O(N log N) in the number of basic blocks.
670 
671-  * Two AGraphs may be spliced in constant time by writing  g1 <*> g2
672+  * Two AGraphs may be spliced in constant time by writing  g1 <> g2
673 
674 There are two rules for splicing, depending on whether the left-hand
675 graph falls through.  If it does, the rule is as follows:
676hunk ./compiler/cmm/MkZipCfg.hs 106
677         |                      |                          |     
678        / \                    / \                        / \
679       /   \                  /   \                      /   \
680-     |  X  |      <*>       |  Y  |           =        |  X  |   
681+     |  X  |      <>        |  Y  |           =        |  X  |   
682       \   /                  \   /                      \   /   
683        \ /                    \_/                        \ /     
684         |                      |                          |         
685hunk ./compiler/cmm/MkZipCfg.hs 133
686         |                      |                          |     
687        / \                    / \                        / \
688       /   \                  /   \                      /   \
689-     |  X  |      <*>       |  Y  |           =        |  X  |   
690+     |  X  |      <>        |  Y  |           =        |  X  |   
691       \   /                  \   /                      \   /   
692        \_/                    \_/                        \_/     
693                                |                                   
694hunk ./compiler/cmm/MkZipCfg.hs 157
695 
696 -}
697 
698-infixr 3 <*>
699-(<*>) :: AGraph m l -> AGraph m l -> AGraph m l
700-
701 catAGraphs :: [AGraph m l] -> AGraph m l
702 
703 -- | A graph is built up by splicing together graphs each containing a
704hunk ./compiler/cmm/MkZipCfg.hs 163
705 -- single node (where a label is considered a 'first' node.  The empty
706 -- graph is a left and right unit for splicing.  All of the AGraph
707 -- constructors (even complex ones like 'mkIfThenElse', as well as the
708--- splicing operation <*>, are constant-time operations.
709+-- splicing operation <>, are constant-time operations.
710 
711 emptyAGraph :: AGraph m l
712 mkLabel     :: (LastNode l) => BlockId -> AGraph m l -- graph contains the label
713hunk ./compiler/cmm/MkZipCfg.hs 186
714 -- sitting to the side out-of-line.
715 --
716 -- Example:  mkMiddle (x = 3)
717---           <*> outOfLine (mkLabel L <*> ...stuff...)
718---           <*> mkMiddle (y = x)
719+--           <> outOfLine (mkLabel L <> ...stuff...)
720+--           <> mkMiddle (y = x)
721 -- Control will flow directly from x=3 to y=x;
722 -- the block starting with L is "on the side".
723 --
724hunk ./compiler/cmm/MkZipCfg.hs 191
725--- N.B. algebraically forall g g' : g <*> outOfLine g' == outOfLine g' <*> g
726+-- N.B. algebraically forall g g' : g <> outOfLine g' == outOfLine g' <> g
727 
728 
729 
730hunk ./compiler/cmm/MkZipCfg.hs 207
731 -- goto on truth or falsehood.
732 --
733 --     mkIfThenElse mk_cond then else
734---     = (mk_cond L1 L2) <*> L1: then <*> goto J
735---                       <*> L2: else <*> goto J
736---       <*> J:
737+--     = (mk_cond L1 L2) <> L1: then <> goto J
738+--                       <> L2: else <> goto J
739+--       <> J:
740 --
741 -- where L1, L2, J are fresh
742 
743hunk ./compiler/cmm/MkZipCfg.hs 251
744 newtype AGraph m l = AGraph (Graph m l -> UniqSM (Graph m l))
745   -- an AGraph is a monadic function from a successor Graph to a new Graph
746 
747-AGraph f1 <*> AGraph f2 = AGraph f
748-    where f g = f2 g >>= f1 -- note right associativity
749+instance Monoid (AGraph m l) where
750+    mempty = emptyAGraph
751+
752+    AGraph f1 `mappend` AGraph f2 = AGraph f
753+        where f g = f2 g >>= f1 -- note right associativity
754+
755+    mconcat = catAGraphs
756 
757hunk ./compiler/cmm/MkZipCfg.hs 259
758-catAGraphs = foldr (<*>) emptyAGraph
759+catAGraphs = foldr (<>) emptyAGraph
760 
761 emptyAGraph = AGraph return
762 
763hunk ./compiler/cmm/MkZipCfg.hs 323
764     withFreshLabel "end of if"     $ \endif ->
765     withFreshLabel "start of then" $ \tid ->
766     withFreshLabel "start of else" $ \fid ->
767-        cbranch tid fid <*>
768-        mkLabel tid <*> tbranch <*> mkBranch endif <*>
769-        mkLabel fid <*> fbranch <*>
770+        cbranch tid fid <>
771+        mkLabel tid <> tbranch <> mkBranch endif <>
772+        mkLabel fid <> fbranch <>
773         mkLabel endif
774 
775 mkWhileDo cbranch body =
776hunk ./compiler/cmm/MkZipCfg.hs 333
777   withFreshLabel "loop head" $ \head ->
778   withFreshLabel "end while" $ \endwhile ->
779      -- Forrest Baskett's while-loop layout
780-     mkBranch test <*> mkLabel head <*> body
781-                   <*> mkLabel test <*> cbranch head endwhile
782-                   <*> mkLabel endwhile
783+     mkBranch test <> mkLabel head <> body
784+                   <> mkLabel test <> cbranch head endwhile
785+                   <> mkLabel endwhile
786 
787 -- | Bleat if the insertion of a last node will create unreachable code
788 note_this_code_becomes_unreachable ::
789hunk ./compiler/cmm/MkZipCfgCmm.hs 13
790          , mkJump, mkForeignJump, mkJumpGC, mkCbranch, mkSwitch, mkReturn
791          , mkReturnSimple, mkComment, copyInOflow, copyInSlot, copyOutOflow, copyOutSlot
792          , mkEntry, mkCmmIfThenElse, mkCmmIfThen, mkCmmWhileDo
793-  , (<*>), catAGraphs, mkLabel, mkBranch
794+  , (<>), catAGraphs, mkLabel, mkBranch
795   , emptyAGraph, withFreshLabel, withUnique, outOfLine
796   , lgraphOfAGraph, graphOfAGraph, labelAGraph
797   , CmmZ, CmmTopZ, CmmGraph, CmmBlock, CmmAGraph, CmmStackInfo
798hunk ./compiler/cmm/MkZipCfgCmm.hs 100
799 mkCmmIfThen e tbranch
800   = withFreshLabel "end of if"     $ \endif ->
801     withFreshLabel "start of then" $ \tid ->
802-    mkCbranch e tid endif <*>
803-    mkLabel tid   <*> tbranch <*> mkBranch endif <*>
804+    mkCbranch e tid endif <>
805+    mkLabel tid   <> tbranch <> mkBranch endif <>
806     mkLabel endif
807 
808 
809hunk ./compiler/cmm/MkZipCfgCmm.hs 115
810 -- NEED A COMPILER-DEBUGGING FLAG HERE
811 -- Sanity check: any value assigned to a pointer must be non-zero.
812 -- If it's 0, cause a crash immediately.
813-mkAssign l r = if opt_StubDeadValues then assign l r <*> check l else assign l r
814+mkAssign l r = if opt_StubDeadValues then assign l r <> check l else assign l r
815   where assign l r = mkMiddle (MidAssign l r)
816         check (CmmGlobal _) = mkNop
817         check l@(CmmLocal reg) = -- if a ptr arg is NULL, cause a crash!
818hunk ./compiler/cmm/MkZipCfgCmm.hs 168
819 copyIn oflow conv area formals =
820   foldr ci (init_offset, mkNop) args'
821   where ci (reg, RegisterParam r) (n, ms) =
822-          (n, mkAssign (CmmLocal reg) (CmmReg $ CmmGlobal r) <*> ms)
823+          (n, mkAssign (CmmLocal reg) (CmmReg $ CmmGlobal r) <> ms)
824         ci (r, StackParam off) (n, ms) = oflow area (r, off) (n, ms)
825         init_offset = widthInBytes wordWidth -- infotable
826         args  = assignArgumentsPos conv localRegType formals
827hunk ./compiler/cmm/MkZipCfgCmm.hs 179
828 -- Copy-in one arg, using overflow space if needed.
829 oneCopyOflowI, oneCopySlotI :: SlotCopier
830 oneCopyOflowI area (reg, off) (n, ms) =
831-  (max n off, mkAssign (CmmLocal reg) (CmmLoad (CmmStackSlot area off) ty) <*> ms)
832+  (max n off, mkAssign (CmmLocal reg) (CmmLoad (CmmStackSlot area off) ty) <> ms)
833   where ty = localRegType reg
834 
835 -- Copy-in one arg, using spill slots if needed -- used for calling conventions at
836hunk ./compiler/cmm/MkZipCfgCmm.hs 185
837 -- a procpoint that is not a return point. The offset is irrelevant here...
838 oneCopySlotI _ (reg, _) (n, ms) =
839-  (n, mkAssign (CmmLocal reg) (CmmLoad (CmmStackSlot (RegSlot reg) w) ty) <*> ms)
840+  (n, mkAssign (CmmLocal reg) (CmmLoad (CmmStackSlot (RegSlot reg) w) ty) <> ms)
841   where ty = localRegType reg
842         w  = widthInBytes (typeWidth ty)
843 
844hunk ./compiler/cmm/MkZipCfgCmm.hs 235
845                 (ByteOff -> Last) -> CmmAGraph
846 lastWithArgs transfer area conv actuals updfr_off last =
847   let (outArgs, copies) = copyOutOflow conv transfer area actuals updfr_off in
848-  mkMiddles copies <*> mkLast (last outArgs)
849+  mkMiddles copies <> mkLast (last outArgs)
850 
851 -- The area created for the jump and return arguments is the same area as the
852 -- procedure entry.
853hunk ./compiler/cmm/MkZipCfgCmm.hs 269
854         (off, copyin) = copyInOflow retConv area results
855         copyout = lastWithArgs Call area callConv actuals updfr_off
856                                (toCall f (Just k) updfr_off off)
857-    in (copyout <*> mkLabel k <*> copyin)
858+    in (copyout <> mkLabel k <> copyin)
859hunk ./compiler/codeGen/StgCmm.hs 241
860     mod_reg_val = CmmLoad (mkLblExpr moduleRegdLabel) bWord
861     check_already_done retId updfr_sz
862      = mkCmmIfThenElse (cmmNeWord (CmmLit zeroCLit) mod_reg_val)
863-                      (mkLabel retId <*> mkReturn (ret_e updfr_sz) [] (pop_ret_loc updfr_sz)) mkNop
864-       <*>     -- Set mod_reg to 1 to record that we've been here
865+                      (mkLabel retId <> mkReturn (ret_e updfr_sz) [] (pop_ret_loc updfr_sz)) mkNop
866+       <>      -- Set mod_reg to 1 to record that we've been here
867            mkStore (mkLblExpr moduleRegdLabel) (CmmLit (mkIntCLit 1))
868 
869                     -- The return-code pops the work stack by
870hunk ./compiler/codeGen/StgCmm.hs 249
871                     -- incrementing Sp, and then jumps to the popped item
872     ret_e updfr_sz = CmmLoad (CmmStackSlot (CallArea Old) updfr_sz) gcWord
873     ret_code updfr_sz = mkJump (ret_e updfr_sz) [] (pop_ret_loc updfr_sz)
874-      -- mkAssign spReg (cmmRegOffW spReg 1) <*>
875+      -- mkAssign spReg (cmmRegOffW spReg 1) <>
876       -- mkJump (CmmLoad (cmmRegOffW spReg (-1)) bWord) [] updfr_sz
877 
878     pop_ret_loc updfr_sz = updfr_sz - widthInBytes (typeWidth bWord)
879hunk ./compiler/codeGen/StgCmmBind.hs 97
880 cgBind (StgNonRec name rhs)
881   = do { ((info, init), body) <- getCodeR $ cgRhs name rhs
882         ; addBindC (cg_id info) info
883-        ; emit (init <*> body) }
884+        ; emit (init <> body) }
885 
886 cgBind (StgRec pairs)
887   = do { ((new_binds, inits), body) <- getCodeR $ fixC (\ new_binds_inits ->
888hunk ./compiler/codeGen/StgCmmBind.hs 104
889                do { addBindsC $ fst new_binds_inits -- avoid premature deconstruction
890                   ; liftM unzip $ listFCs [ cgRhs b e | (b,e) <- pairs ] })
891        ; addBindsC new_binds
892-       ; emit (catAGraphs inits <*> body) }
893+       ; emit (catAGraphs inits <> body) }
894 
895 {- Recursive let-bindings are tricky.
896    Consider the following pseudocode:
897hunk ./compiler/codeGen/StgCmmBind.hs 616
898 
899        -- Overwrite the closure with a (static) indirection
900        -- to the newly-allocated black hole
901-  ; emit (mkStore (cmmRegOffW nodeReg off_indirectee) (CmmReg (CmmLocal hp_rel)) <*>
902+  ; emit (mkStore (cmmRegOffW nodeReg off_indirectee) (CmmReg (CmmLocal hp_rel)) <>
903          mkStore (CmmReg nodeReg) ind_static_info)
904 
905   ; return hp_rel }
906hunk ./compiler/codeGen/StgCmmExpr.hs 122
907 cgLetNoEscapeRhs join_id local_cc bndr rhs =
908   do { (info, rhs_body) <- getCodeR $ cgLetNoEscapeRhsBody local_cc bndr rhs
909      ; let (bid, _) = expectJust "cgLetNoEscapeRhs" $ maybeLetNoEscape info
910-     ; emit (outOfLine $ mkLabel bid <*> rhs_body <*> mkBranch join_id)
911+     ; emit (outOfLine $ mkLabel bid <> rhs_body <> mkBranch join_id)
912      ; return info
913      }
914 
915hunk ./compiler/codeGen/StgCmmExpr.hs 323
916        ; withSequel (AssignTo [idToReg (NonVoid v)] False) (cgExpr scrut)
917        ; restoreCurrentCostCentre mb_cc
918        ; emit $ mkComment $ mkFastString "should be unreachable code"
919-       ; emit $ withFreshLabel "l" (\l -> mkLabel l <*> mkBranch l)}
920+       ; emit $ withFreshLabel "l" (\l -> mkLabel l <> mkBranch l)}
921 
922 cgCase scrut bndr srt alt_type alts
923   = -- the general case
924hunk ./compiler/codeGen/StgCmmExpr.hs 496
925 cgLneJump blk_id lne_regs args -- Join point; discard sequel
926   = do { cmm_args <- getNonVoidArgAmodes args
927        ; emit (mkMultiAssign lne_regs cmm_args
928-               <*> mkBranch blk_id) }
929+               <> mkBranch blk_id) }
930     
931 cgTailCall :: Id -> CgIdInfo -> [StgArg] -> FCode ()
932 cgTailCall fun_id fun_info args = do
933hunk ./compiler/codeGen/StgCmmForeign.hs 176
934 saveThreadState =
935   -- CurrentTSO->sp = Sp;
936   mkStore (cmmOffset stgCurrentTSO tso_SP) stgSp
937-  <*> closeNursery
938+  <> closeNursery
939   -- and save the current cost centre stack in the TSO when profiling:
940hunk ./compiler/codeGen/StgCmmForeign.hs 178
941-  <*> if opt_SccProfilingOn then
942+  <> if opt_SccProfilingOn then
943        mkStore (cmmOffset stgCurrentTSO tso_CCCS) curCCS
944       else mkNop
945 
946hunk ./compiler/codeGen/StgCmmHeap.hs 443
947   = withFreshLabel "gc" $ \ loop_id ->
948     withFreshLabel "gc" $ \ gc_id   ->
949       mkLabel loop_id
950-      <*> (let hpCheck = if alloc == 0 then mkNop
951-                         else mkAssign hpReg bump_hp <*>
952-                              mkCmmIfThen hp_oflo (save_alloc <*> mkBranch gc_id)
953+      <>  (let hpCheck = if alloc == 0 then mkNop
954+                         else mkAssign hpReg bump_hp <>
955+                              mkCmmIfThen hp_oflo (save_alloc <> mkBranch gc_id)
956            in if checkStack then
957                 mkCmmIfThenElse sp_oflo (mkBranch gc_id) hpCheck
958               else hpCheck)
959hunk ./compiler/codeGen/StgCmmHeap.hs 449
960-      <*> mkComment (mkFastString "outOfLine should follow:")
961-      <*> outOfLine (mkLabel gc_id
962-                     <*> mkComment (mkFastString "outOfLine here")
963-                     <*> do_gc
964-                     <*> mkBranch loop_id)
965+      <> mkComment (mkFastString "outOfLine should follow:")
966+      <> outOfLine (mkLabel gc_id
967+                     <> mkComment (mkFastString "outOfLine here")
968+                     <> do_gc
969+                     <> mkBranch loop_id)
970                -- Test for stack pointer exhaustion, then
971                -- bump heap pointer, and test for heap exhaustion
972                -- Note that we don't move the heap pointer unless the
973hunk ./compiler/codeGen/StgCmmLayout.hs 184
974   = do call <- getCode $ direct_call "slow_call" (mkRtsApFastLabel rts_fun) arity args reps
975        emit $ mkComment $ mkFastString ("slow_call for " ++ showSDoc (ppr fun) ++
976                                         " with pat " ++ showSDoc (ftext rts_fun))
977-       emit (mkAssign nodeReg fun <*> call)
978+       emit (mkAssign nodeReg fun <> call)
979   where
980     (rts_fun, arity) = slowCallPattern reps
981 
982hunk ./compiler/codeGen/StgCmmMonad.hs 287
983 -- Add code blocks from the latter to the former
984 -- (The cgs_stmts will often be empty, but not always; see codeOnly)
985 s1 `addCodeBlocksFrom` s2
986-  = s1 { cgs_stmts = cgs_stmts s1 <*> cgs_stmts s2,
987+  = s1 { cgs_stmts = cgs_stmts s1 <> cgs_stmts s2,
988         cgs_tops  = cgs_tops  s1 `appOL` cgs_tops  s2 }
989 
990 
991hunk ./compiler/codeGen/StgCmmMonad.hs 593
992 emit :: CmmAGraph -> FCode ()
993 emit ag
994   = do { state <- getState
995-       ; setState $ state { cgs_stmts = cgs_stmts state <*> ag } }
996+       ; setState $ state { cgs_stmts = cgs_stmts state <> ag } }
997 
998 emitData :: Section -> [CmmStatic] -> FCode ()
999 emitData sect lits
1000hunk ./compiler/codeGen/StgCmmMonad.hs 608
1001   = do  { us <- newUniqSupply
1002         ; let (uniq, us') = takeUniqFromSupply us
1003               (offset, entry) = mkEntry (mkBlockId uniq) conv args
1004-              blks = initUs_ us' $ lgraphOfAGraph $ entry <*> blocks
1005+              blks = initUs_ us' $ lgraphOfAGraph $ entry <> blocks
1006         ; let proc_block = CmmProc info lbl args ((offset, Just initUpdFrameOff), blks)
1007         ; state <- getState
1008         ; setState $ state { cgs_tops = cgs_tops state `snocOL` proc_block } }
1009hunk ./compiler/codeGen/StgCmmUtils.hs 576
1010          = withUnique          $ \u ->
1011            let (to_tmp, from_tmp) = split u first_stmt
1012            in mk_graph to_tmp
1013-              <*> unscramble rest
1014-              <*> mk_graph from_tmp
1015+              <> unscramble rest
1016+              <> mk_graph from_tmp
1017 
1018        split :: Unique -> Stmt -> (Stmt, Stmt)
1019        split uniq (reg, rhs)
1020hunk ./compiler/codeGen/StgCmmUtils.hs 640
1021     mk_switch tag_expr' (sortLe le branches) mb_deflt
1022              lo_tag hi_tag via_C
1023          -- Sort the branches before calling mk_switch
1024-    <*> mkLabel join_lbl
1025+    <> mkLabel join_lbl
1026 
1027   where
1028     (t1,_) `le` (t2,_) = t1 <= t2
1029hunk ./compiler/codeGen/StgCmmUtils.hs 795
1030     label_code join_lbl deflt          $ \ deflt ->
1031     label_branches join_lbl branches   $ \ branches ->
1032     mk_lit_switch scrut' deflt (sortLe le branches)
1033-    <*> mkLabel join_lbl
1034+    <> mkLabel join_lbl
1035   where
1036     le (t1,_) (t2,_) = t1 <= t2
1037 
1038hunk ./compiler/codeGen/StgCmmUtils.hs 854
1039 --  [L: code; goto J] fun L
1040 label_code join_lbl code thing_inside
1041   = withFreshLabel "switch"    $ \lbl ->
1042-    outOfLine (mkLabel lbl <*> code <*> mkBranch join_lbl)
1043-    <*> thing_inside lbl
1044+    outOfLine (mkLabel lbl <> code <> mkBranch join_lbl)
1045+    <> thing_inside lbl
1046 
1047 
1048 --------------
1049hunk ./compiler/codeGen/StgCmmUtils.hs 864
1050   | isTrivialCmmExpr e = thing_inside e
1051   | otherwise          = withTemp (cmmExprType e)      $ \ lreg ->
1052                         let reg = CmmLocal lreg in
1053-                        mkAssign reg e <*> thing_inside (CmmReg reg)
1054+                        mkAssign reg e <> thing_inside (CmmReg reg)
1055 
1056 withTemp :: CmmType -> (LocalReg -> CmmAGraph) -> CmmAGraph
1057 withTemp rep thing_inside
1058}
1059[Add Functor and Applicative instances for all monads in ghc
1060Bas van Dijk <v.dijk.bas@gmail.com>**20101208191319
1061 Ignore-this: 477a43806c6f8eeb6a09688b8a183c5d
1062] {
1063hunk ./compiler/basicTypes/UniqSupply.lhs 117
1064 -- | A monad which just gives the ability to obtain 'Unique's
1065 newtype UniqSM result = USM { unUSM :: UniqSupply -> (result, UniqSupply) }
1066 
1067-instance Monad UniqSM where
1068-  return = returnUs
1069-  (>>=) = thenUs
1070-  (>>)  = thenUs_
1071-
1072 instance Functor UniqSM where
1073hunk ./compiler/basicTypes/UniqSupply.lhs 118
1074-    fmap f (USM x) = USM (\us -> case x us of
1075-                                 (r, us') -> (f r, us'))
1076+  fmap   = fmapUs
1077 
1078 instance Applicative UniqSM where
1079hunk ./compiler/basicTypes/UniqSupply.lhs 121
1080-    pure = returnUs
1081-    (USM f) <*> (USM x) = USM $ \us -> case f us of
1082-                            (ff, us')  -> case x us' of
1083-                              (xx, us'') -> (ff xx, us'')
1084+  pure   = returnUs
1085+  (<*>)  = apUs
1086+  (*>)   = thenUs_
1087+
1088+instance Monad UniqSM where
1089+  (>>=)  = thenUs
1090+  return = pure
1091+  (>>)   = (*>)
1092 
1093 -- | Run the 'UniqSM' action, returning the final 'UniqSupply'
1094 initUs :: UniqSupply -> UniqSM a -> (a, UniqSupply)
1095hunk ./compiler/basicTypes/UniqSupply.lhs 138
1096 initUs_ :: UniqSupply -> UniqSM a -> a
1097 initUs_ init_us m = case unUSM m init_us of { (r, _) -> r }
1098 
1099+{-# INLINE fmapUs #-}
1100+{-# INLINE apUs #-}
1101 {-# INLINE thenUs #-}
1102 {-# INLINE lazyThenUs #-}
1103 {-# INLINE returnUs #-}
1104hunk ./compiler/basicTypes/UniqSupply.lhs 151
1105 instance MonadFix UniqSM where
1106     mfix m = USM (\us -> let (r,us') = unUSM (m r) us in (r,us'))
1107 
1108+fmapUs :: (a -> b) -> UniqSM a -> UniqSM b
1109+fmapUs f usmx = USM $ \us -> case unUSM usmx us of
1110+                               (r, us') -> (f r, us')
1111+
1112+apUs :: UniqSM (a -> b) -> UniqSM a -> UniqSM b
1113+apUs usmf usmx = USM $ \us -> case unUSM usmf us of
1114+                                (f, us') -> unUSM (fmap f usmx) us'
1115+
1116 thenUs :: UniqSM a -> (a -> UniqSM b) -> UniqSM b
1117 thenUs (USM expr) cont
1118   = USM (\us -> case (expr us) of
1119hunk ./compiler/cmm/CmmLint.hs 27
1120 import Constants
1121 import FastString
1122 
1123+import Control.Applicative (Applicative(..))
1124 import Control.Monad
1125 import Data.Maybe
1126 
1127hunk ./compiler/cmm/CmmLint.hs 166
1128 
1129 newtype CmmLint a = CmmLint { unCL :: Either SDoc a }
1130 
1131+instance Functor CmmLint where
1132+  fmap f m = CmmLint $ case unCL m of
1133+                         Left  e -> Left e
1134+                         Right a -> Right (f a)
1135+
1136+instance Applicative CmmLint where
1137+  pure a = CmmLint $ Right a
1138+  mf <*> mx = CmmLint $ case unCL mf of
1139+                          Left  e -> Left e
1140+                          Right f -> unCL (fmap f mx)
1141+
1142 instance Monad CmmLint where
1143hunk ./compiler/cmm/CmmLint.hs 178
1144-  CmmLint m >>= k = CmmLint $ case m of
1145-                               Left e -> Left e
1146-                               Right a -> unCL (k a)
1147-  return a = CmmLint (Right a)
1148+  m >>= k = CmmLint $ case unCL m of
1149+                       Left  e -> Left e
1150+                       Right a -> unCL (k a)
1151+  return = pure
1152 
1153 cmmLintErr :: SDoc -> CmmLint a
1154 cmmLintErr msg = CmmLint (Left msg)
1155hunk ./compiler/cmm/CmmTx.hs 3
1156 module CmmTx where
1157 
1158+import Control.Applicative (Applicative(..))
1159+
1160 data ChangeFlag = NoChange | SomeChange
1161 
1162 type Tx a    = a -> TxRes a
1163hunk ./compiler/cmm/CmmTx.hs 57
1164 instance Functor TxRes where
1165   fmap f (TxRes ch a) = TxRes ch (f a)
1166 
1167+instance Applicative TxRes where
1168+    pure = TxRes NoChange
1169+    TxRes NoChange   f <*> TxRes ch x = TxRes ch         (f x)
1170+    TxRes SomeChange f <*> TxRes _  x = TxRes SomeChange (f x)
1171+
1172 instance Monad TxRes where
1173hunk ./compiler/cmm/CmmTx.hs 63
1174-    return = TxRes NoChange
1175+    return = pure
1176     (TxRes NoChange a) >>= k = k a
1177     (TxRes SomeChange a) >>= k = let (TxRes _ a') = k a in TxRes SomeChange a'
1178hunk ./compiler/cmm/DFMonad.hs 23
1179 import Outputable
1180 import UniqSupply
1181 
1182+import Control.Applicative ( Applicative(..) )
1183 {-
1184 
1185 A dataflow monad maintains a mapping from BlockIds to dataflow facts,
1186hunk ./compiler/cmm/DFMonad.hs 69
1187                          , df_facts_change :: !ChangeFlag
1188                          }
1189 
1190-newtype DFM' m fact a = DFM' (DataflowLattice fact -> DFState fact
1191-                                                   -> m (a, DFState  fact))
1192+newtype DFM' m fact a = DFM' {unDFM' :: DataflowLattice fact -> DFState fact
1193+                                                             -> m (a, DFState  fact)}
1194 type DFM fact a = DFM' FuelMonad fact a
1195 
1196 
1197hunk ./compiler/cmm/DFMonad.hs 189
1198 graphWasRewritten :: DFM f ChangeFlag
1199 graphWasRewritten = DFM' f
1200     where f _ s = return (df_rewritten s, s)
1201-                   
1202+
1203+instance Monad m => Functor (DFM' m f) where
1204+  fmap f d  = DFM' $ \l s -> do (a, s') <- unDFM' d l s
1205+                                s' `seq` return (f a, s')
1206+
1207+instance Monad m => Applicative (DFM' m f) where
1208+  pure a    = DFM' $ \_ s -> return (a, s)
1209+  df <*> dx = DFM' $ \l s -> do (f, s') <- unDFM' df l s
1210+                                s' `seq` unDFM' (fmap f dx) l s'
1211+
1212 instance Monad m => Monad (DFM' m f) where
1213hunk ./compiler/cmm/DFMonad.hs 200
1214-  DFM' f >>= k = DFM' (\l s -> do (a, s') <- f l s
1215-                                  s' `seq` case k a of DFM' f' -> f' l s')
1216-  return a = DFM' (\_ s -> return (a, s))
1217+  d >>= k   = DFM' $ \l s -> do (a, s') <- unDFM' d l s
1218+                                s' `seq` unDFM' (k a) l s'
1219+  return = pure
1220  -- The `seq` is essential to ensure that entire passes of the dataflow engine
1221  -- aren't postponed in a thunk. By making the sequence strict in the state,
1222  -- we ensure that each action in the monad is executed immediately, preventing
1223hunk ./compiler/cmm/OptimizationFuel.hs 26
1224 --import GHC.Exts (State#)
1225 import Panic
1226 import Data.IORef
1227+import Control.Applicative (Applicative(..))
1228 import Control.Monad
1229 import StaticFlags (opt_Fuel)
1230 import UniqSupply
1231hunk ./compiler/cmm/OptimizationFuel.hs 78
1232 #endif
1233 
1234 data FuelState = FuelState { fs_fuellimit :: OptimizationFuel, fs_lastpass :: String }
1235-newtype FuelMonad a = FuelMonad (FuelState -> UniqSM (a, FuelState))
1236+newtype FuelMonad a = FuelMonad {runFuel :: FuelState -> UniqSM (a, FuelState)}
1237 
1238 fuelConsumingPass :: String -> FuelConsumer a -> FuelMonad a
1239 fuelConsumingPass name f = do fuel <- fuelRemaining
1240hunk ./compiler/cmm/OptimizationFuel.hs 96
1241        writeIORef (fuel_ref fs) fuel'
1242        return a
1243 
1244+instance Functor FuelMonad where
1245+  fmap f m  = FuelMonad $ fmap (\(x, s') -> (f x, s')) . runFuel m
1246+
1247+instance Applicative FuelMonad where
1248+  pure a    = FuelMonad $ \s -> pure (a, s)
1249+  mf <*> mx = FuelMonad $ \s -> do (f, s') <- runFuel mf s
1250+                                   runFuel (fmap f mx) s'
1251+
1252 instance Monad FuelMonad where
1253hunk ./compiler/cmm/OptimizationFuel.hs 105
1254-  FuelMonad f >>= k = FuelMonad (\s -> do (a, s') <- f s
1255-                                          let FuelMonad f' = k a in (f' s'))
1256-  return a = FuelMonad (\s -> return (a, s))
1257+  m >>= k  = FuelMonad $ \s -> do (a, s') <- runFuel m s
1258+                                  runFuel (k a) s'
1259+  return   = pure
1260 
1261 instance MonadUnique FuelMonad where
1262     getUniqueSupplyM = liftUniq getUniqueSupplyM
1263hunk ./compiler/cmm/PprC.hs 62
1264 import Data.Map (Map)
1265 import qualified Data.Map as Map
1266 import Data.Word
1267+import Control.Applicative (Applicative(..))
1268 
1269 import Data.Array.ST
1270 import Control.Monad.ST
1271hunk ./compiler/cmm/PprC.hs 909
1272 type TEState = (UniqSet LocalReg, Map CLabel ())
1273 newtype TE a = TE { unTE :: TEState -> (a, TEState) }
1274 
1275+instance Functor TE where
1276+  fmap f m  = TE $ \s -> case unTE m s of (a, s') -> (f a, s')
1277+
1278+instance Applicative TE where
1279+  pure a    = TE $ \s -> (a, s)
1280+  mf <*> mx = TE $ \s -> case unTE mf s of (f, s') -> unTE (fmap f mx) s'
1281+
1282 instance Monad TE where
1283hunk ./compiler/cmm/PprC.hs 917
1284-   TE m >>= k  = TE $ \s -> case m s of (a, s') -> unTE (k a) s'
1285-   return a    = TE $ \s -> (a, s)
1286+   m >>= k  = TE $ \s -> case unTE m s of (a, s') -> unTE (k a) s'
1287+   return   = pure
1288 
1289 te_lbl :: CLabel -> TE ()
1290 te_lbl lbl = TE $ \(temps,lbls) -> ((), (temps, Map.insert lbl () lbls))
1291hunk ./compiler/codeGen/CgExtCode.hs 51
1292 import UniqFM
1293 import Unique
1294 
1295+import Control.Applicative ( Applicative(..) )
1296 
1297 -- | The environment contains variable definitions or blockids.
1298 data Named     
1299hunk ./compiler/codeGen/CgExtCode.hs 74
1300 
1301 type ExtCode = ExtFCode ()
1302 
1303+mapExtFC :: (a -> b) -> ExtFCode a -> ExtFCode b
1304+mapExtFC f c = EC $ \e s -> fmap (\(s', x) -> (s', f x)) $ unEC c e s
1305+
1306+apExtFC :: ExtFCode (a -> b) -> ExtFCode a -> ExtFCode b
1307+apExtFC cf cx = EC $ \e s -> do (s', f) <- unEC cf e s
1308+                                unEC (fmap f cx) e s'
1309+
1310 returnExtFC :: a -> ExtFCode a
1311 returnExtFC a  = EC $ \_ s -> return (s, a)
1312 
1313hunk ./compiler/codeGen/CgExtCode.hs 85
1314 thenExtFC :: ExtFCode a -> (a -> ExtFCode b) -> ExtFCode b
1315-thenExtFC (EC m) k = EC $ \e s -> do (s',r) <- m e s; unEC (k r) e s'
1316+thenExtFC c k = EC $ \e s -> do (s', r) <- unEC c e s
1317+                                unEC (k r) e s'
1318+
1319+instance Functor ExtFCode where
1320+  fmap = mapExtFC
1321+
1322+instance Applicative ExtFCode where
1323+  pure  = returnExtFC
1324+  (<*>) = apExtFC
1325 
1326 instance Monad ExtFCode where
1327   (>>=) = thenExtFC
1328hunk ./compiler/codeGen/CgExtCode.hs 97
1329-  return = returnExtFC
1330+  return = pure
1331 
1332 
1333 -- | Takes the variable decarations and imports from the monad
1334hunk ./compiler/codeGen/CgMonad.lhs 79
1335 import UniqSupply
1336 import Outputable
1337 
1338+import Control.Applicative ( Applicative(..) )
1339 import Control.Monad
1340 import Data.List
1341 
1342hunk ./compiler/codeGen/CgMonad.lhs 372
1343 %************************************************************************
1344 
1345 \begin{code}
1346-newtype FCode a = FCode (CgInfoDownwards -> CgState -> (a, CgState))
1347+newtype FCode a = FCode {unFC :: CgInfoDownwards -> CgState -> (a, CgState)}
1348 type Code       = FCode ()
1349 
1350hunk ./compiler/codeGen/CgMonad.lhs 375
1351+instance Functor FCode where
1352+        fmap   = mapFC
1353+
1354+instance Applicative FCode where
1355+        pure   = returnFC
1356+        (<*>)  = apFC
1357+
1358 instance Monad FCode where
1359hunk ./compiler/codeGen/CgMonad.lhs 383
1360-       (>>=) = thenFC
1361-       return = returnFC
1362+       (>>=)  = thenFC
1363+       return = pure
1364 
1365hunk ./compiler/codeGen/CgMonad.lhs 386
1366+{-# INLINE mapFC #-}
1367+{-# INLINE apFC #-}
1368 {-# INLINE thenC #-}
1369 {-# INLINE thenFC #-}
1370 {-# INLINE returnFC #-}
1371hunk ./compiler/codeGen/CgMonad.lhs 403
1372              (res, _) -> return res
1373        }
1374 
1375+mapFC :: (a -> b) -> FCode a -> FCode b
1376+mapFC f fcx =
1377+    FCode (\info_down state ->
1378+               let (result, new_state) = unFC fcx info_down state
1379+               in (f result, new_state))
1380+
1381+apFC :: FCode (a -> b) -> FCode a -> FCode b
1382+apFC fcf fcx =
1383+    FCode (\info_down state ->
1384+               let (f, new_state) = unFC fcf info_down state
1385+               in unFC (fmap f fcx) info_down new_state)
1386+
1387 returnFC :: a -> FCode a
1388 returnFC val = FCode (\_ state -> (val, state))
1389 \end{code}
1390hunk ./compiler/codeGen/StgCmmMonad.hs 70
1391 import FastString(sLit)
1392 import Outputable
1393 
1394+import Control.Applicative ( Applicative(..) )
1395 import Control.Monad
1396 import Data.List
1397 import Prelude hiding( sequence )
1398hunk ./compiler/codeGen/StgCmmMonad.hs 84
1399 --     The FCode monad and its types
1400 --------------------------------------------------------
1401 
1402-newtype FCode a = FCode (CgInfoDownwards -> CgState -> (a, CgState))
1403+newtype FCode a = FCode {runFCode :: CgInfoDownwards -> CgState -> (a, CgState)}
1404+
1405+instance Functor FCode where
1406+        fmap   = mapFC
1407+
1408+instance Applicative FCode where
1409+        pure   = returnFC
1410+        (<*>)  = apFC
1411 
1412 instance Monad FCode where
1413hunk ./compiler/codeGen/StgCmmMonad.hs 94
1414-       (>>=) = thenFC
1415-       return = returnFC
1416+       (>>=)  = thenFC
1417+       return = pure
1418 
1419 {-# INLINE thenC #-}
1420hunk ./compiler/codeGen/StgCmmMonad.hs 98
1421+{-# INLINE mapFC #-}
1422+{-# INLINE apFC #-}
1423 {-# INLINE thenFC #-}
1424 {-# INLINE returnFC #-}
1425 
1426hunk ./compiler/codeGen/StgCmmMonad.hs 110
1427              (res, _) -> return res
1428        }
1429 
1430+mapFC :: (a -> b) -> FCode a -> FCode b
1431+mapFC f c = FCode $ \info_down state ->
1432+            let (val, new_state) = runFCode c info_down state
1433+            in (f val, new_state)
1434+
1435+apFC :: FCode (a -> b) -> FCode a -> FCode b
1436+apFC cf cx = FCode $ \info_down state ->
1437+             let (f, new_state) = runFCode cf info_down state
1438+             in runFCode (fmap f cx) info_down new_state
1439+
1440 returnFC :: a -> FCode a
1441hunk ./compiler/codeGen/StgCmmMonad.hs 121
1442-returnFC val = FCode (\_info_down state -> (val, state))
1443+returnFC val = FCode $ \_info_down state -> (val, state)
1444 
1445 thenC :: FCode () -> FCode a -> FCode a
1446 thenC (FCode m) (FCode k) =
1447hunk ./compiler/codeGen/StgCmmMonad.hs 145
1448 mapCs = mapM_
1449 
1450 thenFC :: FCode a -> (a -> FCode c) -> FCode c
1451-thenFC (FCode m) k = FCode (
1452-       \info_down state ->
1453-               let
1454-                       (m_result, new_state) = m info_down state
1455-                       (FCode kcode) = k m_result
1456-               in
1457-                       kcode info_down new_state
1458-       )
1459+thenFC c k = FCode $ \info_down state ->
1460+             let (val, new_state) = runFCode c info_down state
1461+             in runFCode (k val) info_down new_state
1462 
1463 listFCs :: [FCode a] -> FCode [a]
1464 listFCs = Prelude.sequence
1465hunk ./compiler/coreSyn/CoreLint.lhs 42
1466 import Outputable
1467 import FastString
1468 import Util
1469+import Control.Applicative (Applicative(..))
1470 import Control.Monad
1471 import Data.Maybe
1472 \end{code}
1473hunk ./compiler/coreSyn/CoreLint.lhs 855
1474 Here we substitute 'ty' for 'a' in 'body', on the fly.
1475 -}
1476 
1477+instance Functor LintM where
1478+  fmap f m = LintM $ \ loc subst errs ->
1479+                       let (res, errs') = unLintM m loc subst errs
1480+                       in (fmap f res, errs')
1481+
1482+instance Applicative LintM where
1483+  pure x    = LintM $ \ _ _ errs -> (Just x, errs)
1484+  mf <*> mx = LintM $ \ loc subst errs ->
1485+                        let (res, errs') = unLintM mf loc subst errs
1486+                        in case res of
1487+                             Just f -> unLintM (fmap f mx) loc subst errs'
1488+                             Nothing -> (Nothing, errs')
1489+
1490 instance Monad LintM where
1491hunk ./compiler/coreSyn/CoreLint.lhs 869
1492-  return x = LintM (\ _   _     errs -> (Just x, errs))
1493+  return   = pure
1494   fail err = failWithL (text err)
1495   m >>= k  = LintM (\ loc subst errs ->
1496                        let (res, errs') = unLintM m loc subst errs in
1497hunk ./compiler/coreSyn/MkExternalCore.lhs 31
1498 import DynFlags
1499 import FastString
1500 
1501+import Control.Applicative (Applicative(..))
1502 import Data.Char
1503 import System.IO
1504 
1505hunk ./compiler/coreSyn/MkExternalCore.lhs 48
1506  | otherwise
1507  = return ()
1508 
1509--- Reinventing the Reader monad; whee.
1510-newtype CoreM a = CoreM (CoreState -> (CoreState, a))
1511+-- Reinventing the State monad; whee.
1512+newtype CoreM a = CoreM {unCore :: CoreState -> (CoreState, a)}
1513 type CoreState = Module
1514hunk ./compiler/coreSyn/MkExternalCore.lhs 51
1515+
1516+instance Functor CoreM where
1517+  fmap f m  = CoreM $ \s -> case unCore m s of
1518+                              (s', x) -> (s', f x)
1519+
1520+instance Applicative CoreM where
1521+  pure x    = CoreM $ \s -> (s, x)
1522+  mf <*> mx = CoreM $ \s -> case unCore mf s of
1523+                              (s', f) -> unCore (fmap f mx) s'
1524+
1525 instance Monad CoreM where
1526hunk ./compiler/coreSyn/MkExternalCore.lhs 62
1527-  (CoreM m) >>= f = CoreM (\ s -> case m s of
1528-                                    (s',r) -> case f r of
1529-                                                CoreM f' -> f' s')
1530-  return x = CoreM (\ s -> (s, x))
1531+  m >>= f   = CoreM $ \s -> case unCore m s of
1532+                              (s', r) -> unCore (f r) s'
1533+  return = pure
1534 runCoreM :: CoreM a -> CoreState -> a
1535 runCoreM (CoreM f) s = snd $ f s
1536 ask :: CoreM CoreState
1537hunk ./compiler/deSugar/Coverage.lhs 39
1538 import Data.HashTable   ( hashString )
1539 import Data.Map (Map)
1540 import qualified Data.Map as Map
1541+import Control.Applicative ( Applicative(..) )
1542 \end{code}
1543 
1544 
1545hunk ./compiler/deSugar/Coverage.lhs 607
1546         -- a combination of a state monad (TickTransState) and a writer
1547         -- monad (FreeVars).
1548 
1549+instance Functor TM where
1550+  fmap f tm = TM $ \env st -> case unTM tm env st of
1551+                               (r, fv, st1) -> (f r, fv, st1)
1552+
1553+instance Applicative TM where
1554+  pure a      = TM $ \ _  st -> (a, noFVs, st)
1555+  tmf <*> tmx = TM $ \env st -> case unTM tmf env st of
1556+                                 (f, fv1, st1) ->
1557+                                      case unTM tmx env st1 of
1558+                                        (r, fv2, st2) -> (f r, fv1 `plusOccEnv` fv2, st2)
1559+
1560 instance Monad TM where
1561hunk ./compiler/deSugar/Coverage.lhs 619
1562-  return a = TM $ \ _env st -> (a,noFVs,st)
1563-  (TM m) >>= k = TM $ \ env st ->
1564-                               case m env st of
1565-                                 (r1,fv1,st1) ->
1566-                                     case unTM (k r1) env st1 of
1567-                                       (r2,fv2,st2) ->
1568-                                          (r2, fv1 `plusOccEnv` fv2, st2)
1569+  return  = pure
1570+  m >>= k = TM $ \env st -> case unTM m env st of
1571+                             (r1, fv1, st1) ->
1572+                                  case unTM (k r1) env st1 of
1573+                                    (r2, fv2, st2) ->
1574+                                        (r2, fv1 `plusOccEnv` fv2, st2)
1575 
1576 -- getState :: TM TickTransState
1577 -- getState = TM $ \ env st -> (st, noFVs, st)
1578hunk ./compiler/ghci/ByteCodeGen.lhs 67
1579 import Data.Map (Map)
1580 import qualified Data.Map as Map
1581 import qualified FiniteMap as Map
1582+import Control.Applicative ( Applicative(..) )
1583 
1584 -- -----------------------------------------------------------------------------
1585 -- Generating byte code for a complete module
1586hunk ./compiler/ghci/ByteCodeGen.lhs 1506
1587         breakArray :: BreakArray        -- array of breakpoint flags
1588         }
1589 
1590-newtype BcM r = BcM (BcM_State -> IO (BcM_State, r))
1591+newtype BcM r = BcM {unBc :: BcM_State -> IO (BcM_State, r)}
1592 
1593 ioToBc :: IO a -> BcM a
1594 ioToBc io = BcM $ \st -> do
1595hunk ./compiler/ghci/ByteCodeGen.lhs 1519
1596    where
1597    breakArray = modBreaks_flags modBreaks
1598 
1599+mapBc :: (a -> b) -> BcM a -> BcM b
1600+mapBc f bc = BcM $ \st -> fmap (\(st1, x) -> (st1, f x)) $ unBc bc st
1601+
1602+apBc :: BcM (a -> b) -> BcM a -> BcM b
1603+apBc bcf bcx = BcM $ \st -> do (st1, f) <- unBc bcf st
1604+                               unBc (fmap f bcx) st1
1605+
1606 thenBc :: BcM a -> (a -> BcM b) -> BcM b
1607hunk ./compiler/ghci/ByteCodeGen.lhs 1527
1608-thenBc (BcM expr) cont = BcM $ \st0 -> do
1609-  (st1, q) <- expr st0
1610+thenBc bc cont = BcM $ \st0 -> do
1611+  (st1, q) <- unBc bc st0
1612   let BcM k = cont q
1613   (st2, r) <- k st1
1614   return (st2, r)
1615hunk ./compiler/ghci/ByteCodeGen.lhs 1534
1616 
1617 thenBc_ :: BcM a -> BcM b -> BcM b
1618-thenBc_ (BcM expr) (BcM cont) = BcM $ \st0 -> do
1619-  (st1, _) <- expr st0
1620-  (st2, r) <- cont st1
1621+thenBc_ bc1 bc2 = BcM $ \st0 -> do
1622+  (st1, _) <- unBc bc1 st0
1623+  (st2, r) <- unBc bc2 st1
1624   return (st2, r)
1625 
1626 returnBc :: a -> BcM a
1627hunk ./compiler/ghci/ByteCodeGen.lhs 1542
1628 returnBc result = BcM $ \st -> (return (st, result))
1629 
1630+instance Functor BcM where
1631+  fmap   = mapBc
1632+
1633+instance Applicative BcM where
1634+  pure   = returnBc
1635+  (<*>)  = apBc
1636+  (*>)   = thenBc_
1637+
1638 instance Monad BcM where
1639hunk ./compiler/ghci/ByteCodeGen.lhs 1551
1640-  (>>=) = thenBc
1641-  (>>)  = thenBc_
1642-  return = returnBc
1643+  (>>=)  = thenBc
1644+  (>>)   = (*>)
1645+  return = pure
1646 
1647 emitBc :: ([BcPtr] -> ProtoBCO Name) -> BcM (ProtoBCO Name)
1648 emitBc bco
1649hunk ./compiler/ghci/ByteCodeItbls.lhs 33
1650 import Util
1651 import Outputable
1652 
1653+import Control.Applicative ( Applicative(..) )
1654 import Foreign
1655 import Foreign.C
1656 import Foreign.C.String
1657hunk ./compiler/ghci/ByteCodeItbls.lhs 400
1658 fieldSz :: (Storable a, Storable b) => (a -> b) -> a -> Int
1659 fieldSz sel x = sizeOf (sel x)
1660 
1661-newtype State s m a = State (s -> m (s, a))
1662+newtype State s m a = State {unState :: s -> m (s, a)}
1663+
1664+instance Functor m => Functor (State s m) where
1665+  fmap f m = State $ fmap (\(s', x) -> (s', f x)) . unState m
1666+
1667+instance (Functor m, Applicative m, Monad m) => Applicative (State s m) where
1668+  pure a    = State $ \s -> pure (s, a)
1669+  mf <*> mx = State $ \s -> unState mf s >>= \(s', f) -> unState (fmap f mx) s'
1670 
1671 instance Monad m => Monad (State s m) where
1672   return a      = State (\s -> return (s, a))
1673hunk ./compiler/hsSyn/Convert.lhs 35
1674 import FastString
1675 import Outputable
1676 
1677+import Control.Applicative ( Applicative (..) )
1678 import Control.Monad( unless )
1679 
1680 import Language.Haskell.TH as TH hiding (sigP)
1681hunk ./compiler/hsSyn/Convert.lhs 81
1682 -- In particular, we want it on binding locations, so that variables bound in
1683 -- the spliced-in declarations get a location that at least relates to the splice point
1684 
1685+instance Functor CvtM where
1686+  fmap f m  = CvtM $ fmap f . unCvtM m
1687+
1688+instance Applicative CvtM where
1689+  pure x    = CvtM $ \_   -> pure x
1690+  mf <*> mx = CvtM $ \loc -> case unCvtM mf loc of
1691+                               Left err -> Left err
1692+                               Right f  -> unCvtM (fmap f mx) loc
1693+
1694 instance Monad CvtM where
1695hunk ./compiler/hsSyn/Convert.lhs 91
1696-  return x       = CvtM $ \_   -> Right x
1697-  (CvtM m) >>= k = CvtM $ \loc -> case m loc of
1698-                                   Left err -> Left err
1699-                                   Right v  -> unCvtM (k v) loc
1700+  return    = pure
1701+  m >>= k   = CvtM $ \loc -> case unCvtM m loc of
1702+                              Left err -> Left err
1703+                              Right v  -> unCvtM (k v) loc
1704 
1705 initCvt :: SrcSpan -> CvtM a -> Either Message a
1706 initCvt loc (CvtM m) = m loc
1707hunk ./compiler/main/CmdLineParser.hs 30
1708 import SrcLoc
1709 
1710 import Data.List
1711+import Control.Applicative (Applicative(..))
1712+import Control.Monad (ap)
1713 
1714 --------------------------------------------------------
1715 --        The Flag and OptKind types
1716hunk ./compiler/main/CmdLineParser.hs 72
1717                               -> Errs -> Warns
1718                               -> m (Errs, Warns, a) }
1719 
1720+instance Functor m => Functor (EwM m) where
1721+  fmap f m = EwM $ \l e w -> fmap (\(e', w', x) -> (e', w', f x)) $ unEwM m l e w
1722+
1723+instance (Applicative m, Monad m) => Applicative (EwM m) where
1724+  pure v     = EwM $ \_ e w -> pure (e, w, v)
1725+  mf <*> mx  = EwM $ \l e w -> do (e', w', f) <- unEwM mf l e w
1726+                                  unEwM (fmap f mx) l e' w'
1727+
1728 instance Monad m => Monad (EwM m) where
1729hunk ./compiler/main/CmdLineParser.hs 81
1730-  (EwM f) >>= k = EwM (\l e w -> do { (e', w', r) <- f l e w
1731-                                    ; unEwM (k r) l e' w' })
1732+  m >>= k = EwM $ \l e w -> do (e', w', r) <- unEwM m l e w
1733+                               unEwM (k r) l e' w'
1734   return v = EwM (\_ e w -> return (e, w, v))
1735 
1736 setArg :: Located String -> EwM m a -> EwM m a
1737hunk ./compiler/main/CmdLineParser.hs 113
1738 
1739 newtype CmdLineP s a = CmdLineP { runCmdLine :: s -> (a, s) }
1740 
1741+instance Functor (CmdLineP s) where
1742+    fmap f m = CmdLineP $ \s -> let
1743+                (x, s') = runCmdLine m s
1744+                in (f x, s')
1745+
1746+instance Applicative (CmdLineP s) where
1747+    pure a = CmdLineP $ \s -> (a, s)
1748+    mf <*> mx  = CmdLineP $ \s -> let (f, s') = runCmdLine mf s
1749+                                  in runCmdLine (fmap f mx) s'
1750+
1751 instance Monad (CmdLineP s) where
1752hunk ./compiler/main/CmdLineParser.hs 124
1753-        return a = CmdLineP $ \s -> (a, s)
1754+        return   = pure
1755         m >>= k  = CmdLineP $ \s -> let
1756                 (a, s') = runCmdLine m s
1757                 in runCmdLine (k a) s'
1758hunk ./compiler/main/GhcMonad.hs 31
1759 import ErrUtils
1760 
1761 import Data.IORef
1762+import Control.Applicative ( Applicative(..) )
1763 
1764 -- -----------------------------------------------------------------------------
1765 -- | A monad that has all the features needed by GHC API calls.
1766hunk ./compiler/main/GhcMonad.hs 101
1767 instance Functor Ghc where
1768   fmap f m = Ghc $ \s -> f `fmap` unGhc m s
1769 
1770+instance Applicative Ghc where
1771+  pure a    = Ghc $ \_ -> return a
1772+  mf <*> mx = Ghc $ \s -> unGhc mf s <*> unGhc mx s
1773+
1774 instance Monad Ghc where
1775hunk ./compiler/main/GhcMonad.hs 106
1776-  return a = Ghc $ \_ -> return a
1777+  return   = pure
1778   m >>= g  = Ghc $ \s -> do a <- unGhc m s; unGhc (g a) s
1779 
1780 instance MonadIO Ghc where
1781hunk ./compiler/main/GhcMonad.hs 161
1782 instance Functor m => Functor (GhcT m) where
1783   fmap f m = GhcT $ \s -> f `fmap` unGhcT m s
1784 
1785-instance Monad m => Monad (GhcT m) where
1786+instance Applicative m => Applicative (GhcT m) where
1787+  pure x    = GhcT $ \_ -> pure x
1788+  mf <*> mx = GhcT $ \s -> unGhcT mf s <*> unGhcT mx s
1789+
1790+instance (Monad m) => Monad (GhcT m) where
1791   return x = GhcT $ \_ -> return x
1792   m >>= k  = GhcT $ \s -> do a <- unGhcT m s; unGhcT (k a) s
1793 
1794hunk ./compiler/main/HscMain.lhs 149
1795 import Exception
1796 -- import MonadUtils
1797 
1798+import Control.Applicative ( Applicative(..) )
1799 import Control.Monad
1800 -- import System.IO
1801 import Data.IORef
1802hunk ./compiler/main/HscMain.lhs 196
1803 -- -----------------------------------------------------------------------------
1804 -- The Hsc monad: collecting warnings
1805 
1806-newtype Hsc a = Hsc (HscEnv -> WarningMessages -> IO (a, WarningMessages))
1807+newtype Hsc a = Hsc {unHsc :: HscEnv -> WarningMessages -> IO (a, WarningMessages)}
1808+
1809+instance Functor Hsc where
1810+  fmap f m  = Hsc $ \e w -> fmap (\(x, w1) -> (f x, w1)) $ unHsc m e w
1811+
1812+instance Applicative Hsc where
1813+  pure a    = Hsc $ \_ w -> pure (a, w)
1814+  mf <*> mx = Hsc $ \e w -> do (f, w1) <- unHsc mf e w
1815+                               unHsc (fmap f mx) e w1
1816 
1817 instance Monad Hsc where
1818hunk ./compiler/main/HscMain.lhs 207
1819-  return a = Hsc $ \_ w -> return (a, w)
1820-  Hsc m >>= k = Hsc $ \e w -> do (a, w1) <- m e w
1821-                                 case k a of
1822-                                    Hsc k' -> k' e w1
1823+  return    = pure
1824+  m >>= k   = Hsc $ \e w -> do (a, w1) <- unHsc m e w
1825+                               unHsc (k a) e w1
1826 
1827 instance MonadIO Hsc where
1828   liftIO io = Hsc $ \_ w -> do a <- io; return (a, w)
1829hunk ./compiler/main/TidyPgm.lhs 49
1830 import Util
1831 import FastString
1832 
1833+import Control.Applicative ( Applicative(..) )
1834 import Data.List       ( sortBy )
1835 import Data.IORef      ( IORef, readIORef, writeIORef )
1836 \end{code}
1837hunk ./compiler/main/TidyPgm.lhs 755
1838 run (DFFV m) = case m emptyVarSet [] of
1839                  (set,ids,_) -> (set,ids)
1840 
1841-newtype DFFV a = DFFV (VarSet -> [Var] -> (VarSet,[Var],a))
1842+newtype DFFV a = DFFV {unDFFV :: VarSet -> [Var] -> (VarSet,[Var],a)}
1843+
1844+instance Functor DFFV where
1845+  fmap f m  = DFFV $ \set ids ->
1846+                      case unDFFV m set ids of
1847+                        (set', ids', x) -> (set', ids', f x)
1848+
1849+instance Applicative DFFV where
1850+  pure a    = DFFV $ \set ids -> (set, ids, a)
1851+  mf <*> mx = DFFV $ \set ids ->
1852+                      case unDFFV mf set ids of
1853+                        (set', ids', f) -> unDFFV (fmap f mx) set' ids'
1854 
1855 instance Monad DFFV where
1856hunk ./compiler/main/TidyPgm.lhs 769
1857-  return a = DFFV $ \set ids -> (set, ids, a)
1858-  (DFFV m) >>= k = DFFV $ \set ids ->
1859-    case m set ids of
1860-       (set',ids',a) -> case k a of
1861-                          DFFV f -> f set' ids'
1862+  return    = pure
1863+  m >>= k   = DFFV $ \set ids ->
1864+                      case unDFFV m set ids of
1865+                        (set',ids',a) -> unDFFV (k a) set' ids'
1866 
1867 insert :: Var -> DFFV ()
1868 insert v = DFFV $ \ set ids  -> case () of
1869hunk ./compiler/nativeGen/AsmCodeGen.lhs 96
1870 
1871 import Data.List
1872 import Data.Maybe
1873+import Control.Applicative (Applicative(..))
1874 import Control.Monad
1875 import System.IO
1876 
1877hunk ./compiler/nativeGen/AsmCodeGen.lhs 740
1878   blocks' <- mapM cmmBlockConFold (cmmMiniInline blocks)
1879   return $ CmmProc info lbl params (ListGraph blocks')
1880 
1881-newtype CmmOptM a = CmmOptM (([CLabel], DynFlags) -> (# a, [CLabel] #))
1882+newtype CmmOptM a = CmmOptM {runCmmOptM :: ([CLabel], DynFlags) -> (# a, [CLabel] #)}
1883+
1884+instance Functor CmmOptM where
1885+  fmap f m  = CmmOptM $ \(imports, dflags) ->
1886+                case runCmmOptM m (imports, dflags) of
1887+                  (# x, imports' #) -> (# f x, imports' #)
1888+
1889+instance Applicative CmmOptM where
1890+  pure x    = CmmOptM $ \(imports, _) -> (# x, imports #)
1891+  mf <*> mx = CmmOptM $ \(imports, dflags) ->
1892+                case runCmmOptM mf (imports, dflags) of
1893+                  (# f, imports' #) -> runCmmOptM (fmap f mx) (imports', dflags)
1894 
1895 instance Monad CmmOptM where
1896hunk ./compiler/nativeGen/AsmCodeGen.lhs 754
1897-  return x = CmmOptM $ \(imports, _) -> (# x,imports #)
1898-  (CmmOptM f) >>= g =
1899-    CmmOptM $ \(imports, dflags) ->
1900-                case f (imports, dflags) of
1901-                  (# x, imports' #) ->
1902-                    case g x of
1903-                      CmmOptM g' -> g' (imports', dflags)
1904+  return    = pure
1905+  m >>= k   = CmmOptM $ \(imports, dflags) ->
1906+                case runCmmOptM m (imports, dflags) of
1907+                  (# x, imports' #) -> runCmmOptM (k x) (imports', dflags)
1908 
1909 addImportCmmOpt :: CLabel -> CmmOptM ()
1910 addImportCmmOpt lbl = CmmOptM $ \(imports, _dflags) -> (# (), lbl:imports #)
1911hunk ./compiler/nativeGen/NCGMonad.hs 32
1912   
1913 #include "HsVersions.h"
1914 
1915+import Control.Applicative (Applicative(..))
1916+
1917 import Reg
1918 import Size
1919 import TargetReg
1920hunk ./compiler/nativeGen/NCGMonad.hs 66
1921 initNat init_st m
1922        = case unNat m init_st of { (r,st) -> (r,st) }
1923 
1924+instance Functor NatM where
1925+  fmap   = mapNat
1926+
1927+instance Applicative NatM where
1928+  pure   = returnNat
1929+  (<*>)  = apNat
1930 
1931 instance Monad NatM where
1932hunk ./compiler/nativeGen/NCGMonad.hs 74
1933-  (>>=) = thenNat
1934-  return = returnNat
1935+  (>>=)  = thenNat
1936+  return = pure
1937+
1938+mapNat :: (a -> b) -> NatM a -> NatM b
1939+mapNat f expr
1940+    = NatM $ \st -> case unNat expr st of
1941+                      (x, st') -> (f x, st')
1942 
1943hunk ./compiler/nativeGen/NCGMonad.hs 82
1944+apNat :: NatM (a -> b) -> NatM a -> NatM b
1945+apNat nf nx
1946+    = NatM $ \st -> case unNat nf st of
1947+                      (f, st') -> unNat (fmap f nx) st'
1948 
1949 thenNat :: NatM a -> (a -> NatM b) -> NatM b
1950 thenNat expr cont
1951hunk ./compiler/nativeGen/NCGMonad.hs 89
1952-       = NatM $ \st -> case unNat expr st of
1953-                       (result, st') -> unNat (cont result) st'
1954+    = NatM $ \st -> case unNat expr st of
1955+                     (result, st') -> unNat (cont result) st'
1956 
1957 returnNat :: a -> NatM a
1958 returnNat result
1959hunk ./compiler/nativeGen/NCGMonad.hs 94
1960-       = NatM $ \st ->  (result, st)
1961+    = NatM $ \st ->  (result, st)
1962 
1963 mapAccumLNat :: (acc -> x -> NatM (acc, y))
1964                 -> acc
1965hunk ./compiler/nativeGen/RegAlloc/Linear/State.hs 32
1966 )
1967 where
1968 
1969+import Control.Applicative (Applicative(..))
1970+
1971 import RegAlloc.Linear.Stats
1972 import RegAlloc.Linear.StackMap
1973 import RegAlloc.Linear.Base
1974hunk ./compiler/nativeGen/RegAlloc/Linear/State.hs 45
1975 import Unique
1976 import UniqSupply
1977 
1978+instance Functor RegM where
1979+  fmap f m = RegM $ \s -> case unReg m s of
1980+                            (# s', x #) -> (# s', f x #)
1981+
1982+instance Applicative RegM where
1983+  pure a   = RegM $ \s -> (# s, a #)
1984+  m <*> n  = RegM $ \s -> case unReg m s of
1985+                            (# s', f #) -> unReg (fmap f n) s'
1986 
1987 -- | The RegM Monad
1988 instance Monad RegM where
1989hunk ./compiler/nativeGen/RegAlloc/Linear/State.hs 56
1990-  m >>= k   =  RegM $ \s -> case unReg m s of { (# s, a #) -> unReg (k a) s }
1991-  return a  =  RegM $ \s -> (# s, a #)
1992+  m >>= k  = RegM $ \s -> case unReg m s of
1993+                            (# s', a #) -> unReg (k a) s'
1994+  return   = pure
1995 
1996 
1997 -- | Run a computation in the RegM register allocator monad.
1998hunk ./compiler/parser/Lexer.x 73
1999 import BasicTypes      ( InlineSpec(..), RuleMatchInfo(..) )
2000 import Util            ( readRational )
2001 
2002+import Control.Applicative (Applicative(..))
2003 import Control.Monad
2004 import Data.Bits
2005 import Data.Char
2006hunk ./compiler/parser/Lexer.x 1544
2007 
2008 newtype P a = P { unP :: PState -> ParseResult a }
2009 
2010+instance Functor ParseResult where
2011+  fmap f (POk s x)          = POk s (f x)
2012+  fmap _ (PFailed span err) = PFailed span err
2013+
2014+instance Functor P where
2015+  fmap   = mapP
2016+
2017+instance Applicative P where
2018+  pure   = returnP
2019+  (<*>)  = apP
2020+
2021 instance Monad P where
2022hunk ./compiler/parser/Lexer.x 1556
2023-  return = returnP
2024-  (>>=) = thenP
2025-  fail = failP
2026+  return = pure
2027+  (>>=)  = thenP
2028+  fail   = failP
2029+
2030+mapP :: (a -> b) -> P a -> P b
2031+mapP f p = P $ fmap f . unP p
2032+
2033+apP :: P (a -> b) -> P a -> P b
2034+apP pf px = P $ \s -> case unP pf s of
2035+                        POk s1 f -> unP (fmap f px) s1
2036+                        PFailed span err -> PFailed span err
2037 
2038 returnP :: a -> P a
2039 returnP a = a `seq` (P $ \s -> POk s a)
2040hunk ./compiler/profiling/SCCfinal.lhs 43
2041 import ListSetOps       ( removeDups )
2042 import Outputable
2043 import DynFlags
2044+
2045+import Control.Applicative ( Applicative(..) )
2046 \end{code}
2047 
2048 \begin{code}
2049hunk ./compiler/profiling/SCCfinal.lhs 325
2050                  -> (CollectedCCs, result)
2051     }
2052 
2053+instance Functor MassageM where
2054+    fmap   = mapMM
2055+
2056+instance Applicative MassageM where
2057+    pure   = pureMM
2058+    (<*>)  = apMM
2059+    (*>)   = thenMM_
2060+
2061 instance Monad MassageM where
2062hunk ./compiler/profiling/SCCfinal.lhs 334
2063-    return x = MassageM (\_ _ _ _ ccs -> (ccs, x))
2064-    (>>=) = thenMM
2065-    (>>)  = thenMM_
2066+    return = pure
2067+    (>>=)  = thenMM
2068+    (>>)   = (*>)
2069 
2070 -- the initMM function also returns the final CollectedCCs
2071 
2072hunk ./compiler/profiling/SCCfinal.lhs 347
2073 
2074 initMM mod_name init_us (MassageM m) = m mod_name noCCS init_us emptyVarSet ([],[],[])
2075 
2076+mapMM :: (a -> b) -> MassageM a -> MassageM b
2077+mapMM f m = MassageM $ \mod scope_cc us ids ccs ->
2078+            case unMassageM m mod scope_cc us ids ccs of
2079+              (ccs2, result) -> (ccs2, f result)
2080+
2081+apMM :: MassageM (a -> b) -> MassageM a -> MassageM b
2082+apMM mf mx = MassageM $ \mod scope_cc us ids ccs ->
2083+             case splitUniqSupply us of
2084+               (s1, s2) ->
2085+                   case unMassageM mf mod scope_cc s1 ids ccs of
2086+                     (ccs2, f) -> unMassageM (fmap f mx) mod scope_cc s2 ids ccs2
2087+
2088+pureMM :: a -> MassageM a
2089+pureMM x = MassageM $ \_ _ _ _ ccs -> (ccs, x)
2090+
2091 thenMM  :: MassageM a -> (a -> MassageM b) -> MassageM b
2092 thenMM_ :: MassageM a -> (MassageM b) -> MassageM b
2093 
2094hunk ./compiler/rename/RnPat.lhs 55
2095 import SrcLoc
2096 import FastString
2097 import Literal         ( inCharRange )
2098+import Control.Applicative ( Applicative(.. ) )
2099 import Control.Monad   ( when )
2100 \end{code}
2101 
2102hunk ./compiler/rename/RnPat.lhs 92
2103                                             -> RnM (r, FreeVars) }
2104        -- See Note [CpsRn monad]
2105 
2106+instance Functor CpsRn where
2107+  fmap f m  = CpsRn $ \k -> unCpsRn m $ k . f
2108+
2109+instance Applicative CpsRn where
2110+  pure x    = CpsRn $ \k -> k x
2111+  mf <*> mx = CpsRn $ \k -> unCpsRn mf $ \f -> unCpsRn (fmap f mx) k
2112+
2113 instance Monad CpsRn where
2114hunk ./compiler/rename/RnPat.lhs 100
2115-  return x = CpsRn (\k -> k x)
2116-  (CpsRn m) >>= mk = CpsRn (\k -> m (\v -> unCpsRn (mk v) k))
2117+  return    = pure
2118+  m >>= c   = CpsRn $ \k -> unCpsRn m $ \v -> unCpsRn (c v) k
2119 
2120 runCps :: CpsRn a -> RnM (a, FreeVars)
2121 runCps (CpsRn m) = m (\r -> return (r, emptyFVs))
2122hunk ./compiler/simplCore/SimplMonad.lhs 30
2123 import DynFlags                ( DynFlags )
2124 import CoreMonad
2125 import FastString
2126+
2127+import Control.Applicative ( Applicative(..) )
2128 \end{code}
2129 
2130 %************************************************************************
2131hunk ./compiler/simplCore/SimplMonad.lhs 68
2132   where
2133     env = STE { st_flags = dflags, st_rules = rules, st_fams = fam_envs }
2134 
2135+{-# INLINE mapSmpl #-}
2136+{-# INLINE apSmpl #-}
2137+{-# INLINE returnSmpl #-}
2138 {-# INLINE thenSmpl #-}
2139 {-# INLINE thenSmpl_ #-}
2140hunk ./compiler/simplCore/SimplMonad.lhs 73
2141-{-# INLINE returnSmpl #-}
2142+
2143+instance Functor SimplM where
2144+   fmap   = mapSmpl
2145+
2146+instance Applicative SimplM where
2147+   pure   = returnSmpl
2148+   (<*>)  = apSmpl
2149+   (*>)   = thenSmpl_
2150 
2151 instance Monad SimplM where
2152hunk ./compiler/simplCore/SimplMonad.lhs 83
2153-   (>>)   = thenSmpl_
2154    (>>=)  = thenSmpl
2155hunk ./compiler/simplCore/SimplMonad.lhs 84
2156-   return = returnSmpl
2157+   (>>)   = (*>)
2158+   return = pure
2159+
2160+mapSmpl :: (a -> b) -> SimplM a -> SimplM b
2161+mapSmpl f s = SM $ \st_env us0 sc0 ->
2162+                case unSM s st_env us0 sc0 of
2163+                  (x, us1, sc1) -> (f x, us1, sc1)
2164+
2165+apSmpl :: SimplM (a -> b) -> SimplM a -> SimplM b
2166+apSmpl sf sx = SM $ \st_env us0 sc0 ->
2167+                 case unSM sf st_env us0 sc0 of
2168+                   (f, us1, sc1) -> unSM (fmap f sx) st_env us1 sc1
2169 
2170 returnSmpl :: a -> SimplM a
2171hunk ./compiler/simplCore/SimplMonad.lhs 98
2172-returnSmpl e = SM (\_st_env us sc -> (e, us, sc))
2173+returnSmpl e = SM $ \_st_env us sc -> (e, us, sc)
2174 
2175 thenSmpl  :: SimplM a -> (a -> SimplM b) -> SimplM b
2176hunk ./compiler/simplCore/SimplMonad.lhs 101
2177-thenSmpl_ :: SimplM a -> SimplM b -> SimplM b
2178+thenSmpl m k = SM $ \st_env us0 sc0 ->
2179+                case (unSM m st_env us0 sc0) of
2180+                  (m_result, us1, sc1) -> unSM (k m_result) st_env us1 sc1
2181 
2182hunk ./compiler/simplCore/SimplMonad.lhs 105
2183-thenSmpl m k
2184-  = SM (\ st_env us0 sc0 ->
2185-         case (unSM m st_env us0 sc0) of
2186-               (m_result, us1, sc1) -> unSM (k m_result) st_env us1 sc1 )
2187-
2188-thenSmpl_ m k
2189-  = SM (\st_env us0 sc0 ->
2190-        case (unSM m st_env us0 sc0) of
2191-               (_, us1, sc1) -> unSM k st_env us1 sc1)
2192+thenSmpl_ :: SimplM a -> SimplM b -> SimplM b
2193+thenSmpl_ m k = SM $ \st_env us0 sc0 ->
2194+                 case (unSM m st_env us0 sc0) of
2195+                   (_, us1, sc1) -> unSM k st_env us1 sc1
2196 
2197 -- TODO: this specializing is not allowed
2198 -- {-# SPECIALIZE mapM         :: (a -> SimplM b) -> [a] -> SimplM [b] #-}
2199hunk ./compiler/stgSyn/CoreToStg.lhs 39
2200 import Util
2201 import ForeignCall
2202 import PrimOp           ( PrimCall(..) )
2203+
2204+import Control.Applicative ( Applicative(..) )
2205 \end{code}
2206 
2207 %************************************************************************
2208hunk ./compiler/stgSyn/CoreToStg.lhs 923
2209 
2210 
2211 
2212+{-# INLINE mapLne #-}
2213+{-# INLINE apLne #-}
2214 {-# INLINE thenLne #-}
2215 {-# INLINE returnLne #-}
2216 
2217hunk ./compiler/stgSyn/CoreToStg.lhs 928
2218+mapLne :: (a -> b) -> LneM a -> LneM b
2219+mapLne f l = LneM $ \env lvs_cont -> f $ unLneM l env lvs_cont
2220+
2221+apLne :: LneM (a -> b) -> LneM a -> LneM b
2222+apLne lf lx = LneM $ \env lvs_cont -> unLneM lf env lvs_cont $
2223+                                        unLneM lx env lvs_cont
2224+
2225 returnLne :: a -> LneM a
2226 returnLne e = LneM $ \_ _ -> e
2227 
2228hunk ./compiler/stgSyn/CoreToStg.lhs 942
2229 thenLne m k = LneM $ \env lvs_cont
2230   -> unLneM (k (unLneM m env lvs_cont)) env lvs_cont
2231 
2232+instance Functor LneM where
2233+    fmap   = mapLne
2234+
2235+instance Applicative LneM where
2236+    pure   = returnLne
2237+    (<*>)  = apLne
2238+
2239 instance Monad LneM where
2240hunk ./compiler/stgSyn/CoreToStg.lhs 950
2241-    return = returnLne
2242+    return = pure
2243     (>>=)  = thenLne
2244 
2245 instance MonadFix LneM where
2246hunk ./compiler/stgSyn/StgLint.lhs 30
2247 import SrcLoc
2248 import Outputable
2249 import FastString
2250+import Control.Applicative ( Applicative(..) )
2251 import Control.Monad
2252 \end{code}
2253 
2254hunk ./compiler/stgSyn/StgLint.lhs 323
2255         Just (vcat (punctuate blankLine (bagToList errs)))
2256     }
2257 
2258+instance Functor LintM where
2259+    fmap = mapL
2260+
2261+instance Applicative LintM where
2262+    pure a = LintM $ \_loc _scope errs -> (a, errs)
2263+    (<*>)  = apL
2264+    (*>)   = thenL_
2265+
2266 instance Monad LintM where
2267hunk ./compiler/stgSyn/StgLint.lhs 332
2268-    return a = LintM $ \_loc _scope errs -> (a, errs)
2269-    (>>=) = thenL
2270-    (>>)  = thenL_
2271+    return = pure
2272+    (>>=)  = thenL
2273+    (>>)   = (*>)
2274+
2275+mapL :: (a -> b) -> LintM a -> LintM b
2276+mapL f l = LintM $ \loc scope errs
2277+  -> case unLintM l loc scope errs of
2278+      (x, errs') -> (f x, errs')
2279+
2280+apL :: LintM (a -> b) -> LintM a -> LintM b
2281+apL lf lx = LintM $ \loc scope errs
2282+  -> case unLintM lf loc scope errs of
2283+      (f, errs') -> unLintM (fmap f lx) loc scope errs'
2284 
2285 thenL :: LintM a -> (a -> LintM b) -> LintM b
2286 thenL m k = LintM $ \loc scope errs
2287hunk ./compiler/typecheck/TcSMonad.lhs 117
2288 
2289 import TcRnTypes
2290 
2291+import Control.Applicative (Applicative(..))
2292 import Control.Monad
2293 import Data.IORef
2294 \end{code}
2295hunk ./compiler/typecheck/TcSMonad.lhs 491
2296 newtype TcS a = TcS { unTcS :: TcSEnv -> TcM a }
2297 
2298 instance Functor TcS where
2299-  fmap f m = TcS $ fmap f . unTcS m
2300+  fmap f m  = TcS $ fmap f . unTcS m
2301+
2302+instance Applicative TcS where
2303+  pure x    = TcS $ \_ -> pure x
2304+  mf <*> mx = TcS $ \ebs -> unTcS mf ebs <*> unTcS mx ebs
2305 
2306 instance Monad TcS where
2307hunk ./compiler/typecheck/TcSMonad.lhs 498
2308-  return x  = TcS (\_ -> return x)
2309-  fail err  = TcS (\_ -> fail err)
2310-  m >>= k   = TcS (\ebs -> unTcS m ebs >>= \r -> unTcS (k r) ebs)
2311+  return    = pure
2312+  fail err  = TcS $ \_ -> fail err
2313+  m >>= k   = TcS $ \ebs -> unTcS m ebs >>= \r -> unTcS (k r) ebs
2314 
2315 -- Basic functionality
2316 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2317hunk ./compiler/types/Unify.lhs 22
2318 
2319 #include "HsVersions.h"
2320 
2321+import Control.Applicative(Applicative(..))
2322+
2323 import Var
2324 import VarEnv
2325 import VarSet
2326hunk ./compiler/types/Unify.lhs 602
2327 newtype UM a = UM { unUM :: (TyVar -> BindFlag)
2328                         -> MaybeErr Message a }
2329 
2330+instance Functor UM where
2331+  fmap f m  = UM $ fmap f . unUM m
2332+
2333+instance Applicative UM where
2334+  pure a    = UM $ \_   -> pure a
2335+  mf <*> mx = UM $ \tvs -> unUM mf tvs <*> unUM mx tvs
2336+
2337 instance Monad UM where
2338hunk ./compiler/types/Unify.lhs 610
2339-  return a = UM (\_tvs -> Succeeded a)
2340-  fail s   = UM (\_tvs -> Failed (text s))
2341-  m >>= k  = UM (\tvs -> case unUM m tvs of
2342-                          Failed err -> Failed err
2343-                          Succeeded v  -> unUM (k v) tvs)
2344+  return a  = UM $ \_   -> Succeeded a
2345+  fail s    = UM $ \_   -> Failed (text s)
2346+  m >>= k   = UM $ \tvs -> case unUM m tvs of
2347+                            Failed err  -> Failed err
2348+                             Succeeded v -> unUM (k v) tvs
2349 
2350 initUM :: (TyVar -> BindFlag) -> UM a -> MaybeErr Message a
2351 initUM badtvs um = unUM um badtvs
2352hunk ./compiler/utils/Maybes.lhs 25
2353     ) where
2354 
2355 import Data.Maybe
2356+import Control.Applicative (Applicative(..), liftA2)
2357 
2358 infixr 4 `orElse`
2359 \end{code}
2360hunk ./compiler/utils/Maybes.lhs 103
2361 instance Functor m => Functor (MaybeT m) where
2362   fmap f x = MaybeT $ fmap (fmap f) $ runMaybeT x
2363 
2364+instance (Applicative m) => Applicative (MaybeT m) where
2365+  pure = MaybeT . pure . Just
2366+  mf <*> mx = MaybeT $ liftA2 (<*>) (runMaybeT mf) (runMaybeT mx)
2367+
2368 instance Monad m => Monad (MaybeT m) where
2369   return = MaybeT . return . Just
2370   x >>= f = MaybeT $ runMaybeT x >>= maybe (return Nothing) (runMaybeT . f)
2371hunk ./compiler/utils/Maybes.lhs 124
2372 \begin{code}
2373 data MaybeErr err val = Succeeded val | Failed err
2374 
2375+instance Functor (MaybeErr err) where
2376+  fmap f (Succeeded v) = Succeeded (f v)
2377+  fmap _ (Failed e)    = Failed e
2378+
2379+instance Applicative (MaybeErr err) where
2380+  pure v = Succeeded v
2381+  Succeeded f <*> m = fmap f m
2382+  Failed e    <*> _ = Failed e
2383+
2384 instance Monad (MaybeErr err) where
2385   return v = Succeeded v
2386   Succeeded v >>= k = k v
2387hunk ./compiler/utils/MonadUtils.hs 55
2388 -------------------------------------------------------------------------------
2389 
2390 newtype ID a = ID a
2391+
2392+instance Functor ID where
2393+  fmap f (ID x) = ID (f x)
2394+
2395+instance Applicative ID where
2396+  pure x        = ID x
2397+  ID f <*> ID x = ID (f x)
2398+  _     *> y    = y
2399+
2400 instance Monad ID where
2401hunk ./compiler/utils/MonadUtils.hs 65
2402-  return x     = ID x
2403+  return       = pure
2404   (ID x) >>= f = f x
2405   _ >> y       = y
2406   fail s       = panic s
2407hunk ./compiler/vectorise/Vectorise/Monad/Base.hs 31
2408 import DsMonad
2409 import Outputable
2410       
2411+import Control.Applicative ( Applicative(..) )
2412 
2413 -- The Vectorisation Monad ----------------------------------------------------
2414 -- | Vectorisation can either succeed with new envionment and a value,
2415hunk ./compiler/vectorise/Vectorise/Monad/Base.hs 39
2416 data VResult a
2417        = Yes GlobalEnv LocalEnv a | No
2418 
2419+instance Functor VResult where
2420+  fmap f (Yes genv lenv x) = Yes genv lenv (f x)
2421+  fmap _ No                = No
2422+
2423 newtype VM a
2424        = VM { runVM :: Builtins -> GlobalEnv -> LocalEnv -> DsM (VResult a) }
2425 
2426hunk ./compiler/vectorise/Vectorise/Monad/Base.hs 46
2427+instance Functor VM where
2428+  fmap f vm = VM $ \bi genv lenv -> fmap (fmap f) $ runVM vm bi genv lenv
2429+
2430+instance Applicative VM where
2431+  pure x = VM $ \_  genv lenv -> pure $ Yes genv lenv x
2432+  vmf <*> vmx = VM $ \bi genv lenv -> do
2433+                          r <- runVM vmf bi genv lenv
2434+                          case r of
2435+                            Yes genv' lenv' f -> runVM (fmap f vmx) bi genv' lenv'
2436+                            No                -> pure No
2437+
2438 instance Monad VM where
2439hunk ./compiler/vectorise/Vectorise/Monad/Base.hs 58
2440-  return x   = VM $ \_  genv lenv -> return (Yes genv lenv x)
2441+  return = pure
2442   VM p >>= f = VM $ \bi genv lenv -> do
2443                                       r <- p bi genv lenv
2444                                       case r of
2445hunk ./ghc/GhciMonad.hs 39
2446 import System.CPUTime
2447 import System.Environment
2448 import System.IO
2449+import Control.Applicative ( Applicative(..) )
2450 import Control.Monad as Monad
2451 import GHC.Exts
2452 
2453hunk ./ghc/GhciMonad.hs 148
2454 startGHCi :: GHCi a -> GHCiState -> Ghc a
2455 startGHCi g state = do ref <- liftIO $ newIORef state; unGHCi g ref
2456 
2457-instance Monad GHCi where
2458-  (GHCi m) >>= k  =  GHCi $ \s -> m s >>= \a -> unGHCi (k a) s
2459-  return a  = GHCi $ \_ -> return a
2460-
2461 instance Functor GHCi where
2462hunk ./ghc/GhciMonad.hs 149
2463-    fmap f m = m >>= return . f
2464+  fmap f m  = GHCi $ \s -> fmap f $ unGHCi m s
2465+
2466+instance Applicative GHCi where
2467+  pure a    = GHCi $ \_ -> pure a
2468+  mf <*> mx = GHCi $ \s -> unGHCi mf s <*> unGHCi mx s
2469+
2470+instance Monad GHCi where
2471+  m >>= k   = GHCi $ \s -> unGHCi m s >>= \a -> unGHCi (k a) s
2472+  return    = pure
2473 
2474 ghciHandleGhcException :: (GhcException -> GHCi a) -> GHCi a -> GHCi a
2475 ghciHandleGhcException = handleGhcException
2476hunk ./utils/ghc-pkg/Main.hs 35
2477 import Data.Maybe
2478 
2479 import Data.Char ( isSpace, toLower )
2480+import Control.Applicative ( Applicative(..) )
2481 import Control.Monad
2482 import System.Directory ( doesDirectoryExist, getDirectoryContents,
2483                           doesFileExist, renameFile, removeFile )
2484hunk ./utils/ghc-pkg/Main.hs 1167
2485 
2486 newtype Validate a = V { runValidate :: IO (a, [ValidateError],[ValidateWarning]) }
2487 
2488+instance Functor Validate where
2489+   fmap f v  = V $ fmap (\(x, es, ws) -> (f x, es, ws)) $ runValidate v
2490+
2491+instance Applicative Validate where
2492+   pure a    = V $ pure (a, [], [])
2493+   vf <*> vx = V $ do (f, es,  ws)  <- runValidate vf
2494+                      (x, es', ws') <- runValidate vx
2495+                      return (f x, es++es', ws++ws')
2496+
2497 instance Monad Validate where
2498hunk ./utils/ghc-pkg/Main.hs 1177
2499-   return a = V $ return (a, [], [])
2500-   m >>= k = V $ do
2501-      (a, es, ws) <- runValidate m
2502-      (b, es', ws') <- runValidate (k a)
2503-      return (b,es++es',ws++ws')
2504+   return    = pure
2505+   m >>= k   = V $ do (a, es, ws) <- runValidate m
2506+                      (b, es', ws') <- runValidate (k a)
2507+                      return (b,es++es',ws++ws')
2508 
2509 verror :: Force -> String -> Validate ()
2510 verror f s = V (return ((),[(f,s)],[]))
2511}
2512[Require happy >= 1.18.7
2513Bas van Dijk <v.dijk.bas@gmail.com>**20101211235020
2514 Ignore-this: 1114def3677767bda3c7692e86990498
2515 happy-1.18.7 generates needed Functor and Applicative instances for HappyIdentity
2516] hunk ./aclocal.m4 345
2517 ])
2518 if test ! -f compiler/parser/Parser.hs || test ! -f compiler/cmm/CmmParse.hs || test ! -f compiler/parser/ParserCore.hs
2519 then
2520-    FP_COMPARE_VERSIONS([$fptools_cv_happy_version],[-lt],[1.16],
2521-      [AC_MSG_ERROR([Happy version 1.16 or later is required to compile GHC.])])[]
2522+    FP_COMPARE_VERSIONS([$fptools_cv_happy_version],[-lt],[1.18.7],
2523+      [AC_MSG_ERROR([Happy version 1.18.7 or later is required to compile GHC.])])[]
2524 fi
2525 HappyVersion=$fptools_cv_happy_version;
2526 AC_SUBST(HappyVersion)
2527
2528Context:
2529
2530[Fix Trac #4534: renamer bug
2531simonpj@microsoft.com**20101210084530
2532 Ignore-this: 8163bfa3a56344cfe89ad17c62e9655d
2533   
2534 The renamer wasn't attaching the right used-variables to a
2535 TransformStmt constructor.
2536 
2537 The real modification is in RnExpr; the rest is just
2538 pretty-printing and white space.
2539]
2540[White space only
2541simonpj@microsoft.com**20101210084255
2542 Ignore-this: 3fcf8a4fc8c15052c379a135951d53ea
2543]
2544[Comments only
2545simonpj@microsoft.com**20101210084116
2546 Ignore-this: 55bb1de129b1c9513751885eaa84b884
2547]
2548[Make the case-to-let transformation a little less eager
2549simonpj@microsoft.com**20101208172251
2550 Ignore-this: 55eaa1b5753af31aeb32ec792cb6b662
2551 
2552 See Note [Case elimination: lifted case].
2553 Thanks to Roman for identifying this case.
2554]
2555[warning fix: don't redefine BLOCKS_PER_MBLOCK
2556Simon Marlow <marlowsd@gmail.com>**20101210094002
2557 Ignore-this: cadba57f1c38f5e2af1de37d0a79c7ee
2558]
2559[Only reset the event log if logging is turned on (addendum to #4512)
2560Simon Marlow <marlowsd@gmail.com>**20101210093951
2561 Ignore-this: c9f85f0de2b11a37337672fba59aecc6
2562]
2563[allocate enough room for the longer filename (addendum to #4512)
2564Simon Marlow <marlowsd@gmail.com>**20101210093906
2565 Ignore-this: 270dc0219d98f1e0f9e006102ade7087
2566]
2567[Fix Windows build: move rtsTimerSignal to the POSIX-only section
2568Simon Marlow <marlowsd@gmail.com>**20101210090045
2569 Ignore-this: aa1844b70b9f1a44447787c4bbe10d44
2570]
2571[Default the value of -dppr-cols when the static flags aren't initialised yet
2572Ben Lippmeier <benl@ouroborus.net>**20101210060154
2573 Ignore-this: 4cea29085ef904f379a8829714c9e180
2574 If GHC's command line options are bad then the options parser uses the
2575 pretty printer before the -dppr-cols flag has been read.
2576]
2577[Defensify naked read in LLVM mangler
2578Ben Lippmeier <benl@ouroborus.net>**20101210045922
2579 Ignore-this: 1373f597863851bd03e7a7254558ed04
2580]
2581[Formatting only
2582Ben Lippmeier <benl@ouroborus.net>**20101210042600
2583 Ignore-this: 20bbcd95c70b59094d0bb8a63e459103
2584]
2585[Always ppr case alts on separate lines
2586Ben Lippmeier <benl@ouroborus.net>**20101208070508
2587 Ignore-this: 7e2edd57a61427621aeb254aef84f0f7
2588]
2589[Add -dppr-colsN to set width of dumps
2590Ben Lippmeier <benl@ouroborus.net>**20101208070245
2591 Ignore-this: edc64fee6c373b895bb80b83b549ce1a
2592]
2593[Add -dppr-case-as-let to print "strict lets" as actual lets
2594Ben Lippmeier <benl@ouroborus.net>**20101208065548
2595 Ignore-this: eb1d122dbd73b5263cae3a9f8259a838
2596]
2597[Suppress more info with -dsuppress-idinfo
2598Ben Lippmeier <benl@ouroborus.net>**20101208063037
2599 Ignore-this: 5e8213d7b8d2905e245917aa3e83efc5
2600]
2601[Implement -dsuppress-type-signatures
2602Ben Lippmeier <benl@ouroborus.net>**20101208062814
2603 Ignore-this: 34dbefe5f8d7fe58ecb26d6a748d1c71
2604]
2605[Add more suppression flags
2606Ben Lippmeier <benl@ouroborus.net>**20101208020723
2607 Ignore-this: b010ba9789a2fde6b815f33494fcc23c
2608  -dsuppress-all
2609  -dsuppress-type-applications
2610  -dsuppress-idinfo
2611]
2612[fix ticket number (#4505)
2613Simon Marlow <marlowsd@gmail.com>**20101209120404
2614 Ignore-this: 5769c5ce2a8d69d62d977a9ae138ec23
2615]
2616[fix warnings
2617Simon Marlow <marlowsd@gmail.com>**20101209115844
2618 Ignore-this: ffff37feb2abbfc5bd12940c7007c208
2619]
2620[Catch too-large allocations and emit an error message (#4505)
2621Simon Marlow <marlowsd@gmail.com>**20101209114005
2622 Ignore-this: c9013ab63dd0bd62ea045060528550c6
2623 
2624 This is a temporary measure until we fix the bug properly (which is
2625 somewhat tricky, and we think might be easier in the new code
2626 generator).
2627 
2628 For now we get:
2629 
2630 ghc-stage2: sorry! (unimplemented feature or known bug)
2631   (GHC version 7.1 for i386-unknown-linux):
2632         Trying to allocate more than 1040384 bytes.
2633 
2634 See: http://hackage.haskell.org/trac/ghc/ticket/4550
2635 Suggestion: read data from a file instead of having large static data
2636 structures in the code.
2637]
2638[Export the value of the signal used by scheduler (#4504)
2639Dmitry Astapov <dastapov@gmail.com>**20101208183755
2640 Ignore-this: 427bf8c2469283fc7a6f759440d07d87
2641]
2642[Tweak the "sorry" message a bit
2643Simon Marlow <marlowsd@gmail.com>**20101208163212
2644 Ignore-this: aa1ce5bc3c27111548204b740572efbe
2645 
2646 -              "sorry! (this is work in progress)\n"
2647 +              "sorry! (unimplemented feature or known bug)\n"
2648]
2649[:unset settings support
2650Boris Lykah <lykahb@gmail.com>**20101123190132
2651 Ignore-this: 5e97c99238f5d2394592858c34c004d
2652 Added support for settings [args, prog, prompt, editor and stop].
2653 Now :unset supports the same set of options as :set.
2654]
2655[Fix Windows memory freeing: add a check for fb == NULL; fixes trac #4506
2656Ian Lynagh <igloo@earth.li>**20101208152349
2657 Also added a few comments, and a load of code got indented 1 level deeper.
2658]
2659[Fixes for #4512: EventLog.c - provides ability to terminate event logging, Schedule.c - uses them in forkProcess.
2660Dmitry Astapov <dastapov@gmail.com>**20101203133950
2661 Ignore-this: 2da7f215d6c22708a18291a416ba8881
2662]
2663[Fix up TcInstDcls
2664simonpj@microsoft.com**20101203180758
2665 Ignore-this: 9311aeb4ee67c799704afec90b5982d0
2666 
2667 I really don't know how this module got left out of my last
2668 patch, namely
2669   Thu Dec  2 12:35:47 GMT 2010  simonpj@microsoft.com
2670   * Re-jig simplifySuperClass (again)
2671 
2672 I suggest you don't pull either the patch above, or this
2673 one, unless you really have to.  I'm not fully confident
2674 that it works properly yet.  Ran out of time. Sigh.
2675]
2676[Make CPPFLAGS variables, as well as CFLAGS and LDFLAGS
2677Ian Lynagh <igloo@earth.li>**20101207010033
2678 Ignore-this: 2fc1ca1422aae1988d0fe1d29a8485d9
2679 This fixes the "does unsetenv return void" test in the unix package on
2680 OS X, if I tell it to make 10.4-compatible binaries. The test uses
2681 CPPFLAGS but not CFLAGS, so it thought it returned int (as it was
2682 in 10.5-mode), but the C compiler (using CFLAGS, so in 10.4 mode)
2683 thought it returned void.
2684 
2685 I also added CONF_LD_OPTS_STAGE$3 to the list of things in LDFLAGS,
2686 which looks like an accidental ommission.
2687]
2688[Add a configure message
2689Ian Lynagh <igloo@earth.li>**20101206215201]
2690[Link even programs containing no Haskell modules with GHC
2691Ian Lynagh <igloo@earth.li>**20101206203329
2692 I don't remember why we made it use gcc instead, but going back to
2693 using ghc doesn't seem to break anything, and should fix the build
2694 on OS X 10.6.
2695]
2696[Correct the stage that the includes/ tools are built in
2697Ian Lynagh <igloo@earth.li>**20101206203125]
2698[Tweak the cleaning of inplace/; fixes trac #4320
2699Ian Lynagh <igloo@earth.li>**20101205212048]
2700[Close .ghci files after reading them; fixes trac #4487
2701Ian Lynagh <igloo@earth.li>**20101205205301]
2702[Fix the behaviour of :history for ticks surrounding top level functions
2703pepeiborra@gmail.com**20101203202346
2704 Ignore-this: 8059d4859c52c0c9a235b937cb8cde1d
2705]
2706[Don't warn of duplicate exports in case of module exports.
2707Michal Terepeta <michal.terepeta@gmail.com>**20101127212116
2708 Ignore-this: ea225d517826f971c400bbb68d1405b8
2709 
2710 But only when the module exports refer to different modules.
2711 See ticket #4478.
2712]
2713[Fix whitespace/layout in RnNames.
2714Michal Terepeta <michal.terepeta@gmail.com>**20101030171303
2715 Ignore-this: 707a7955fc4fc51683cc5a1dfe57f93
2716]
2717[Tell gcc to support back to OS X 10.5
2718Ian Lynagh <igloo@earth.li>**20101203201558
2719 Ignore-this: f02d70e5b9cce50137981c6cb2b62a18
2720]
2721[Make RelaxedLayout off by default
2722Ian Lynagh <igloo@earth.li>**20101202140808
2723 I suspect this is a vary rarely used extension to the official layout
2724 rule.
2725]
2726[throwTo: report the why_blocked value in the barf()
2727Simon Marlow <marlowsd@gmail.com>**20101203094840
2728 Ignore-this: 3b167c581be1c51dfe3586cc6359e1d0
2729]
2730[handle ThreadMigrating in throwTo() (#4811)
2731Simon Marlow <marlowsd@gmail.com>**20101203094818
2732 Ignore-this: 8ef8cb7fd3b50a27f83c29968131d461
2733 If a throwTo targets a thread that has just been created with
2734 forkOnIO, then it is possible the exception strikes while the thread
2735 is still in the process of migrating.  throwTo() didn't handle this
2736 case, but it's fairly straightforward.
2737]
2738[removeThreadFromQueue: stub out the link field before returning (#4813)
2739Simon Marlow <marlowsd@gmail.com>**20101202160838
2740 Ignore-this: 653ae17bc1120d7f4130da94665002a1
2741]
2742[small tidyup
2743Simon Marlow <marlowsd@gmail.com>**20101126140620
2744 Ignore-this: 70b1d5ed4c81a7b29dd5980a2d84aae1
2745]
2746[Fix a recomp bug: make classes/datatypes depend directly on DFuns (#4469)
2747Simon Marlow <marlowsd@gmail.com>**20101202122349
2748 Ignore-this: 61c765583bb1d97caa88cf9b4f45b87c
2749 And remove the old mechanism of recording dfun uses separately,
2750 because it didn't work.
2751 
2752 This wiki page describes recompilation avoidance and fingerprinting.
2753 I'll update it to describe the new method and what went wrong with the
2754 old method:
2755 
2756 http://hackage.haskell.org/trac/ghc/wiki/Commentary/Compiler/RecompilationAvoidance
2757]
2758[make a panic message more informative and suggest -dcore-lint (see #4534)
2759Simon Marlow <marlowsd@gmail.com>**20101201151706
2760 Ignore-this: 2a10761925d6f9f52675948baa30f7a
2761]
2762[Re-jig simplifySuperClass (again)
2763simonpj@microsoft.com**20101202123547
2764 Ignore-this: fe4062b8988258f6748ebd8fbd6515b5
2765 
2766 This fixes the current loop in T3731, and will fix other
2767 reported loops.  The loops show up when we are generating
2768 evidence for superclasses in an instance declaration.
2769 
2770 The trick is to make the "self" dictionary simplifySuperClass
2771 depend *explicitly* on the superclass we are currently trying
2772 to build.  See Note [Dependencies in self dictionaries] in TcSimplify.
2773 
2774 That in turn means that EvDFunApp needs a dependency-list, used
2775 when chasing dependencies in isGoodRecEv.
2776]
2777[A little refactoring (remove redundant argument passed to isGoodRecEv)
2778simonpj@microsoft.com**20101202123110
2779 Ignore-this: e517c5c12109a230f08dafb4d1e386df
2780]
2781[Make rebindable if-then-else a little more permissive
2782simonpj@microsoft.com**20101202122540
2783 Ignore-this: ddb552cfe307607b42d1e4baf4e3bf21
2784 
2785 See Note [Rebindable syntax for if].  Fixes Trac #4798.
2786 Thanks to Nils Schweinsberg <mail@n-sch.de>
2787]
2788[Improve error message (Trac #4799)
2789simonpj@microsoft.com**20101202102706
2790 Ignore-this: d9896e4d182936de1f256c820b96a8cf
2791]
2792[Fix a nasty bug in RULE matching: Trac #4814
2793simonpj@microsoft.com**20101202102618
2794 Ignore-this: ba058ad46a02bd2faf3a14de93fd19c6
2795 
2796 See Note [Matching lets], which explains it all in detail.
2797 It took me a day to think of a nice way to fix the bug,
2798 but I think the result is quite respectable. Subtle, though.
2799]
2800[Rename -XPArr to -XParallelArrays
2801Ben Lippmeier <benl@ouroborus.net>**20101130075415
2802 Ignore-this: 21b37680a7f25800d1200b59ad0b6b39
2803]
2804[FIX #1845 (unconditional relative branch out of range)
2805pho@cielonegro.org**20101130143014
2806 Ignore-this: df234bd8ad937104c455656fe3c33732
2807 
2808 Don't use mmap on powerpc-apple-darwin as mmap doesn't support
2809 reallocating but we need to allocate jump islands just after each
2810 object images. Otherwise relative branches to jump islands can fail
2811 due to 24-bits displacement overflow.
2812]
2813[rts/Linker.c (loadArchive):
2814pho@cielonegro.org**20101130142700
2815 Ignore-this: bc84f9369ce5c2d289440701b7a3a2ab
2816 
2817 This routine should be aware of Mach-O misalignment of malloc'ed memory regions.
2818]
2819[rts/Linker.c (machoGetMisalignment):
2820pho@cielonegro.org**20101130123355
2821 Ignore-this: 75425600049efd587e9873578e26392f
2822 
2823 Use fseek(3) instead of rewind(3) to move the file position indicator back to the initial position. Otherwise we can't use this function in loadArchive().
2824]
2825[rts/Linker.c (ocFlushInstructionCache):
2826pho@cielonegro.org**20101130121425
2827 Ignore-this: 1e2c207e4b1d17387617ec5d645204b7
2828 
2829 I found this function causes a segfault when ocAllocateSymbolExtras() has allocated a separate memory region for jump islands.
2830]
2831[Remove NewQualifiedOperators
2832Ian Lynagh <igloo@earth.li>**20101201181117
2833 The extension was rejected by Haskell', and deprecated in 7.0.
2834]
2835[fix ref to utils/ext-core, which moved to Hackage (extcore package)
2836Simon Marlow <marlowsd@gmail.com>**20101201092147
2837 Ignore-this: 272a7daaa335ef60bcc645db70b4d68b
2838]
2839[fix floating-point/FFI section: fenv is C99, not POSIX
2840Simon Marlow <marlowsd@gmail.com>**20101201092119
2841 Ignore-this: ce8b3edd428e4f77691dd739b5b4ae73
2842]
2843[Fixed some 'unused vars' warnings
2844keller@cse.unsw.edu.au**20101130013425
2845 Ignore-this: 35790d443faa23b87e4ba442e62376a3
2846]
2847[vectScalarLam handles int, float, and double now
2848keller@cse.unsw.edu.au**20101129231043
2849 Ignore-this: 6d67bdc8dd8577184040e791e6f3d0
2850]
2851[Handling of lets, letrec and case when checking if a lambda expr needs to be vectorised
2852keller@cse.unsw.edu.au**20101115051225
2853 Ignore-this: 1db6ed63d7b3f6d093e019322b407ff7
2854]
2855[Document the behaviour of fenv.h functions with GHC (#4391)
2856Simon Marlow <marlowsd@gmail.com>**20101126125336
2857 Ignore-this: bc4eab49428d567505a28add6fed90f1
2858]
2859[Remove the no-ghci-lib warning in ghc-pkg
2860Ian Lynagh <igloo@earth.li>**20101127235805
2861 GHCi libs are no longer necessary, as we can use the .a or .so versions
2862 instead.
2863]
2864[Add GNU-variant support to the .a parser, and other improvements/tidyups
2865Ian Lynagh <igloo@earth.li>**20101127223945]
2866[Re-indent only
2867Ian Lynagh <igloo@earth.li>**20101127191646]
2868[Improve linker debugging for archive files
2869Ian Lynagh <igloo@earth.li>**20101127190907]
2870[Always enable the archive-loading code
2871Ian Lynagh <igloo@earth.li>**20101127173000
2872 If the GHCi .o lib doesn't exist, load the .a instead
2873]
2874[Inherit the ForceSpecConstr flag in non-recursive nested bindings
2875Roman Leshchinskiy <rl@cse.unsw.edu.au>**20101127125025
2876 Ignore-this: 401391eae25cefcb4afaba2e357decc1
2877 
2878 This makes sure that join points are fully specialised in loops which are
2879 marked as ForceSpecConstr.
2880]
2881[Document -ddump-rule-firings and -ddump-rule-rewrites
2882Roman Leshchinskiy <rl@cse.unsw.edu.au>**20101127123528
2883 Ignore-this: beade2efe0cd767c0ce9d4f45a3380ba
2884]
2885[New flag -dddump-rule-rewrites
2886Roman Leshchinskiy <rl@cse.unsw.edu.au>**20101127122022
2887 Ignore-this: c0ef5b8a199fbd1ef020258d2cde85a3
2888 
2889 Now, -ddump-rule-firings only shows the names of the rules that fired (it would
2890 show "before" and "after" with -dverbose-core2core previously) and
2891 -ddump-rule-rewrites always shows the "before" and "after" bits, even without
2892 -dverbose-core2core.
2893]
2894[Acutally, wild-card variables *can* have occurrences
2895simonpj@microsoft.com**20101126162409
2896 Ignore-this: 544bffed75eeccef03a1097f98524eea
2897 
2898 This patch removes the Lint test, and comments why
2899]
2900[Tidy up the handling of wild-card binders, and make Lint check it
2901simonpj@microsoft.com**20101126133210
2902 Ignore-this: 9e0be9f7867d53046ee5b0e478a0f433
2903 
2904 See Note [WildCard binders] in SimplEnv.  Spotted by Roman.
2905]
2906[Substitution should just substitute, not optimise
2907simonpj@microsoft.com**20101125172356
2908 Ignore-this: 657628d9b6796ceb5f915c43d56e4a06
2909 
2910 This was causing Trac #4524, by optimising
2911      (e |> co)  to   e
2912 on the LHS of a rule.  Result, the template variable
2913 'co' wasn't bound any more.
2914 
2915 Now that substition doesn't optimise, it seems sensible to call
2916 simpleOptExpr rather than substExpr when substituting in the
2917 RHS of rules.  Not a big deal either way.
2918]
2919[Make SpecConstr "look through" identity coercions
2920simonpj@microsoft.com**20101125172138
2921 Ignore-this: c1cc585ed890a7702c33987e971e0af6
2922]
2923[Comment only
2924simonpj@microsoft.com**20101125172011
2925 Ignore-this: 3c7be8791badd00dcca9610ebb8981d1
2926]
2927[White space only
2928simonpj@microsoft.com**20101101080748
2929 Ignore-this: f7133fc6b22ae263c6672543a8534a6f
2930]
2931[Keep a maximum of 6 spare worker threads per Capability (#4262)
2932Simon Marlow <marlowsd@gmail.com>**20101125135729
2933 Ignore-this: a020786569656bf2f3a1717b65d463bd
2934]
2935[Unicide OtherNumber category should be allowed in identifiers (#4373)
2936Simon Marlow <marlowsd@gmail.com>**20101115095444
2937 Ignore-this: e331b6ddb17550163ee91bd283348800
2938]
2939[vectoriser: fix warning
2940Ben Lippmeier <benl@ouroborus.net>**20101126044036
2941 Ignore-this: e1a66bb405bf2f3f56b42c3b13fd4bf3
2942]
2943[vectoriser: fix warning
2944Ben Lippmeier <benl@ouroborus.net>**20101126042950
2945 Ignore-this: df8dd25bcfb3946c2974b13953a2f2c7
2946]
2947[vectoriser: take class directly from the instance tycon
2948Ben Lippmeier <benl@ouroborus.net>**20101126042900
2949 Ignore-this: 626a416717a5a059f39e53f4ec95fc66
2950]
2951[vectoriser: comments only
2952Ben Lippmeier <benl@ouroborus.net>**20101125073201
2953 Ignore-this: 8846ea8895307083bd1ebbc5d7fb1c5
2954]
2955[vectoriser: follow changes in mkClass
2956Ben Lippmeier <benl@ouroborus.net>**20101125062349
2957 Ignore-this: d5018cc022686d4272e126ca9a12283a
2958]
2959[vectoriser: tracing wibbles
2960Ben Lippmeier <benl@ouroborus.net>**20101125062332
2961 Ignore-this: c2024d8f03bc03bee2851f4f1c139fd5
2962]
2963[mkDFunUnfolding wants the type of the dfun to be a PredTy
2964benl@ouroborus.net**20100914062939
2965 Ignore-this: 7aa6e6b140746184cf00355b50c83b66
2966]
2967[vectoriser: fix conflicts
2968Ben Lippmeier <benl@ouroborus.net>**20101125060904
2969 Ignore-this: cc3decab1affada8629ca3818b76b3bf
2970]
2971[Comments and formatting only
2972benl@ouroborus.net**20100914062903
2973 Ignore-this: b0fc25f0952cafd56cc25353936327d4
2974]
2975[Comments and formatting to type environment vectoriser
2976benl@ouroborus.net**20100909080405
2977 Ignore-this: ab8549d53f845c9d82ed9a525fda3906
2978]
2979[Don't mix implicit and explicit layout
2980Ian Lynagh <igloo@earth.li>**20101124231514]
2981[Whitespace only
2982Ian Lynagh <igloo@earth.li>**20101124230655]
2983[Separate NondecreasingIndentation out into its own extension
2984Ian Lynagh <igloo@earth.li>**20101124220507]
2985[Add another GHC layout rule relaxation to RelaxedLayout
2986Ian Lynagh <igloo@earth.li>**20101124205957]
2987[Remove an unused build system variable: GhcDir
2988Ian Lynagh <igloo@earth.li>**20101124140455]
2989[Remove unused build system variable: GhcHasEditline
2990Ian Lynagh <igloo@earth.li>**20101124140415]
2991[Remove unused variables from the build system: HBC, NHC, MKDEPENDHS
2992Ian Lynagh <igloo@earth.li>**20101124140052]
2993[Remove references to Haskell 98
2994Ian Lynagh <igloo@earth.li>**20101123233536
2995 They are no longer right, as we have Haskell' generating new Haskell
2996 standards.
2997]
2998[Tweak a configure test
2999Ian Lynagh <igloo@earth.li>**20101123170621]
3000[Add a configure test for the visibility hidden attribute
3001Ian Lynagh <igloo@earth.li>**20101123170541]
3002[sanity: fix places where we weren't filling fresh memory with 0xaa
3003Simon Marlow <marlowsd@gmail.com>**20101029092843
3004 Ignore-this: 2cb18f7f5afcaf33371aeffce67e218f
3005]
3006[Just some alpha renaming
3007Ian Lynagh <igloo@earth.li>**20101121144455
3008 Ignore-this: d5e807c5470840efc199e29f7d50804c
3009]
3010[Fix bug #3165 (:history throws irrefutable pattern failed)
3011pepeiborra@gmail.com**20101115223623
3012 Ignore-this: 73edf56e502b4d0385bc044133b27946
3013 
3014 I ran across this bug and took the time to fix it, closing
3015 a long time due TODO in InteractiveEval.hs
3016 
3017 Instead of looking around to find the enclosing declaration
3018 of a tick, this patch makes use of the information already collected during the
3019 coverage desugaring phase
3020]
3021[For bindists, build ghc-pwd with stage 1
3022Ian Lynagh <igloo@earth.li>**20101121183520
3023 Ignore-this: a3b5c8b78c81ec1b6d5fbf23da346ff5
3024 rather then the bootstrapping compiler. This fixes problems where the
3025 bootstrapping compiler dynamically links against libraries not on the
3026 target machine.
3027]
3028[Makefile tweak
3029Ian Lynagh <igloo@earth.li>**20101121183342
3030 Ignore-this: cd55a2819c1a5fd36da1bc7a75d2ded1
3031]
3032[Fix a makefile include ordering sanity check
3033Ian Lynagh <igloo@earth.li>**20101121174916
3034 Ignore-this: d0bdd41c4b618944d04ecb4f54fdd0f1
3035]
3036[Add an extension for GHC's layout-rule relaxations
3037Ian Lynagh <igloo@earth.li>**20101120215340
3038 Still TODO: Add the other relaxation (#1060) and update the alternative
3039 layout rule to use the extension.
3040]
3041[Tweak the bindist configure.ac.in
3042Ian Lynagh <igloo@earth.li>**20101120173735]
3043[configure.ac tweaks
3044Ian Lynagh <igloo@earth.li>**20101120170245]
3045[When testing the bindist, tell it where gcc is
3046Ian Lynagh <igloo@earth.li>**20101120155920
3047 The location isn't baked into the bindist, as it may differ from
3048 machine to machine.
3049]
3050[Comments only
3051simonpj@microsoft.com**20101119100153
3052 Ignore-this: 7abd5d965ea805770449d6f8dadbb921
3053]
3054[ForceSpecConstr now forces specialisation even for arguments which aren't scrutinised
3055Roman Leshchinskiy <rl@cse.unsw.edu.au>**20101118212839
3056 Ignore-this: db45721d29a694e53746f8b76513efa4
3057]
3058[Move the superclass generation to the canonicaliser
3059simonpj@microsoft.com**20101118120533
3060 Ignore-this: 5e0e525402a240b709f2b8104c1682b2
3061 
3062 Doing superclass generation in the canonicaliser (rather than
3063 TcInteract) uses less code, and is generally more efficient.
3064 
3065 See Note [Adding superclasses] in TcCanonical.
3066 
3067 Fixes Trac #4497.
3068]
3069[Fix the generation of in-scope variables for IfaceLint check
3070simonpj@microsoft.com**20101118090057
3071 Ignore-this: bbcdba61ddf89d07fe69ca99c2017e3f
3072]
3073[Comments only
3074simonpj@microsoft.com**20101118090034
3075 Ignore-this: fa2936d35a0f7be4e4535ea9e2b7bf7b
3076]
3077[Omit bogus test for -XDeriveFunctor
3078simonpj@microsoft.com**20101118090028
3079 Ignore-this: a534243011809ebbb788b910961601c5
3080 
3081 It was duplicated in the case of 'deriving( Functor )'
3082 and wrong for 'deriving( Foldable )'
3083]
3084[Improve error message on advice from a user
3085simonpj@microsoft.com**20101118085306
3086 Ignore-this: bd4f3858ff24e602e985288f27d536f3
3087 
3088 See Trac #4499
3089]
3090[TAG 2010-11-18
3091Ian Lynagh <igloo@earth.li>**20101118011554
3092 Ignore-this: ccadbe7fadd1148d2ee3caa8c8821ec5
3093]
3094Patch bundle hash:
309558498bfbdf308f6f10f2944769ff382993bf971d