Comments (3)
There was a bug with an early version of ghc 7.8.1 or 2 that was fixed, can you point out which files aren't compiling for you and confirm that you are on 7.8.3? Examples should all work.
Sent from my iPhone
On Nov 8, 2014, at 12:00 AM, dschalk [email protected] wrote:
The acid-state example in The Happstack Book and some of the acid-state repository examples don't compile with GHC-7.8.3. The error messages say coercion is impossible because Data.SafeCopy.SafeCopy.Kind is nominal while two arguments differ. Simon Peyton-Jones explains what changed with the GHC-7.8.x in a video presentation at "https://skillsmatter.com/skillscasts/5296-safe-zero-cost-coercions-in-haskell".
The compiler messages says"Possible fix: use a standalone 'deriving instance' declaration . . ." Has anyone had any success implementing this suggestion? I wanted to use acid-state but the example code doesn't compile with the new GHC and I don't want to use GHC 7.x because the problem is not a bug in GHC-7.8.3; the problem stems from a bug having been fixed (see the Jones presentation). How are people dealing with this situation? Is the solution so trivial that nobody has bothered to mention it here? Are people removing "newtype" from their code, or using "unsafeCoerce", or what?—
Reply to this email directly or view it on GitHub.
from acid-state.
I apologize. The repo examples run fine, even with cereal-0.4.0.1 (the Stackage version). But here is what happens when I try to run IxSet.hs from The HappstackBook:
e@e:/acid-state/examples$ ghc --version/acid-state/examples$ runghc IxSet
The Glorious Glasgow Haskell Compilation System, version 7.8.3
e@e:
IxSet.hs:34:46:
Could not coerce from ‘safecopy-0.8.3:Data.SafeCopy.SafeCopy.Kind
Integer’ to ‘safecopy-0.8.3:Data.SafeCopy.SafeCopy.Kind PostId’
because the first type argument
of ‘safecopy-0.8.3:Data.SafeCopy.SafeCopy.Kind’ has role Nominal,
but the arguments ‘Integer’ and ‘PostId’ differ
arising from the coercion of the method
‘safecopy-0.8.3:Data.SafeCopy.SafeCopy.kind’ from type
‘safecopy-0.8.3:Data.SafeCopy.SafeCopy.Kind Integer’ to type
‘safecopy-0.8.3:Data.SafeCopy.SafeCopy.Kind PostId’
Possible fix:
use a standalone 'deriving instance' declaration,
so you can specify the instance context yourself
When deriving the instance for (SafeCopy PostId)
e@e:~/acid-state/examples$
from acid-state.
This is the code that failed:
newtype PostId = PostId { unPostId :: Integer }
deriving (Eq, Ord, Data, Enum, Typeable, SafeCopy)
This works:
newtype PostId = PostId { unPostId :: Integer }
deriving (Eq, Ord, Data, Enum, Typeable)
$(deriveSafeCopy 0 'base ''PostId)
So, it looks like the issue can be closed.
from acid-state.
Related Issues (20)
- Get size of acid-state? HOT 3
- Failed to build acid-state-0.15.1 HOT 8
- acid-state fails to build with GHC 8.8.1 HOT 1
- Changelog entry for 0.16 is missing HOT 1
- Test suite fails on macOS HOT 8
- build fails on ghc 9.0.1 HOT 1
- Hackage release needed for GHC 9.0.2 support HOT 2
- Benchmark `loading-benchmark` fails to build with GHC 7.10 HOT 3
- GHC versions covered by AppVeyor CI HOT 3
- acid-state on cluster HOT 1
- Haddocks for Data.Acid.Memory.Pure.AcidState are misleading HOT 1
- Database seems empty after ctrl+c HOT 4
- Build failures with mtl-2.3
- Support GHC 9.4 HOT 1
- README: possibly outdated irc link
- Build failure with unix-2.8 (GHC 9.6)
- Support GHC 9.6
- Build failure with template-haskell-2.21 (GHC 9.8)
- Benchmarks fail to build on GHC 9.8 due to `system-filepath`
- Unnecessary use of strict bytestrings in Data.Acid.Log HOT 1
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 acid-state.