Giter Club home page Giter Club logo

Comments (3)

dmjio avatar dmjio commented on June 15, 2024

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.

dschalk avatar dschalk commented on June 15, 2024

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
The Glorious Glasgow Haskell Compilation System, version 7.8.3
e@e:
/acid-state/examples$ runghc IxSet
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.

dschalk avatar dschalk commented on June 15, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.