aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock/Interface/AttachInstances.hs
diff options
context:
space:
mode:
authoralexbiehl <alexbiehl@gmail.com>2021-02-09 12:56:15 +0100
committerSylvain Henry <sylvain@haskus.fr>2021-02-11 10:32:32 +0100
commit7e8c7c3491f3e769368b8e6c767c62a33e996c80 (patch)
treed4f9fd9e559bd21735eaea0c35a9579893d8556c /haddock-api/src/Haddock/Interface/AttachInstances.hs
parentcf7d06b8ac0f47d6ff1c2d3decdb6a50a0fd7502 (diff)
Also make TyLit deterministic
Diffstat (limited to 'haddock-api/src/Haddock/Interface/AttachInstances.hs')
-rw-r--r--haddock-api/src/Haddock/Interface/AttachInstances.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/haddock-api/src/Haddock/Interface/AttachInstances.hs b/haddock-api/src/Haddock/Interface/AttachInstances.hs
index d5b80888..530c5690 100644
--- a/haddock-api/src/Haddock/Interface/AttachInstances.hs
+++ b/haddock-api/src/Haddock/Interface/AttachInstances.hs
@@ -28,6 +28,7 @@ import Data.Maybe ( maybeToList, mapMaybe, fromMaybe )
import qualified Data.Map as Map
import qualified Data.Set as Set
+import GHC.Data.FastString (unpackFS)
import GHC.Core.Class
import GHC.Driver.Session
import GHC.Core (isOrphan)
@@ -194,7 +195,9 @@ instance Ord SName where
-- For the benefit of the user (looks nice and predictable) and the
-- tests (which prefer output to be deterministic).
data SimpleType = SimpleType SName [SimpleType]
- | SimpleTyLit TyLit
+ | SimpleIntTyLit Integer
+ | SimpleStringTyLit String
+ | SimpleCharTyLit Char
deriving (Eq,Ord)
@@ -218,7 +221,9 @@ simplify (AppTy t1 t2) = SimpleType s (ts ++ maybeToList (simplify_maybe t2))
simplify (TyVarTy v) = SimpleType (SName (tyVarName v)) []
simplify (TyConApp tc ts) = SimpleType (SName (tyConName tc))
(mapMaybe simplify_maybe ts)
-simplify (LitTy l) = SimpleTyLit l
+simplify (LitTy (NumTyLit n)) = SimpleIntTyLit n
+simplify (LitTy (StrTyLit s)) = SimpleStringTyLit (unpackFS s)
+simplify (LitTy (CharTyLit c)) = SimpleCharTyLit c
simplify (CastTy ty _) = simplify ty
simplify (CoercionTy _) = error "simplify:Coercion"