[GHC] #14030: Implement the "Derive Lift instances for data types in template-haskell" proposal
GHC
ghc-devs at haskell.org
Thu Nov 29 18:12:47 UTC 2018
#14030: Implement the "Derive Lift instances for data types in template-haskell"
proposal
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner: RyanGlScott
Type: task | Status: new
Priority: normal | Milestone: 8.8.1
Component: Template Haskell | Version: 8.3
Resolution: | Keywords: deriving
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by RyanGlScott):
OK, I decided that I wanted to remember exactly what the error message
was, so I compiled GHC 8.4.4 using 8.2.2 as the bootstrapping compiler.
Here is the error that I got:
{{{
$ PATH=/opt/ghc/8.2.2/bin:$PATH make -j1
===--- building phase 0
make --no-print-directory -f ghc.mk phase=0 phase_0_builds
make[1]: Nothing to be done for 'phase_0_builds'.
===--- building phase 1
make --no-print-directory -f ghc.mk phase=1 phase_1_builds
"/opt/ghc/8.2.2/bin/ghc" -hisuf hi -osuf o -hcsuf hc -static -O0 -H64m
-Wall -package-db libraries/bootstrapping.conf -this-unit-id template-
haskell-2.13.0.0 -hide-all-packages -i -ilibraries/template-haskell/.
-ilibraries/template-haskell/dist-boot/build -Ilibraries/template-haskell
/dist-boot/build -ilibraries/template-haskell/dist-boot/build/./autogen
-Ilibraries/template-haskell/dist-boot/build/./autogen -Ilibraries
/template-haskell/. -optP-include -optPlibraries/template-haskell/dist-
boot/build/./autogen/cabal_macros.h -package-id base-4.10.1.0 -package-id
ghc-boot-th-8.4.4 -package-id pretty-1.1.3.3 -Wall -this-unit-id template-
haskell -XHaskell2010 -no-user-package-db -rtsopts -fno-warn-
deprecated-flags -odir libraries/template-haskell/dist-boot/build
-hidir libraries/template-haskell/dist-boot/build -stubdir libraries
/template-haskell/dist-boot/build -c libraries/template-
haskell/./Language/Haskell/TH/Syntax.hs -o libraries/template-haskell
/dist-boot/build/Language/Haskell/TH/Syntax.o
libraries/template-haskell/Language/Haskell/TH/Syntax.hs:2002:43: error:
• Failed to load interface for ‘Language.Haskell.TH.Lib’
Use -v to see a list of the files searched for.
• In the expression:
Language.Haskell.TH.Lib.conE
(mkNameG_d
"template-haskell" "Language.Haskell.TH.Syntax" "NominalR")
In an equation for ‘lift’:
lift NominalR
= Language.Haskell.TH.Lib.conE
(mkNameG_d
"template-haskell" "Language.Haskell.TH.Syntax"
"NominalR")
When typechecking the code for ‘lift’
in a derived instance for ‘Lift Role’:
To see the code I am typechecking, use -ddump-deriv
In the instance declaration for ‘Lift Role’
|
2002 | deriving( Show, Eq, Ord, Data, Generic, Lift )
| ^^^^
libraries/template-haskell/ghc.mk:3: recipe for target 'libraries
/template-haskell/dist-boot/build/Language/Haskell/TH/Syntax.o' failed
make[1]: *** [libraries/template-haskell/dist-
boot/build/Language/Haskell/TH/Syntax.o] Error 1
Makefile:122: recipe for target 'all' failed
make: *** [all] Error 2
}}}
If you pass `-v`, you'll see what the culprit is:
{{{
$ "/opt/ghc/8.2.2/bin/ghc" -hisuf hi -osuf o -hcsuf hc -static -O0 -H64m
-Wall -package-db libraries/bootstrapping.conf -this-unit-id template-
haskell-2.13.0.0 -hide-all-packages -i -ilibraries/template-haskell/.
-ilibraries/template-haskell/dist-boot/build -Ilibraries/template-haskell
/dist-boot/build -ilibraries/template-haskell/dist-boot/build/./autogen
-Ilibraries/template-haskell/dist-boot/build/./autogen -Ilibraries
/template-haskell/. -optP-include -optPlibraries/template-haskell/dist-
boot/build/./autogen/cabal_macros.h -package-id base-4.10.1.0 -package-id
ghc-boot-th-8.4.4 -package-id pretty-1.1.3.3 -Wall -this-unit-id template-
haskell -XHaskell2010 -no-user-package-db -rtsopts -fno-warn-
deprecated-flags -odir libraries/template-haskell/dist-boot/build
-hidir libraries/template-haskell/dist-boot/build -stubdir libraries
/template-haskell/dist-boot/build -c libraries/template-
haskell/./Language/Haskell/TH/Syntax.hs -o libraries/template-haskell
/dist-boot/build/Language/Haskell/TH/Syntax.o -v
Glasgow Haskell Compiler, Version 8.2.2, stage 2 booted by GHC version
8.0.2
Using binary package database:
/opt/ghc/8.2.2/lib/ghc-8.2.2/package.conf.d/package.cache
Using binary package database: libraries/bootstrapping.conf/package.cache
package flags [-package-id base-4.10.1.0{unit base-4.10.1.0 True ([])},
-package-id ghc-boot-th-8.4.4{unit ghc-boot-th-8.4.4 True
([])},
-package-id pretty-1.1.3.3{unit pretty-1.1.3.3 True ([])}]
loading package database /opt/ghc/8.2.2/lib/ghc-8.2.2/package.conf.d
loading package database libraries/bootstrapping.conf
package binary-0.8.5.1 overrides a previously defined package
package hpc-0.6.0.3 overrides a previously defined package
package Cabal-2.0.1.0 is unusable due to shadowed dependencies:
binary-0.8.5.1
package ghc-8.2.2 is unusable due to shadowed dependencies:
binary-0.8.5.1 hpc-0.6.0.3 ghc-boot-8.2.2 ghci-8.2.2
package ghc-boot-8.2.2 is unusable due to shadowed dependencies:
binary-0.8.5.1
package ghci-8.2.2 is unusable due to shadowed dependencies:
binary-0.8.5.1 ghc-boot-8.2.2
wired-in package ghc-prim mapped to ghc-prim-0.5.1.1
wired-in package integer-gmp mapped to integer-gmp-1.0.1.0
wired-in package base mapped to base-4.10.1.0
wired-in package rts mapped to rts
wired-in package template-haskell mapped to template-haskell-2.13.0.0
wired-in package ghc mapped to ghc-8.4.4
wired-in package dph-seq not found.
wired-in package dph-par not found.
*** Checking old interface for Language.Haskell.TH.Syntax (use -ddump-hi-
diffs for more details):
*** Parser [Language.Haskell.TH.Syntax]:
!!! Parser [Language.Haskell.TH.Syntax]: finished in 25.95 milliseconds,
allocated 36.318 megabytes
*** Renamer/typechecker [Language.Haskell.TH.Syntax]:
!!! Renamer/typechecker [Language.Haskell.TH.Syntax]: finished in 775.89
milliseconds, allocated 669.498 megabytes
libraries/template-haskell/Language/Haskell/TH/Syntax.hs:2002:43: error:
• Failed to load interface for ‘Language.Haskell.TH.Lib’
Locations searched:
libraries/template-haskell/./Language/Haskell/TH/Lib.hi
libraries/template-haskell/./Language/Haskell/TH/Lib.hi-boot
libraries/template-haskell/dist-
boot/build/Language/Haskell/TH/Lib.hi
libraries/template-haskell/dist-boot/build/Language/Haskell/TH/Lib
.hi-boot
libraries/template-haskell/dist-
boot/build/./autogen/Language/Haskell/TH/Lib.hi
libraries/template-haskell/dist-
boot/build/./autogen/Language/Haskell/TH/Lib.hi-boot
• In the expression:
Language.Haskell.TH.Lib.conE
(mkNameG_d
"template-haskell" "Language.Haskell.TH.Syntax" "NominalR")
In an equation for ‘lift’:
lift NominalR
= Language.Haskell.TH.Lib.conE
(mkNameG_d
"template-haskell" "Language.Haskell.TH.Syntax"
"NominalR")
When typechecking the code for ‘lift’
in a derived instance for ‘Lift Role’:
To see the code I am typechecking, use -ddump-deriv
In the instance declaration for ‘Lift Role’
|
2002 | deriving( Show, Eq, Ord, Data, Generic, Lift )
| ^^^^
*** Deleting temp files:
Deleting:
*** Deleting temp dirs:
Deleting:
}}}
It appears as though GHC is searching in through the interface files of
the stage-1 GHC (8.4.4), but using the bootstrapping compiler's (8.2.2's)
`DeriveLift` name information to determine where to search! This adds more
evidence to my belief that this is quite fragile. I'm not sure how to do
better, however.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14030#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list