Opened 9 months ago

Closed 9 months ago

#9146 closed bug (invalid)

GHC.TypeLits import don't quite work

Reported by: yuriyt Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.8.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Revisions:

Description

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 ...

Change History (1)

comment:1 Changed 9 months ago by rwbarton

  • Resolution set to invalid
  • Status changed from new to closed

Your import statement tries to import (ordinary value-level) functions (+), (-) from GHC.TypeLits. Instead, use the ExplicitNamespaces language extension and write

import GHC.TypeLits (type (+), type (-))
Note: See TracTickets for help on using tickets.