Opened 2 years ago

Last modified 2 years ago

#13728 new bug

Clarify the difference between NameL and NameU in Template Haskell

Reported by: Feuerbach Owned by:
Priority: normal Milestone:
Component: Template Haskell Version: 8.0.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Documentation bug Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


Reading the docs in Language.Haskell.TH.Syntax, I got the impression that when reifying the type

data P a b = P a b

defined outside of TH, the type variables a and b will be NameLs; but in my experiments, they come out as NameUs.

Are NameLs used anywhere at all? In any case, I think the docs should be updated to explain the difference clearly.

Change History (1)

comment:1 Changed 2 years ago by goldfire

Component: Core LibrariesTemplate Haskell

It looks like NameLs are used when a quotation in a splice mentions an in-scope variable:

f x = $(do VarE stuff <- [| x |]
           runIO $ putStrLn $ case stuff of
             Name _ (NameS {}) -> "NameS"
             Name _ (NameQ {}) -> "NameQ"
             Name _ (NameU {}) -> "NameU"
             Name _ (NameL {}) -> "NameL"
             Name _ (NameG {}) -> "NameG"
           [| 0 |])

prints NameL when compiled. Yes, this should be clarified in the documentation.

Note: See TracTickets for help on using tickets.