Skip to content

GHC.TypeLits import don't quite work

If you explicitly import any of the things that are Compiler Magic from GHC.TypeLits you get an error:

import GHC.TypeLits ((+), (-))
...
[1 of 1] Compiling Main             ( typelit_export_bug.hs, interpreted )

typelit_export_bug.hs:1:22:
    Module `GHC.TypeLits' does not export `(+)'

typelit_export_bug.hs:1:27:
    Module `GHC.TypeLits' does not export `(-)'
Failed, modules loaded: none.

If you do the opposite, it also doesn't work

import GHC.TypeLits hiding ((+), (-))
...
[1 of 1] Compiling Main             ( typelit_export_bug.hs, interpreted )

typelit_export_bug.hs:3:1: Warning:
    Module `GHC.TypeLits' does not export `(+)'

typelit_export_bug.hs:3:1: Warning:
    Module `GHC.TypeLits' does not export `(-)'

The use case is that I would like to define my own + and have one instance for Nat and others for other types of my choosing. It isn't more than a minor annoyance, however, there aren't many thing defined in GHC.TypeLits so I can write import qualified GHC.TypeLits; import GHC.TypeLits (Nat, natVal, Symbol, symbolVal ...

Trac metadata
Trac field Value
Version 7.8.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information