Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ghc-mod expecting MonadBaseControl to have `StM` associated newtype instead of `StT` associated type

I'm getting this error from installing the latest ghc-mod (5.2.1.1) from Hackage in a sandbox:

[15 of 38] Compiling Language.Haskell.GhcMod.CabalConfig ( Language/Haskell/GhcMod/CabalConfig.hs, dist/dist-sandbox-94286619/build/Language/Haskell/GhcMod/CabalConfig.o )
[16 of 38] Compiling Language.Haskell.GhcMod.CabalApi ( Language/Haskell/GhcMod/CabalApi.hs, dist/dist-sandbox-94286619/build/Language/Haskell/GhcMod/CabalApi.o )
[17 of 38] Compiling Language.Haskell.GhcMod.Cradle ( Language/Haskell/GhcMod/Cradle.hs, dist/dist-sandbox-94286619/build/Language/Haskell/GhcMod/Cradle.o )
[18 of 38] Compiling Language.Haskell.GhcMod.Monad ( Language/Haskell/GhcMod/Monad.hs, dist/dist-sandbox-94286619/build/Language/Haskell/GhcMod/Monad.o )

Language/Haskell/GhcMod/Monad.hs:370:5:
    Wrong category of family instance; declaration was for a type synonym
    In the newtype instance declaration for ‘StM’
    In the instance declaration for ‘MonadBaseControl IO (GhcModT m)’
cabal: Error: some packages failed to install:
ghc-mod-5.2.1.1 failed during the building phase. The exception was:
ExitFailure 1

I've never seen this error before, so I went digging. In Language/Haskell/GhcMod/Monad.hs, sure enough it's doing something funny:

instance (MonadBaseControl IO m) => MonadBaseControl IO (GhcModT m) where
    newtype StM (GhcModT m) a = StGhcMod {
          unStGhcMod :: StM (StateT GhcModState
                              (ErrorT GhcModError
                                (JournalT GhcModLog
                                  (ReaderT GhcModEnv m) ) ) ) a } 
    liftBaseWith f = GhcModT . liftBaseWith $ \runInBase ->
        f $ liftM StGhcMod . runInBase . unGhcModT

If you look at monad-control on Hackage, there is no such StM associated newtype, but only an StT associated type.

Unless there's some other type trickery going on here, I'm stumped. How would this be fixed? Thank you.

like image 870
Athan Clark Avatar asked Nov 19 '25 03:11

Athan Clark


1 Answers

Scratch this, my eyes are fooling me. My mistake, since monad-control-1.x, MonadControl has had an associated type instead of an associated data type, as explained here.

like image 127
Athan Clark Avatar answered Nov 21 '25 19:11

Athan Clark



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!