Closed chrisdone closed 5 years ago
Ah, interesting! This is coming from the general obtuseness of GHC complaining about constraints deep in instance resolution. I've improved the errors in https://github.com/fpco/store/commit/d6bee5a4eab3cbebee9f989d6952f8faf4c23d40 and released as version 0.5.1.1
Error with base>=4.9:
/home/mgsloan/proj/store/test/Data/HmmSpec.hs:481:10: error:
• Generic deriving of Store instances can only be used on datatypes with fewer than 256 constructors.
• In the expression: store-0.5.1.0:Data.Store.Impl.$dmsize @PrimOp
In an equation for ‘size’:
size = store-0.5.1.0:Data.Store.Impl.$dmsize @PrimOp
In the instance declaration for ‘Store PrimOp’
|
481 | instance Store PrimOp
| ^^^^^^^^^^^^
/home/mgsloan/proj/store/test/Data/HmmSpec.hs:481:10: error:
• Generic deriving of Store instances can only be used on datatypes with fewer than 256 constructors.
• In the expression: store-0.5.1.0:Data.Store.Impl.$dmpoke @PrimOp
In an equation for ‘poke’:
poke = store-0.5.1.0:Data.Store.Impl.$dmpoke @PrimOp
In the instance declaration for ‘Store PrimOp’
|
481 | instance Store PrimOp
| ^^^^^^^^^^^^
/home/mgsloan/proj/store/test/Data/HmmSpec.hs:481:10: error:
• Generic deriving of Store instances can only be used on datatypes with fewer than 256 constructors.
• In the expression: store-0.5.1.0:Data.Store.Impl.$dmpeek @PrimOp
In an equation for ‘peek’:
peek = store-0.5.1.0:Data.Store.Impl.$dmpeek @PrimOp
In the instance declaration for ‘Store PrimOp’
|
481 | instance Store PrimOp
Error from before TypeError
was a thing:
/home/mgsloan/proj/store/test/Data/HmmSpec.hs:481:10:
Could not deduce (store-0.5.1.0:Data.Store.Impl.TypeErrorMessage
"Generic deriving of Store instances can only be used on datatypes with fewer than
256 constructors.")
arising from a use of ‘store-0.5.1.0:Data.Store.Impl.$gdmsize’
In the expression: store-0.5.1.0:Data.Store.Impl.$gdmsize
In an equation for ‘size’:
size = store-0.5.1.0:Data.Store.Impl.$gdmsize
In the instance declaration for ‘Store PrimOp’
:muscle: Nice!
It's the same issue I encountered in
persist
: https://github.com/minad/persist/issues/4Here's a gist with a reproducible case:
https://gist.github.com/chrisdone/c908dbdbbeaaa945575ce5be7b47b9a6
I was deriving the type with TH (commented out), but it's reproducible with the derived sum type copy/pasted in.