Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,251
    • Issues 5,251
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 576
    • Merge requests 576
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #2339
Closed
Open
Issue created Jun 04, 2008 by Simon Peyton Jones@simonpjDeveloper

Template Haskell reification with mkName doesn't work right

Marc Weber writes: this doesn't work:

-- packages: template-haskell
{-# OPTIONS_GHC -XTemplateHaskell #-}
module Main where
import Language.Haskell.TH

data A a = A a

type C = A Int

data ABC = ABC Int

$(do
  a <- reify $ mkName "C"
  report False $ show a
  return []
  )
main = print ""

Produces output

|| [1 of 1] Compiling Main             ( test.hs, test.o )
||
test.hs|1| `C' is not in scope at a reify

Using mkName "A" results in

test.hs|1 error|
||     DataConI Main.A (ForallT [a_1627391370] [] (AppT (AppT ArrowT (VarT a_1627391370)) (AppT (ConT Main.A) (VarT a_1627391370)))) Main.A (Fixity 9 InfixL)

as expected

Why do I need it? I'd like to implement kind of very basic relational data representation the way IxSet is doing it but without dynamics..

It will look like this:

type CDs = Table (Autoinc, Artist, Title, Year) -- col types
                 (Artist, Title, Year) -- keys
                 () -- is detail of
type Tracks = Table (Autoinc, Title, RecordingDate)
                    (Title, RecordingDate)
                    (CDs)
$(mkDB ["CDs","Tracks"])

To be able to automatically derive

insert{CDs,Tracks}
delete{CDs,Tracks}
update{CDs,Tracks}

functions I need to get information about those types.. Is this possible?

Thanks Marc Weber

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