haskell-numerics / random-fu

A suite of Haskell libraries for representing, manipulating, and sampling random variables
42 stars 21 forks source link

Build failure in rvar with mtl-2.3 #85

Closed sjakobi closed 2 years ago

sjakobi commented 2 years ago
Building library for rvar-0.3.0.0..
[1 of 2] Compiling Data.RVar.Prim   ( src/Data/RVar/Prim.hs, dist/build/Data/RVar/Prim.o, dist/build/Data/RVar/Prim.dyn_o )
[2 of 2] Compiling Data.RVar        ( src/Data/RVar.hs, dist/build/Data/RVar.o, dist/build/Data/RVar.dyn_o )

src/Data/RVar.hs:239:12: error:
    • Variable not in scope:
        liftM :: (a -> b) -> RVarT n a -> RVarT n b
    • Perhaps you meant ‘lift’ (imported from Control.Monad.State)
    |
239 |     fmap = liftM
    |            ^^^^^

src/Data/RVar.hs:247:13: error:
    • Variable not in scope:
        ap :: RVarT n (a -> b) -> RVarT n a -> RVarT n b
    • Perhaps you meant ‘map’ (imported from Prelude)
    |
247 |     (<*>) = ap
    |             ^^
idontgetoutmuch commented 2 years ago

@sjakobi is there a PR or migration guide?

sjakobi commented 2 years ago

@sjakobi is there a PR or migration guide?

Neither, I'm afraid. The relevant change in mtl is documented here: https://github.com/haskell/mtl/pull/114/files

The fix is to import the removed functions directly from Control.Monad etc.

sjakobi commented 2 years ago

random-source is also affected:

src/Data/Random/Source/Internal/TH.hs:363:17: error:
    Variable not in scope:
      when
        :: Bool
           -> ReaderT Context (FD.Implementation Double) ()
           -> ReaderT Context (FD.Implementation Double) a0
    |
363 |                 when intIs64 (cost 1e-2)
    |                 ^^^^

src/Data/Random/Source/Internal/TH.hs:394:17: error:
    Variable not in scope:
      when
        :: Bool
           -> ReaderT Context (FD.Implementation Double) ()
           -> ReaderT Context (FD.Implementation Double) a1
    |
394 |                 when (not intIs64) (cost 1e-2)
    |                 ^^^^

As a Hackage trustee I have revised the affected versions on Hackage. See e.g. https://hackage.haskell.org/package/random-source-0.3.0.11

I have also revised rvar: https://hackage.haskell.org/package/rvar-0.3.0.0/revisions/

idontgetoutmuch commented 2 years ago

https://github.com/haskell-numerics/random-fu/pull/86 closes this. random-source is deprecated.