diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2015-01-06 17:25:17 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2015-01-06 17:25:17 +0000 |
commit | b0f8cb8aa3422fd0a7cef8eee630333fd9911d2f (patch) | |
tree | 602dfaee534b28824571463e1341d6aee1bf4f7e /utils/genprimopcode | |
parent | d57f507f6961494a23d88f748c030c5346250a3c (diff) | |
download | haskell-b0f8cb8aa3422fd0a7cef8eee630333fd9911d2f.tar.gz |
Another fix to genprimopcode, when generating Prim.hs
When haddock processes Prim.hs, it was calling TcEnv.tcGetDefaultTys,
and that made it look for Integer and String, which are not in
ghc-prim. Result was a crash.
But we don't need defaulting in Prim.hs, so add
default ()
Diffstat (limited to 'utils/genprimopcode')
-rw-r--r-- | utils/genprimopcode/Main.hs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/utils/genprimopcode/Main.hs b/utils/genprimopcode/Main.hs index 7d5205ad9a..ed4871c5b4 100644 --- a/utils/genprimopcode/Main.hs +++ b/utils/genprimopcode/Main.hs @@ -245,12 +245,14 @@ gen_hs_source (Info defaults entries) = ++ "{-# LANGUAGE MultiParamTypeClasses #-}\n" ++ "{-# LANGUAGE NoImplicitPrelude #-}\n" ++ "{-# LANGUAGE UnboxedTuples #-}\n" + ++ "{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}\n" -- We generate a binding for coerce, like -- coerce :: Coercible a b => a -> b -- coerce = let x = x in x -- and we don't want a complaint that the constraint is redundant -- Remember, this silly file is only for Haddock's consumption + ++ "module GHC.Prim (\n" ++ unlines (map ((" " ++) . hdr) entries') ++ ") where\n" @@ -259,7 +261,21 @@ gen_hs_source (Info defaults entries) = ++ unlines (map opt defaults) ++ "-}\n" ++ "import GHC.Types (Coercible)\n" - ++ unlines (concatMap ent entries') ++ "\n\n\n" + + ++ "default ()" -- If we don't say this then the default type include Integer + -- so that runs off and loads modules that are not part of + -- pacakge ghc-prim at all. And that in turn somehow ends up + -- with Declaration for $fEqMaybe: + -- attempting to use module ‘GHC.Classes’ + -- (libraries/ghc-prim/./GHC/Classes.hs) which is not loaded + -- coming from LoadIface.homeModError + -- I'm not sure precisely why; but I *am* sure that we don't need + -- any type-class defaulting; and it's clearly wrong to need + -- the base package when haddocking ghc-prim + + -- Now the main payload + ++ unlines (concatMap ent entries') ++ "\n\n\n" + where entries' = concatMap desugarVectorSpec entries opt (OptionFalse n) = n ++ " = False" |