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

update 'withSystemRandom' constraints to reflect 'primitive' changes #42

Closed dredozubov closed 9 years ago

dredozubov commented 9 years ago

There is a problem building mwc-random due to 'primitive' update to 0.6:

[1 of 3] Compiling System.Random.MWC ( System/Random/MWC.hs, dist/build/System/Random/MWC.o )

System/Random/MWC.hs:440: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:431:21-69
    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 }

'primitive' changes description: https://github.com/haskell/primitive/commit/c46bb077c2042e2765510c87539569d4f6b0bcc0#diff-42ba1d994f4fa8c6ad17a7efae7936ccR3

dredozubov commented 9 years ago

It seems like https://github.com/bos/mwc-random/issues/41 is a duplicate and it's name is misleading.

Shimuuar commented 9 years ago

I've merged #40 instead. This patch breaks compatibility with primitive <= 0.5

dredozubov commented 9 years ago

@Shimuuar :+1: It's definitely better. Github is laggy today, so i missed it. Hope to see a version bump really soon.