简体   繁体   中英

Snap Monad, LiftIO and ghc 7.4.1

I'm trying to get some code that was working in ghc 7.0.4 work with 7.4.1.

It appears to me that old way of accessing IO from inside the Snap moand no longer typechecks.

In ghc 7.0.4, the documented way of accessing IO compiles.

a :: Snap ()
a = liftIO fireTheMissiles

http://hackage.haskell.org/packages/archive/snap-core/0.8.1/doc/html/Snap-Core.html

In GHC 7.4.1,

No instance for (MonadIO Snap)
  arising from a use of `liftIO'
Possible fix: add an instance declaration for (MonadIO Snap)

I'm curious what an attractive work around would be.

My guess would be that you have conflicting versions of some package (likely transformers ). Snap is likely built against a different version (perhaps 0.2.2) while you're trying to use version 0.3. As a result, there's no instance for the MonadIO that you have in scope (from 0.3). This is just a guess, but I've seen the same thing occur a number of times.

One of the easiest ways to avoid this situation is to cabalize your code. cabal will warn you if you try to use different versions of the same package.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM