Comments (15)
I confess I'm not even certain if the Ppr Info
instance is actually even needed at all. The Ppr
stuff is to do fixed up pretty printing in GHC, and that might have been fixed at source long ago. I'll take a quick look, but I don't think anything in that migration guide is cause for concern.
from derive.
That sounds promising.
from derive.
I've deleted the Ppr module entirely, and everything still works fine. Could you share whatever other modifications you made? I don't have time at the moment to fix up the pieces, but I suspect a lot of CPP and a bit of time will be all that is required. If you are unable to, I'll take a look, probably next week sometime.
from derive.
OK, I'll look at it.
from derive.
I was busy with other things. I will try something in the next days.
from derive.
Is there any progress on this issue?
from derive.
One fairly important package held up by this issue is compdata
, a Data Types a la Carte implementation by Bahr and Hvitved.
An example of how they employ derive
:
- internally: https://github.com/pa-ba/compdata/blob/a74bfa930b646c7bcc603c74d9ba496c2022935b/src/Data/Comp/DeepSeq.hs
- as user-facing API: https://github.com/pa-ba/compdata/blob/master/examples/Examples/Thunk.hs
@ndmitchell, what do you think would be the easiest way for compdata
to move ahead?
from derive.
@jwaldmann - are you still likely to be able to make the necessary changes?
@deepfire - if not, I'll update it, probably towards the end of the week (paper deadline on Wednesday).
from derive.
(sorry for the delay) I have a set of commits here ( jwaldmann@26572d0 and previous ) but it's not finished. It compiles but I doubt it works. See https://github.com/jwaldmann/derive/blob/master/Language/Haskell/Convert.hs#L116
from derive.
@jwaldmann - I've merged all your changes. One minor tweak, I prefer to use __GLASGOW_HASKELL__
as the CPP rather than template_haskell
. I appreciate that in theory the second form is cleaner, but in practice only one compiler has Template Haskell, and it's always been very specifically tied to the internals of GHC at a particular version. By using the GHC macro it works more easily in GHCi.
from derive.
OK, with all those patches the test suite now works on GHC 8.0. I intend to release with that unless @jwaldmann advises against it. Ignoring a data type context is not the end of the world - in general it's a complete misfeature and rarely used.
from derive.
I've released 2.5.24 which works on GHC 8.0 and passes all the tests. Thanks a lot @jwaldmann! @deepfire, please report if there are still problems.
from derive.
@ndmitchell, this is what I get with GHC 8.0.1-rc4 (which saw another TH change, AIUI):
these derivations will be built:
/nix/store/ripjal00hdc9xf9dzanhrcry9g0rj94s-derive-2.5.24.drv
building path(s) ‘/nix/store/izvyps3gi703y6ns4fz4m42hh1l7q9zw-derive-2.5.24’
setupCompilerEnvironmentPhase
Build with /nix/store/57zrq025ih51wf09zi7i03jnkr16957h-ghc-8.0.0.20160421.
unpacking sources
unpacking source archive /nix/store/rz3fcjrgqd5ymwzcy0k8vjh8jxb6a4pk-derive-2.5.24.tar.gz
source root is derive-2.5.24
setting SOURCE_DATE_EPOCH to timestamp 1458759573 of file derive-2.5.24/src/Language/Haskell/TH
/Peephole.hs
patching sources
compileBuildDriverPhase
setupCompileFlags: -package-db=/tmp/nix-build-derive-2.5.24.drv-0/package.conf.d -j8 -threaded
[1 of 1] Compiling Main ( Setup.hs, /tmp/nix-build-derive-2.5.24.drv-0/Main.o )
Linking Setup ...
configuring
configureFlags: --verbose --prefix=/nix/store/izvyps3gi703y6ns4fz4m42hh1l7q9zw-derive-2.5.24 --
libdir=$prefix/lib/$compiler --libsubdir=$pkgid --with-gcc=gcc --package-db=/tmp/nix-build-deri
ve-2.5.24.drv-0/package.conf.d --ghc-option=-optl=-Wl,-rpath=/nix/store/izvyps3gi703y6ns4fz4m42
hh1l7q9zw-derive-2.5.24/lib/ghc-8.0.0.20160421/derive-2.5.24 --enable-split-objs --disable-libr
ary-profiling --disable-profiling --enable-shared --enable-library-vanilla --enable-executable-
dynamic --enable-tests
Configuring derive-2.5.24...
Dependency base ==4.*: using base-4.9.0.0
Dependency bytestring -any: using bytestring-0.10.8.0
Dependency containers -any: using containers-0.5.7.1
Dependency derive -any: using derive-2.5.24
Dependency directory -any: using directory-1.2.6.2
Dependency filepath -any: using filepath-1.4.1.0
Dependency haskell-src-exts ==1.17.*: using haskell-src-exts-1.17.1
Dependency pretty -any: using pretty-1.1.3.3
Dependency process -any: using process-1.4.2.0
Dependency syb -any: using syb-0.6
Dependency template-haskell -any: using template-haskell-2.11.0.0
Dependency transformers >=0.2: using transformers-0.5.2.0
Dependency uniplate >=1.5 && <1.7: using uniplate-1.6.12
Using Cabal-1.24.1.0 compiled by ghc-8.0
Using compiler: ghc-8.0.0.20160421
Using install prefix:
/nix/store/izvyps3gi703y6ns4fz4m42hh1l7q9zw-derive-2.5.24
Binaries installed in:
/nix/store/izvyps3gi703y6ns4fz4m42hh1l7q9zw-derive-2.5.24/bin
Libraries installed in:
/nix/store/izvyps3gi703y6ns4fz4m42hh1l7q9zw-derive-2.5.24/lib/ghc-8.0.0.20160421/derive-2.5.24
Private binaries installed in:
/nix/store/izvyps3gi703y6ns4fz4m42hh1l7q9zw-derive-2.5.24/libexec
Data files installed in:
/nix/store/izvyps3gi703y6ns4fz4m42hh1l7q9zw-derive-2.5.24/share/x86_64-linux-ghc-8.0.0.20160421
/derive-2.5.24
Documentation installed in:
/nix/store/izvyps3gi703y6ns4fz4m42hh1l7q9zw-derive-2.5.24/share/doc/x86_64-linux-ghc-8.0.0.2016
0421/derive-2.5.24
Configuration files installed in:
/nix/store/izvyps3gi703y6ns4fz4m42hh1l7q9zw-derive-2.5.24/etc
No alex found
Using ar found on system at:
/nix/store/s0kpgl8a101lkymj599f5a04s4wflf5s-binutils-2.26-dev/bin/ar
No c2hs found
Using cpphs version 1.20.1 found on system at:
/nix/store/vxpa5hg25g21qqjy0pnh8hwv6vz9bh14-cpphs-1.20.1/bin/cpphs
Using gcc version 5.3.0 given by user at:
/nix/store/ix03iknfgyrx7421fppjdczd9r4sw7pz-gcc-wrapper-5.3.0/bin/gcc
Using ghc version 8.0.0.20160421 found on system at:
/nix/store/57zrq025ih51wf09zi7i03jnkr16957h-ghc-8.0.0.20160421/bin/ghc
Using ghc-pkg version 8.0.0.20160421 found on system at:
/nix/store/57zrq025ih51wf09zi7i03jnkr16957h-ghc-8.0.0.20160421/bin/ghc-pkg
No ghcjs found
No ghcjs-pkg found
No greencard found
Using haddock version 2.17.0 found on system at:
/nix/store/57zrq025ih51wf09zi7i03jnkr16957h-ghc-8.0.0.20160421/bin/haddock
No happy found
Using haskell-suite found on system at: haskell-suite-dummy-location
Using haskell-suite-pkg found on system at: haskell-suite-pkg-dummy-location
No hmake found
Using hpc version 0.67 found on system at:
/nix/store/57zrq025ih51wf09zi7i03jnkr16957h-ghc-8.0.0.20160421/bin/hpc
Using hsc2hs version 0.68 found on system at:
/nix/store/57zrq025ih51wf09zi7i03jnkr16957h-ghc-8.0.0.20160421/bin/hsc2hs
Using hscolour version 1.24 found on system at:
/nix/store/1dczsrvfp57p6rz1awyhq2qmdk2qjp17-hscolour-1.24/bin/HsColour
No jhc found
Using ld found on system at:
/nix/store/ix03iknfgyrx7421fppjdczd9r4sw7pz-gcc-wrapper-5.3.0/bin/ld
No lhc found
No lhc-pkg found
No pkg-config found
Using strip version 2.26 found on system at:
/nix/store/s0kpgl8a101lkymj599f5a04s4wflf5s-binutils-2.26-dev/bin/strip
Using tar found on system at:
/nix/store/acikdr9h8d0jmrjxfyyh6mnh8dznqv8a-gnutar-1.28/bin/tar
No uhc found
building
Building derive-2.5.24...
Preprocessing library derive-2.5.24...
[ 1 of 64] Compiling Language.Haskell.TH.Compat ( src/Language/Haskell/TH/Compat.hs, dist/build
/Language/Haskell/TH/Compat.o )
[ 2 of 64] Compiling Language.Haskell.TH.Data ( src/Language/Haskell/TH/Data.hs, dist/build/Lan
guage/Haskell/TH/Data.o )
[ 3 of 64] Compiling Language.Haskell.TH.ExpandSynonym ( src/Language/Haskell/TH/ExpandSynonym.
hs, dist/build/Language/Haskell/TH/ExpandSynonym.o )
[ 4 of 64] Compiling Language.Haskell.TH.Helper ( src/Language/Haskell/TH/Helper.hs, dist/build
/Language/Haskell/TH/Helper.o )
src/Language/Haskell/TH/Helper.hs:59:37: error:
• Couldn't match expected type ‘Dec’
with actual type ‘[Dec] -> Dec’
• Probable cause: ‘InstanceD’ is applied to too few arguments
In the expression: InstanceD ctx hed defs
In an equation for ‘instance_context’:
instance_context req cls dat defs
= InstanceD ctx hed defs
where
vrs = vars 't' (dataArity dat)
hed = l1 cls (lK (dataName dat) vrs)
ctx = [typeToPred $ l1 r v | r <- req, v <- vrs]
src/Language/Haskell/TH/Helper.hs:59:47: error:
• Couldn't match expected type ‘Maybe Overlap’
with actual type ‘[Type]’
• In the first argument of ‘InstanceD’, namely ‘ctx’
In the expression: InstanceD ctx hed defs
In an equation for ‘instance_context’:
instance_context req cls dat defs
= InstanceD ctx hed defs
where
vrs = vars 't' (dataArity dat)
hed = l1 cls (lK (dataName dat) vrs)
ctx = [typeToPred $ l1 r v | r <- req, v <- vrs]
src/Language/Haskell/TH/Helper.hs:59:55: error:
• Couldn't match expected type ‘Type’ with actual type ‘[Dec]’
• In the third argument of ‘InstanceD’, namely ‘defs’
In the expression: InstanceD ctx hed defs
In an equation for ‘instance_context’:
instance_context req cls dat defs
= InstanceD ctx hed defs
where
vrs = vars 't' (dataArity dat)
hed = l1 cls (lK (dataName dat) vrs)
ctx = [typeToPred $ l1 r v | r <- req, v <- vrs]
src/Language/Haskell/TH/Helper.hs:63:29: error:
• Couldn't match type ‘[Pred]’ with ‘Type’
Expected type: Type
Actual type: Cxt
• In the second argument of ‘($)’, namely ‘l1 r v’
In the expression: typeToPred $ l1 r v
In the expression: [typeToPred $ l1 r v | r <- req, v <- vrs]
src/Language/Haskell/TH/Helper.hs:73:43: error:
• Couldn't match expected type ‘Dec’
with actual type ‘[Dec] -> Dec’
• Probable cause: ‘InstanceD’ is applied to too few arguments
In the expression: InstanceD ctx hed defs
In the expression: [InstanceD ctx hed defs]
In an equation for ‘generic_instance’:
generic_instance cls dat ctxTypes defs
= [InstanceD ctx hed defs]
where
vrs = vars 't' (dataArity dat)
hed = l1 cls (lK (dataName dat) vrs)
ctx = map (typeToPred . l1 cls) ctxTypes
src/Language/Haskell/TH/Helper.hs:73:53: error:
• Couldn't match expected type ‘Maybe Overlap’
with actual type ‘[Type]’
• In the first argument of ‘InstanceD’, namely ‘ctx’
In the expression: InstanceD ctx hed defs
In the expression: [InstanceD ctx hed defs]
src/Language/Haskell/TH/Helper.hs:73:61: error:
• Couldn't match expected type ‘Type’ with actual type ‘[Dec]’
• In the third argument of ‘InstanceD’, namely ‘defs’
In the expression: InstanceD ctx hed defs
In the expression: [InstanceD ctx hed defs]
note: keeping build directory ‘/tmp/nix-build-derive-2.5.24.drv-4’
builder for ‘/nix/store/ripjal00hdc9xf9dzanhrcry9g0rj94s-derive-2.5.24.drv’ failed with exit code 1
error: build of ‘/nix/store/ripjal00hdc9xf9dzanhrcry9g0rj94s-derive-2.5.24.drv’ failed
from derive.
Thanks for the heads up @deepfire - seems there were some last minute further changes to template haskell after RC2. Hopefully the work required to fix it up should be small...
from derive.
Fixed, just one small change to InstanceD to add an extra field.
Annoyingly, I also get a stupid warning from the stupid pattern match checker in GHC 8.0 saying "hmm, yeah, dude, didn't manage it - whateves". Since someone decided that should be a warning in my code I've had to turn off warnings as errors on that module.
from derive.
Related Issues (20)
- Add Aeson ToJSON/FromJSON
- Enum instances derived with TH crash with "Missing field in record construction
- Unnecessary context when deriving Monoid
- to decrease build time, sources should be in separate src/ folder HOT 2
- "derive makeArbitrary" error w/ strict types (8.0.1) HOT 7
- Could not convert Dec to Decl HOT 2
- Convert to haskell-src-exts-1.18 HOT 20
- Errors while using C and GHC preprocessors HOT 1
- TH derivation doesn't work when the type name is qualified HOT 1
- Fails to build under newest derive HOT 3
- Build failure with GHC 8.2 HOT 3
- Example in Data.Derive.UniplateDirect fails HOT 8
- Parse Fails For pattern aliases (MINOR: see issue comments) HOT 3
- Could not convert Type to Kind () ConT GHC.Types.Nat HOT 1
- Could not convert Dec to Decl () HOT 2
- Hackage distribution lacks TestInstances HOT 1
- Could not convert Type to Type () HOT 1
- Upgrade to haskell-src-exts-1.20 HOT 1
- support haskell-src-exts-1.21+? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from derive.