Pattern synonyms across modules broken in Haddock
Create modules as follows
-- PatSymDef.hs
{-# Language PatternSynonyms #-}
module PatSymDef where
pattern Some a = Just a
-- PatSymUse.hs
{-# Language PatternSynonyms #-}
module PatSymUse where
import PatSymDef
f :: Maybe Int -> Int
f (Some a) = a
f Nothing = 0
Then run Haddock against them:
[nix-shell:~/programming/haddock]$ ./dist/build/haddock/haddock -h /tmp/PatSymUse.hs /tmp/PatSymDef.hs -o /tmp
Haddock coverage:
Warning: Not found in environment: Some
50% ( 1 / 2) in 'PatSymDef'
/tmp/PatSymUse.hs:9:4:
Can't find interface-file declaration for data constructor Some
Probable cause: bug in .hi-boot file, or inconsistent .hi file
Use -ddump-if-trace to get an idea of which file caused the error
In the pattern: Some a
In an equation for ‘f’: f (Some a) = a
Here with -ddump-if-trace:
[nix-shell:~/programming/haddock]$ ./dist/build/haddock/haddock -h /tmp/PatSymUse.hs /tmp/PatSymDef.hs -o /tmp --optghc='-ddump-if-trace'
Haddock coverage:
Considering whether to load base:Prelude
Reading interface for base:Prelude;
reason: Prelude is directly imported
readIFace /nix/store/m347lhn3g6sh2s9pv7kz68qs2jyhzphg-ghc-7.9.20140805/lib/ghc-7.9.20140805/base_DiPQ1siqG3SBjHauL3L03p/Prelude.hi
readIFace /nix/store/m347lhn3g6sh2s9pv7kz68qs2jyhzphg-ghc-7.9.20140805/lib/ghc-7.9.20140805/base_DiPQ1siqG3SBjHauL3L03p/Prelude.dyn_hi
updating EPS_
updating EPS_
Considering whether to load base:GHC.Base {- SYSTEM -}
Reading interface for base:GHC.Base;
reason: Loading orphan modules (base:GHC.Base)
readIFace /nix/store/m347lhn3g6sh2s9pv7kz68qs2jyhzphg-ghc-7.9.20140805/lib/ghc-7.9.20140805/base_DiPQ1siqG3SBjHauL3L03p/GHC/Base.hi
readIFace /nix/store/m347lhn3g6sh2s9pv7kz68qs2jyhzphg-ghc-7.9.20140805/lib/ghc-7.9.20140805/base_DiPQ1siqG3SBjHauL3L03p/GHC/Base.dyn_hi
updating EPS_
Considering whether to load base:GHC.Float {- SYSTEM -}
Reading interface for base:GHC.Float;
reason: Loading orphan modules (base:GHC.Float)
readIFace /nix/store/m347lhn3g6sh2s9pv7kz68qs2jyhzphg-ghc-7.9.20140805/lib/ghc-7.9.20140805/base_DiPQ1siqG3SBjHauL3L03p/GHC/Float.hi
readIFace /nix/store/m347lhn3g6sh2s9pv7kz68qs2jyhzphg-ghc-7.9.20140805/lib/ghc-7.9.20140805/base_DiPQ1siqG3SBjHauL3L03p/GHC/Float.dyn_hi
updating EPS_
Considering whether to load base:GHC.Real {- SYSTEM -}
Reading interface for base:GHC.Real;
reason: Loading orphan modules (base:GHC.Real)
readIFace /nix/store/m347lhn3g6sh2s9pv7kz68qs2jyhzphg-ghc-7.9.20140805/lib/ghc-7.9.20140805/base_DiPQ1siqG3SBjHauL3L03p/GHC/Real.hi
readIFace /nix/store/m347lhn3g6sh2s9pv7kz68qs2jyhzphg-ghc-7.9.20140805/lib/ghc-7.9.20140805/base_DiPQ1siqG3SBjHauL3L03p/GHC/Real.dyn_hi
updating EPS_
loadHiBootInterface main@main:PatSymDef
Considering whether to load base:Data.Maybe {- SYSTEM -}
Reading interface for base:Data.Maybe;
reason: The name ‘Data.Maybe.Just’ is mentioned explicitly
readIFace /nix/store/m347lhn3g6sh2s9pv7kz68qs2jyhzphg-ghc-7.9.20140805/lib/ghc-7.9.20140805/base_DiPQ1siqG3SBjHauL3L03p/Data/Maybe.hi
readIFace /nix/store/m347lhn3g6sh2s9pv7kz68qs2jyhzphg-ghc-7.9.20140805/lib/ghc-7.9.20140805/base_DiPQ1siqG3SBjHauL3L03p/Data/Maybe.dyn_hi
updating EPS_
Starting fork { Declaration for Maybe
Loading decl for Data.Maybe.Maybe
updating EPS_
Considering whether to load ghc-prim:GHC.Prim {- SYSTEM -}
Reading interface for ghc-prim:GHC.Prim;
reason: Need home interface for wired-in thing *
updating EPS_
Start interface-file tc_con_decl Nothing
Done interface-file tc_con_decl Data.Maybe.Nothing
Start interface-file tc_con_decl Just
Done interface-file tc_con_decl Data.Maybe.Just
tcIfaceDecl4 Data.Maybe.Maybe
} ending fork Declaration for Maybe
Starting fork { Constructor Data.Maybe.Nothing
} ending fork Constructor Data.Maybe.Nothing
Starting fork { Constructor Data.Maybe.Just
} ending fork Constructor Data.Maybe.Just
==================== Interface statistics ====================
Renamer stats: 6 interfaces read
1 type/class/variable imported, out of 776 read
0 instance decls imported, out of 42 read
0 rule decls imported, out of 53 read
Need decl for PatSymDef.Some
Considering whether to load main@main:PatSymDef {- SYSTEM -}
Warning: Not found in environment: Some
50% ( 1 / 2) in 'PatSymDef'
Considering whether to load base:Prelude
Considering whether to load main@main:PatSymDef
updating EPS_
Considering whether to load base:GHC.Base {- SYSTEM -}
Considering whether to load base:GHC.Float {- SYSTEM -}
Considering whether to load base:GHC.Real {- SYSTEM -}
loadHiBootInterface main@main:PatSymUse
Considering whether to load base:Data.Maybe {- SYSTEM -}
Considering whether to load ghc-prim:GHC.Types {- SYSTEM -}
Reading interface for ghc-prim:GHC.Types;
reason: The name ‘GHC.Types.Int’ is mentioned explicitly
readIFace /nix/store/m347lhn3g6sh2s9pv7kz68qs2jyhzphg-ghc-7.9.20140805/lib/ghc-7.9.20140805/ghcpr_BE58KUgBe9ELCsPXiJ1Q2r/GHC/Types.hi
readIFace /nix/store/m347lhn3g6sh2s9pv7kz68qs2jyhzphg-ghc-7.9.20140805/lib/ghc-7.9.20140805/ghcpr_BE58KUgBe9ELCsPXiJ1Q2r/GHC/Types.dyn_hi
updating EPS_
Considering whether to load ghc-prim:GHC.Types {- SYSTEM -}
Considering whether to load main@main:PatSymDef {- SYSTEM -}
Considering whether to load base:Data.Maybe {- SYSTEM -}
Considering whether to load ghc-prim:GHC.Types {- SYSTEM -}
Considering whether to load ghc-prim:GHC.Types {- SYSTEM -}
Need decl for PatSymDef.Some
Considering whether to load main@main:PatSymDef {- SYSTEM -}
/tmp/PatSymUse.hs:9:4:
Can't find interface-file declaration for data constructor Some
Probable cause: bug in .hi-boot file, or inconsistent .hi file
Use -ddump-if-trace to get an idea of which file caused the error
In the pattern: Some a
In an equation for ‘f’: f (Some a) = a
Originally reported to me against Haddock 2.14.3, GHC 7.8.3 and I can confirm both there and on yesterday's GHC HEAD.
It'd be great if whoever is involved with pattern synonyms could take a look.
Trac metadata
Trac field | Value |
---|---|
Version | 7.9 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |