[Git][ghc/ghc][wip/geekosaur/clarify-cpp-2] 4 commits: Improve heap overflow exception message (#25198)

Brandon S. Allbery (@geekosaur) gitlab at gitlab.haskell.org
Thu Oct 24 12:26:48 UTC 2024



Brandon S. Allbery pushed to branch wip/geekosaur/clarify-cpp-2 at Glasgow Haskell Compiler / GHC


Commits:
6ab8d751 by ignatiusm at 2024-10-24T01:23:35-04:00
Improve heap overflow exception message (#25198)

Catch heap overflow exceptions and suggest using `+RTS -M<size>`.

Fix #25198

- - - - -
b3f7fb80 by Rodrigo Mesquita at 2024-10-24T01:24:12-04:00
determinism: Interface re-export list det

In 'DocStructureItem' we want to make sure the 'Avails' are sorted, for
interface file determinism. This commit introduces 'DetOrdAvails', a
newtype that should only be constructed by sorting Avails with
'sortAvails' unless the avails are known to be deterministically
ordered. This newtype is used by 'DocStructureItem' where 'Avails' was
previously used to ensure the list of avails is deterministically sorted
by construction.

Note: Even though we order the constructors and avails in the interface
file, the order of constructors in the haddock output is still
determined from the order of declaration in the source. This was also
true before, when the list of constructors in the interface file <docs>
section was non-deterministic. Some haddock tests such as
"ConstructorArgs" observe this (check the order of constructors in
out/ConstructorArgs.html vs src/ConstructorArgs.hs vs its interface file)

The updated tests are caused by haddock corners where the order in the
source is not preserved (and was non-deterministic before this PR):
    * Module header in the latex backend
    * Re-export of pattern synonyms associated to a datatype (#25342)

Fixes #25304

- - - - -
e39c8c99 by Rodrigo Mesquita at 2024-10-24T01:24:12-04:00
Revert "ci: Allow abi-test to fail."

After #25304, the abi-test with interface and object determinism
succeeds.

This reverts commit 7b37afc9f3e79559055488998ee73187886a0e00.

- - - - -
c20fc3dd by brandon s allbery kf8nh at 2024-10-24T08:26:27-04:00
further explanations of CPP options

It was missing the ANSI "token pasting" behavior, which affects
users of -XMagicHash. It also explains why clang's -traditional
isn't sufficient for preprocessing Haskell code.

- - - - -


25 changed files:

- .gitlab-ci.yml
- .gitlab/ci.sh
- compiler/GHC.hs
- compiler/GHC/Hs/Doc.hs
- compiler/GHC/HsToCore/Docs.hs
- compiler/GHC/Iface/Make.hs
- compiler/GHC/SysTools/Cpp.hs
- compiler/GHC/Types/Avail.hs
- docs/users_guide/9.14.1-notes.rst
- + testsuite/tests/determinism/T25304/A.hs
- + testsuite/tests/determinism/T25304/B.hs
- + testsuite/tests/determinism/T25304/Makefile
- + testsuite/tests/determinism/T25304/T25304a.stdout
- + testsuite/tests/determinism/T25304/all.T
- + testsuite/tests/rts/T25198/T25198.hs
- + testsuite/tests/rts/T25198/T25198.stderr
- + testsuite/tests/rts/T25198/all.T
- testsuite/tests/showIface/DocsInHiFileTH.stdout
- testsuite/tests/showIface/NoExportList.stdout
- utils/haddock/haddock-api/src/Haddock/Interface/Create.hs
- utils/haddock/html-test/ref/BundledPatterns2.html
- utils/haddock/latex-test/ref/ConstructorArgs/ConstructorArgs.tex
- utils/haddock/latex-test/ref/DefaultSignatures/DefaultSignatures.tex
- utils/haddock/latex-test/ref/GadtConstructorArgs/GadtConstructorArgs.tex
- utils/haddock/latex-test/ref/TypeFamilies3/TypeFamilies3.tex


Changes:

=====================================
.gitlab-ci.yml
=====================================
@@ -1007,8 +1007,6 @@ perf:
 ############################################################
 
 abi-test:
-  # see #12935 for remaining work
-  allow_failure: true
   stage: testing
   needs:
     - job: x86_64-linux-fedora33-release


=====================================
.gitlab/ci.sh
=====================================
@@ -714,11 +714,11 @@ function cabal_abi_test() {
 
   start_section "Cabal test: $OUT"
   mkdir -p "$OUT"
-  run "$HC" \
+  "$HC" \
     -hidir tmp -odir tmp -fforce-recomp -haddock \
     -iCabal/Cabal/src -XNoPolyKinds Distribution.Simple -j"$cores" \
     -fobject-determinism \
-    "$@" 2>&1 | tee $OUT/log
+    "$@" 2>&1 | sed '1d' | tee $OUT/log
   summarise_hi_files
   summarise_o_files
   popd


=====================================
compiler/GHC.hs
=====================================
@@ -483,6 +483,8 @@ defaultErrorHandler fm (FlushOut flushOut) inner =
                          liftIO $ throwIO UserInterrupt
                      Just StackOverflow ->
                          fm "stack overflow: use +RTS -K<size> to increase it"
+                     Just HeapOverflow ->
+                         fm "heap overflow: use +RTS -M<size> to increase maximum heap size"
                      _ -> case fromException exception of
                           Just (ex :: ExitCode) -> liftIO $ throwIO ex
                           _ ->


=====================================
compiler/GHC/Hs/Doc.hs
=====================================
@@ -124,7 +124,7 @@ data DocStructureItem
   = DsiSectionHeading !Int !(HsDoc GhcRn)
   | DsiDocChunk !(HsDoc GhcRn)
   | DsiNamedChunkRef !String
-  | DsiExports !Avails
+  | DsiExports !DetOrdAvails
   | DsiModExport
       !(NonEmpty ModuleName) -- ^ We might re-export avails from multiple
                             -- modules with a single export declaration. E.g.
@@ -136,7 +136,7 @@ data DocStructureItem
                             --
                             -- Invariant: This list of ModuleNames must be
                             -- sorted to guarantee interface file determinism.
-      !Avails
+      !DetOrdAvails
                             -- ^ Invariant: This list of Avails must be sorted
                             -- to guarantee interface file determinism.
 


=====================================
compiler/GHC/HsToCore/Docs.hs
=====================================
@@ -163,7 +163,11 @@ mkDocStructureFromExportList mdl import_avails export_list =
       (IEGroup _ level doc, _)         -> DsiSectionHeading level (unLoc doc)
       (IEDoc _ doc, _)                 -> DsiDocChunk (unLoc doc)
       (IEDocNamed _ name, _)           -> DsiNamedChunkRef name
-      (_, avails)                      -> DsiExports (nubAvails avails)
+      (IEThingWith{}, avails)          ->
+        DsiExports $
+          {- For explicit export lists, use the explicit order. It is deterministic by construction -}
+          DefinitelyDeterministicAvails (nubAvails avails)
+      (_, avails)                      -> DsiExports (sortAvails (nubAvails avails))
 
     moduleExport :: ModuleName -- Alias
                  -> Avails
@@ -204,10 +208,10 @@ mkDocStructureFromDecls env all_exports decls =
     avails :: [Located DocStructureItem]
     avails = flip fmap all_exports $ \avail ->
       case M.lookup (availName avail) name_locs of
-        Just loc -> L loc (DsiExports [avail])
+        Just loc -> L loc (DsiExports (sortAvails [avail]))
         -- FIXME: This is just a workaround that we use when handling e.g.
         -- associated data families like in the html-test Instances.hs.
-        Nothing -> noLoc (DsiExports [])
+        Nothing -> noLoc (DsiExports (sortAvails []))
 
         -- This causes the associated data family to be incorrectly documented
         -- separately from its class:


=====================================
compiler/GHC/Iface/Make.hs
=====================================
@@ -518,8 +518,8 @@ mkIfaceImports = map go
     go (ImpUserSpec decl (ImpUserExplicit env)) = IfaceImport decl (ImpIfaceExplicit (forceGlobalRdrEnv env))
     go (ImpUserSpec decl (ImpUserEverythingBut ns)) = IfaceImport decl (ImpIfaceEverythingBut ns)
 
-mkIfaceExports :: [AvailInfo] -> [IfaceExport]  -- Sort to make canonical
-mkIfaceExports = sortAvails
+mkIfaceExports :: [AvailInfo] -> [IfaceExport] -- Sort to make canonical
+mkIfaceExports as = case sortAvails as of DefinitelyDeterministicAvails sas -> sas
 
 {-
 Note [Original module]


=====================================
compiler/GHC/SysTools/Cpp.hs
=====================================
@@ -72,17 +72,25 @@ Haskell source. This avoids the following situations:
 
   * Errors due to an ANSI C preprocessor lexing the source and failing on
     names with single quotes (TH quotes, ticked promoted constructors,
-    names with primes in them).
+    names with primes in them);
 
-  Both of those cases may be subtle: gcc and clang permit C++-style //
-  comments in C code, and Data.Array and Data.Vector both export a //
-  operator whose type is such that a removed "comment" may leave code that
-  typechecks but does the wrong thing. Another example is that, since ANSI
-  C permits long character constants, an expression involving multiple
-  functions with primes in their names may not expand macros properly when
-  they occur between the primed functions.
+  * Errors due to ANSI "token pasting" semantics, which are triggered by
+    "#" characters (which affects code using -XMagicHash).
 
-Third special type of preprocessor for JavaScript was added laterly due to
+All of those cases may be subtle: gcc and clang permit C++-style //
+comments in C code, and Data.Array and Data.Vector both export a //
+operator whose type is such that a removed "comment" may leave code that
+typechecks but does the wrong thing. Another example is that, since ANSI
+C permits long character constants, an expression involving multiple
+functions with primes in their names may not expand macros properly when
+they occur between the primed functions.
+
+It should be noted that clang's -traditional doesn't disable // or token
+pasting; as a result, the ghc runtime installer tries very hard to find a
+gcc in order to use its preprocessor. If one can't be found, a programmer's
+only recourse is to use "-pgmP cpphs" (cpphs is on Hackage).
+
+A third special type of preprocessor for JavaScript was added later, due to
 needing to keep JSDoc comments and multiline comments. Various third party
 minifying software (for example, Google Closure Compiler) uses JSDoc
 information to apply more strict rules to code reduction which results in


=====================================
compiler/GHC/Types/Avail.hs
=====================================
@@ -1,5 +1,7 @@
 
 {-# LANGUAGE DeriveDataTypeable #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE PatternSynonyms #-}
 --
 -- (c) The University of Glasgow
 --
@@ -20,6 +22,7 @@ module GHC.Types.Avail (
     filterAvails,
     nubAvails,
     sortAvails,
+    DetOrdAvails(DetOrdAvails, DefinitelyDeterministicAvails)
   ) where
 
 import GHC.Prelude
@@ -65,6 +68,20 @@ data AvailInfo
 -- | A collection of 'AvailInfo' - several things that are \"available\"
 type Avails = [AvailInfo]
 
+-- | Occurrences of Avails in interface files must be deterministically ordered
+-- to guarantee interface file determinism.
+--
+-- We guarantee a deterministic order by either using the order explicitly
+-- given by the user (e.g. in an explicit constructor export list) or instead
+-- by sorting the avails with 'sortAvails'.
+newtype DetOrdAvails = DefinitelyDeterministicAvails Avails
+  deriving newtype (Binary, Outputable, NFData)
+
+-- | It's always safe to match on 'DetOrdAvails'
+pattern DetOrdAvails :: Avails -> DetOrdAvails
+pattern DetOrdAvails x <- DefinitelyDeterministicAvails x
+{-# COMPLETE DetOrdAvails #-}
+
 {- Note [Representing pattern synonym fields in AvailInfo]
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Record pattern synonym fields cannot be represented using AvailTC like fields of
@@ -133,8 +150,8 @@ availSubordinateNames avail@(AvailTC _ ns)
   | otherwise              = ns
 
 -- | Sort 'Avails'/'AvailInfo's
-sortAvails :: Avails -> Avails
-sortAvails = sortBy stableAvailCmp . map sort_subs
+sortAvails :: Avails -> DetOrdAvails
+sortAvails = DefinitelyDeterministicAvails . sortBy stableAvailCmp . map sort_subs
   where
     sort_subs :: AvailInfo -> AvailInfo
     sort_subs (Avail n) = Avail n


=====================================
docs/users_guide/9.14.1-notes.rst
=====================================
@@ -23,6 +23,8 @@ Language
 Compiler
 ~~~~~~~~
 
+- An improved error message is introduced to refer users to the heap-controlling flags of the RTS when there is a heap overflow during compilation. (#25198)
+
 GHCi
 ~~~~
 


=====================================
testsuite/tests/determinism/T25304/A.hs
=====================================
@@ -0,0 +1,84 @@
+module A
+  ( MyType(..)
+  ) where
+
+data MyType
+    = A
+    | B
+    | C
+    | D
+    | E
+    | F
+    | G
+    | H
+    | I
+    | J
+    | K
+    | L
+    | M
+    | N
+    | O
+    | P
+    | Q
+    | R
+    | S
+    | T
+    | U
+    | V
+    | W
+    | X
+    | Y
+    | Z
+    | AA
+    | AB
+    | AC
+    | AD
+    | AE
+    | AF
+    | AG
+    | AH
+    | AI
+    | AJ
+    | AK
+    | AL
+    | AM
+    | AN
+    | AO
+    | AP
+    | AQ
+    | AR
+    | AS
+    | AT
+    | AU
+    | AV
+    | AW
+    | AX
+    | AY
+    | AZ
+    | BA
+    | BB
+    | BC
+    | BD
+    | BE
+    | BF
+    | BG
+    | BH
+    | BI
+    | BJ
+    | BK
+    | BL
+    | BM
+    | BN
+    | BO
+    | BP
+    | BQ
+    | BR
+    | BS
+    | BT
+    | BU
+    | BV
+    | BW
+    | BX
+    | BY
+    | BZ
+    | CA


=====================================
testsuite/tests/determinism/T25304/B.hs
=====================================
@@ -0,0 +1,86 @@
+module B
+( MyType
+    ( BA
+    , BB
+    , BC
+    , BD
+    , BE
+    , BF
+    , BG
+    , BH
+    , BI
+    , BJ
+    , BK
+    , BL
+    , BM
+    , BN
+    , BO
+    , BP
+    , BQ
+    , BR
+    , BS
+    , BT
+    , BU
+    , BV
+    , BW
+    , BX
+    , BY
+    , BZ
+    , CA
+    , AA
+    , AB
+    , AC
+    , AD
+    , AE
+    , AF
+    , AG
+    , AH
+    , AI
+    , AJ
+    , AK
+    , AL
+    , AM
+    , AN
+    , AO
+    , AP
+    , AQ
+    , AR
+    , AS
+    , AT
+    , AU
+    , AV
+    , AW
+    , AX
+    , AY
+    , AZ
+    , A
+    , B
+    , C
+    , D
+    , E
+    , F
+    , G
+    , H
+    , I
+    , J
+    , K
+    , L
+    , M
+    , N
+    , O
+    , P
+    , Q
+    , R
+    , S
+    , T
+    , U
+    , V
+    , W
+    , X
+    , Y
+    , Z
+    )
+) where
+
+import A
+


=====================================
testsuite/tests/determinism/T25304/Makefile
=====================================
@@ -0,0 +1,25 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+T25304:
+	$(RM) A.hi A.o B.hi B.o
+	# Use -haddock to get docs: output in the interface file
+	'$(TEST_HC)' $(TEST_HC_OPTS) -v0 -haddock B.hs
+	'$(TEST_HC)' --show-iface A.hi > A_clean_iface
+	'$(TEST_HC)' --show-iface B.hi > B_clean_iface
+	'$(TEST_HC)' $(TEST_HC_OPTS) -dinitial-unique=16777215 -dunique-increment=-1 -v0 -haddock A.hs B.hs -fforce-recomp
+	'$(TEST_HC)' --show-iface A.hi > A_dirty_iface
+	'$(TEST_HC)' --show-iface B.hi > B_dirty_iface
+	diff A_clean_iface A_dirty_iface
+	diff B_clean_iface B_dirty_iface
+
+T25304a:
+	$(RM) A.hi A.o B.hi B.o
+	# Use -haddock to get docs: output in the interface file
+	'$(TEST_HC)' $(TEST_HC_OPTS) -v0 -haddock B.hs
+	'$(TEST_HC)' --show-iface B.hi > B_clean_iface
+	# The goal is to see the export list in the documentation structure of the
+	# interface file preserves the order used in the source
+	cat B_clean_iface | grep -A7 "documentation structure"
+


=====================================
testsuite/tests/determinism/T25304/T25304a.stdout
=====================================
@@ -0,0 +1,8 @@
+       documentation structure:
+         avails:
+           [A.MyType{A.MyType, A.BA, A.BB, A.BC, A.BD, A.BE, A.BF, A.BG, A.BH,
+                     A.BI, A.BJ, A.BK, A.BL, A.BM, A.BN, A.BO, A.BP, A.BQ, A.BR, A.BS,
+                     A.BT, A.BU, A.BV, A.BW, A.BX, A.BY, A.BZ, A.CA, A.AA, A.AB, A.AC,
+                     A.AD, A.AE, A.AF, A.AG, A.AH, A.AI, A.AJ, A.AK, A.AL, A.AM, A.AN,
+                     A.AO, A.AP, A.AQ, A.AR, A.AS, A.AT, A.AU, A.AV, A.AW, A.AX, A.AY,
+                     A.AZ, A.A, A.B, A.C, A.D, A.E, A.F, A.G, A.H, A.I, A.J, A.K, A.L,


=====================================
testsuite/tests/determinism/T25304/all.T
=====================================
@@ -0,0 +1,2 @@
+test('T25304', [extra_files(['A.hs', 'B.hs'])], makefile_test, ['T25304'])
+test('T25304a', [extra_files(['A.hs', 'B.hs'])], makefile_test, ['T25304a'])


=====================================
testsuite/tests/rts/T25198/T25198.hs
=====================================
@@ -0,0 +1,12 @@
+{-# LANGUAGE TemplateHaskell #-}
+import Control.Exception
+import Language.Haskell.TH
+
+-- Generate a very large number of declarations
+generateDecls :: Int -> Q [Dec]
+generateDecls n = mapM (\i -> valD (varP (mkName ("x" ++ show i))) (normalB [| i |]) []) [1..n]
+
+main :: IO ()
+main = do
+  $(generateDecls 1000000)
+  print x1


=====================================
testsuite/tests/rts/T25198/T25198.stderr
=====================================
@@ -0,0 +1 @@
+heap overflow: use +RTS -M<size> to increase maximum heap size


=====================================
testsuite/tests/rts/T25198/all.T
=====================================
@@ -0,0 +1,4 @@
+test('T25198',
+     normal,
+     compile_fail,
+     ['+RTS -M8M -RTS'])


=====================================
testsuite/tests/showIface/DocsInHiFileTH.stdout
=====================================
@@ -187,7 +187,7 @@ docs:
          avails:
            [i]
          avails:
-           [WD11{WD11, WD11Bool, WD11Int, WD11Foo}]
+           [WD11{WD11, WD11Bool, WD11Foo, WD11Int}]
          avails:
            [WD13{WD13}]
          avails:
@@ -221,11 +221,11 @@ docs:
          avails:
            [Pretty{Pretty, prettyPrint}]
          avails:
-           [Corge{Corge, runCorge, Corge}]
+           [Corge{Corge, Corge, runCorge}]
          avails:
-           [Quuz{Quuz, quuz1_a, Quuz}]
+           [Quuz{Quuz, Quuz, quuz1_a}]
          avails:
-           [Quux{Quux, Quux2, Quux1}]
+           [Quux{Quux, Quux1, Quux2}]
          avails:
            [Tup2]
          avails:


=====================================
testsuite/tests/showIface/NoExportList.stdout
=====================================
@@ -32,7 +32,7 @@ docs:
 -- Actually we have only one type.
            identifiers:
          avails:
-           [R{R, fβ, fα, R}]
+           [R{R, R, fα, fβ}]
          section heading, level 1:
            text:
              -- * Functions


=====================================
utils/haddock/haddock-api/src/Haddock/Interface/Create.hs
=====================================
@@ -201,7 +201,15 @@ createInterface1' flags unit_state dflags hie_file mod_iface ifaces inst_ifaces
   -- See Note [Exporting built-in items]
   let builtinTys = DsiSectionHeading 1 (WithHsDocIdentifiers (mkGeneratedHsDocString "Builtin syntax") [])
       bonus_ds mods
-        | mdl == gHC_PRIM = [builtinTys, DsiExports funAvail] <> mods
+        | mdl == gHC_PRIM =
+            [ builtinTys
+            , DsiExports $
+                {- Haddock does not want to sort avails, the order should be
+                    deterministically /derived from the source/.
+                   In this particular case, sorting funAvail would be a no-op anyway. -}
+                DefinitelyDeterministicAvails
+                  funAvail
+            ] <> mods
         | otherwise = mods
 
   let
@@ -461,11 +469,11 @@ mkExportItems
             Just hsDoc' -> do
               doc <- processDocStringParas parserOpts sDocContext pkgName hsDoc'
               pure [ExportDoc doc]
-        DsiExports avails ->
+        DsiExports (DetOrdAvails avails) ->
           -- TODO: We probably don't need nubAvails here.
           -- mkDocStructureFromExportList already uses it.
           concat <$> traverse availExport (nubAvails avails)
-        DsiModExport mod_names avails -> do
+        DsiModExport mod_names (DetOrdAvails avails) -> do
           -- only consider exporting a module if we are sure we are really
           -- exporting the whole module and not some subset.
           (unrestricted_mods, remaining_avails) <- unrestrictedModExports sDocContext thisMod modMap instIfaceMap avails (NE.toList mod_names)


=====================================
utils/haddock/html-test/ref/BundledPatterns2.html
=====================================
@@ -96,14 +96,6 @@
 	      >where</span
 	      ><ul class="subs"
 	      ><li
-		><span class="keyword"
-		  >pattern</span
-		  > <a href="#"
-		  >LR</a
-		  > :: a -> <a href="#" title="BundledPatterns2"
-		  >RTree</a
-		  > 0 a</li
-		><li
 		><span class="keyword"
 		  >pattern</span
 		  > <a href="#"
@@ -117,6 +109,14 @@
 		  > (d <a href="#" title="GHC.TypeLits"
 		  >+</a
 		  > 1) a</li
+		><li
+		><span class="keyword"
+		  >pattern</span
+		  > <a href="#"
+		  >LR</a
+		  > :: a -> <a href="#" title="BundledPatterns2"
+		  >RTree</a
+		  > 0 a</li
 		></ul
 	      ></li
 	    ></ul
@@ -318,28 +318,34 @@
 	      ><td class="src"
 		><span class="keyword"
 		  >pattern</span
-		  > <a id="v:LR" class="def"
-		  >LR</a
-		  > :: a -> <a href="#" title="BundledPatterns2"
+		  > <a id="v:BR" class="def"
+		  >BR</a
+		  > :: <a href="#" title="BundledPatterns2"
 		  >RTree</a
-		  > 0 a</td
+		  > d a -> <a href="#" title="BundledPatterns2"
+		  >RTree</a
+		  > d a -> <a href="#" title="BundledPatterns2"
+		  >RTree</a
+		  > (d <a href="#" title="GHC.TypeLits"
+		  >+</a
+		  > 1) a</td
 		><td class="doc"
 		><p
-		  >Leaf of a perfect depth tree</p
+		  >Branch of a perfect depth tree</p
 		  ><pre class="screen"
 		  ><code class="prompt"
 		    >>>> </code
 		    ><strong class="userinput"
 		    ><code
-		      >LR 1
+		      >BR (LR 1) (LR 2)
 </code
 		      ></strong
-		    >1
+		    ><1,2>
 <code class="prompt"
 		    >>>> </code
 		    ><strong class="userinput"
 		    ><code
-		      >let x = LR 1
+		      >let x = BR (LR 1) (LR 2)
 </code
 		      ></strong
 		    ><code class="prompt"
@@ -349,16 +355,16 @@
 		      >:t x
 </code
 		      ></strong
-		    >x :: Num a => RTree 0 a
+		    >x :: Num a => RTree 1 a
 </pre
 		  ><p
-		  >Can be used as a pattern:</p
+		  >Case be used a pattern:</p
 		  ><pre class="screen"
 		  ><code class="prompt"
 		    >>>> </code
 		    ><strong class="userinput"
 		    ><code
-		      >let f (LR a) (LR b) = a + b
+		      >let f (BR (LR a) (LR b)) = LR (a + b)
 </code
 		      ></strong
 		    ><code class="prompt"
@@ -368,12 +374,12 @@
 		      >:t f
 </code
 		      ></strong
-		    >f :: Num a => RTree 0 a -> RTree 0 a -> a
+		    >f :: Num a => RTree 1 a -> RTree 0 a
 <code class="prompt"
 		    >>>> </code
 		    ><strong class="userinput"
 		    ><code
-		      >f (LR 1) (LR 2)
+		      >f (BR (LR 1) (LR 2))
 </code
 		      ></strong
 		    >3
@@ -384,34 +390,28 @@
 	      ><td class="src"
 		><span class="keyword"
 		  >pattern</span
-		  > <a id="v:BR" class="def"
-		  >BR</a
-		  > :: <a href="#" title="BundledPatterns2"
-		  >RTree</a
-		  > d a -> <a href="#" title="BundledPatterns2"
-		  >RTree</a
-		  > d a -> <a href="#" title="BundledPatterns2"
+		  > <a id="v:LR" class="def"
+		  >LR</a
+		  > :: a -> <a href="#" title="BundledPatterns2"
 		  >RTree</a
-		  > (d <a href="#" title="GHC.TypeLits"
-		  >+</a
-		  > 1) a</td
+		  > 0 a</td
 		><td class="doc"
 		><p
-		  >Branch of a perfect depth tree</p
+		  >Leaf of a perfect depth tree</p
 		  ><pre class="screen"
 		  ><code class="prompt"
 		    >>>> </code
 		    ><strong class="userinput"
 		    ><code
-		      >BR (LR 1) (LR 2)
+		      >LR 1
 </code
 		      ></strong
-		    ><1,2>
+		    >1
 <code class="prompt"
 		    >>>> </code
 		    ><strong class="userinput"
 		    ><code
-		      >let x = BR (LR 1) (LR 2)
+		      >let x = LR 1
 </code
 		      ></strong
 		    ><code class="prompt"
@@ -421,16 +421,16 @@
 		      >:t x
 </code
 		      ></strong
-		    >x :: Num a => RTree 1 a
+		    >x :: Num a => RTree 0 a
 </pre
 		  ><p
-		  >Case be used a pattern:</p
+		  >Can be used as a pattern:</p
 		  ><pre class="screen"
 		  ><code class="prompt"
 		    >>>> </code
 		    ><strong class="userinput"
 		    ><code
-		      >let f (BR (LR a) (LR b)) = LR (a + b)
+		      >let f (LR a) (LR b) = a + b
 </code
 		      ></strong
 		    ><code class="prompt"
@@ -440,12 +440,12 @@
 		      >:t f
 </code
 		      ></strong
-		    >f :: Num a => RTree 1 a -> RTree 0 a
+		    >f :: Num a => RTree 0 a -> RTree 0 a -> a
 <code class="prompt"
 		    >>>> </code
 		    ><strong class="userinput"
 		    ><code
-		      >f (BR (LR 1) (LR 2))
+		      >f (LR 1) (LR 2)
 </code
 		      ></strong
 		    >3


=====================================
utils/haddock/latex-test/ref/ConstructorArgs/ConstructorArgs.tex
=====================================
@@ -3,7 +3,7 @@
 \haddockbeginheader
 {\haddockverb\begin{verbatim}
 module ConstructorArgs (
-    Foo((:|), Rec, x, y, Baz, Boa, (:*)), Boo(Foo, Foa, Fo, Fo'), pattern Bo,
+    Foo((:*), (:|), Baz, Boa, Rec, x, y), Boo(Foo, Foa, Fo, Fo'), pattern Bo,
     pattern Bo'
   ) where\end{verbatim}}
 \haddockendheader


=====================================
utils/haddock/latex-test/ref/DefaultSignatures/DefaultSignatures.tex
=====================================
@@ -3,7 +3,7 @@
 \haddockbeginheader
 {\haddockverb\begin{verbatim}
 module DefaultSignatures (
-    Foo(baz', baz, bar)
+    Foo(bar, baz, baz')
   ) where\end{verbatim}}
 \haddockendheader
 


=====================================
utils/haddock/latex-test/ref/GadtConstructorArgs/GadtConstructorArgs.tex
=====================================
@@ -3,7 +3,7 @@
 \haddockbeginheader
 {\haddockverb\begin{verbatim}
 module GadtConstructorArgs (
-    Boo(Fot, x, y, Fob, w, z)
+    Boo(Fob, Fot, w, x, y, z)
   ) where\end{verbatim}}
 \haddockendheader
 


=====================================
utils/haddock/latex-test/ref/TypeFamilies3/TypeFamilies3.tex
=====================================
@@ -3,7 +3,7 @@
 \haddockbeginheader
 {\haddockverb\begin{verbatim}
 module TypeFamilies3 (
-    Foo, Bar, Baz(Baz3, Baz2, Baz1)
+    Foo, Bar, Baz(Baz1, Baz2, Baz3)
   ) where\end{verbatim}}
 \haddockendheader
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/69b6c8e72c63a5fedb61aa4da06e3c4948a9f2cc...c20fc3ddc7538e01ff2039dc5ba4f64b8cf2344f

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/69b6c8e72c63a5fedb61aa4da06e3c4948a9f2cc...c20fc3ddc7538e01ff2039dc5ba4f64b8cf2344f
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20241024/ab287db2/attachment-0001.html>


More information about the ghc-commits mailing list