haskell / mwc-random

A very fast Haskell library for generating high quality pseudo-random numbers.
http://hackage.haskell.org/package/mwc-random
BSD 2-Clause "Simplified" License
55 stars 25 forks source link

Build failure under ghcjs, ghc-7.10 #48

Closed imalsogreg closed 9 years ago

imalsogreg commented 9 years ago

Similar issue to issue #41 , but pr #40 doesn't fix the issues under ghcjs

[1 of 3] Compiling System.Random.MWC ( System/Random/MWC.hs, dist/dist-sandbox-d4c56947/build/System/Random/MWC.js_o )

System/Random/MWC.hs:449:3:
    Could not deduce (Control.Monad.Primitive.PrimBase m)
      arising from a use of ‘unsafePrimToIO’
    from the context (PrimMonad m)
      bound by the type signature for
                 withSystemRandom :: PrimMonad m =>
                                     (Gen (PrimState m) -> m a) -> IO a
      at System/Random/MWC.hs:(438,21)-(440,54)
    Possible fix:
      add (Control.Monad.Primitive.PrimBase m) to the context of
        the type signature for
          withSystemRandom :: PrimMonad m =>
                              (Gen (PrimState m) -> m a) -> IO a
    In the expression: unsafePrimToIO
    In a stmt of a 'do' block:
      unsafePrimToIO $ initialize (I.fromList seed) >>= act
    In the expression:
      do { seed <- acquireSeedSystem
                   `E.catch` \ (_ :: E.IOException) -> do { ... };
           unsafePrimToIO $ initialize (I.fromList seed) >>= act }
imalsogreg commented 9 years ago

Some more info.

tonyday567 commented 9 years ago

The primitive that is ghcjs primitive-0.5.4.0 comes from a specific commit, via ghcjs/ghcjs-boot, and I'm guessing that that commit has the PrimBase change but the version hasn't been bumped.

Shimuuar commented 9 years ago

It looks like bug is in GHCJS so I'm closing bug.

Thank you everyone!