Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resourcet cannot be built with GHC 8 #242

Closed
kazu-yamamoto opened this Issue Jan 15, 2016 · 4 comments

Comments

Projects
None yet
4 participants
@kazu-yamamoto
Copy link
Contributor

kazu-yamamoto commented Jan 15, 2016

% cabal install --allow-newer resourcet
Resolving dependencies...
Configuring resourcet-1.1.7...
Building resourcet-1.1.7...
Preprocessing library resourcet-1.1.7...
[1 of 4] Compiling Data.Acquire.Internal ( Data/Acquire/Internal.hs, dist/build/Data/Acquire/Internal.o )
[2 of 4] Compiling Control.Monad.Trans.Resource.Internal ( Control/Monad/Trans/Resource/Internal.hs, dist/build/Control/Monad/Trans/Resource/Internal.o )

Control/Monad/Trans/Resource/Internal.hs:49:1: warning:
    Module ‘Control.Monad.Trans.Error’ is deprecated:
      Use Control.Monad.Trans.Except instead

Control/Monad/Trans/Resource/Internal.hs:76:1: warning:
    Module ‘Prelude’ does not export ‘catch’

Control/Monad/Trans/Resource/Internal.hs:292:11: warning:
    In the use of type constructor or class ‘Error’
    (imported from Control.Monad.Trans.Error):
    Deprecated: "Use Control.Monad.Trans.Except instead"

Control/Monad/Trans/Resource/Internal.hs:292:56: warning:
    In the use of type constructor or class ‘ErrorT’
    (imported from Control.Monad.Trans.Error):
    Deprecated: "Use Control.Monad.Trans.Except instead"
[3 of 4] Compiling Control.Monad.Trans.Resource ( Control/Monad/Trans/Resource.hs, dist/build/Control/Monad/Trans/Resource.o )

Control/Monad/Trans/Resource.hs:166:19: error:
    • Couldn't match type ‘a1’ with ‘IO ()’
      ‘a1’ is a rigid type variable bound by
        a type expected by the context:
          forall a1. Maybe a1
        at Control/Monad/Trans/Resource.hs:166:19
      Expected type: forall a. Maybe a
        Actual type: Maybe (IO ())
    • In the expression: Just (action ReleaseEarly)
      In the expression:
        (ReleaseMap next rf $ IntMap.delete key m, 
         Just (action ReleaseEarly))
      In a case alternative:
          Just action
            -> (ReleaseMap next rf $ IntMap.delete key m, 
                Just (action ReleaseEarly))

Control/Monad/Trans/Resource.hs:318:44: error:
    • Could not deduce (Num (forall a. Bounded a => a))
        arising from a use of ‘+’
      from the context: MonadBase IO m
        bound by the type signature for:
                   createInternalState :: MonadBase IO m => m InternalState
        at Control/Monad/Trans/Resource.hs:315:1-56
    • In the second argument of ‘ReleaseMap’, namely ‘(minBound + 1)’
      In the second argument of ‘($)’, namely
        ‘ReleaseMap maxBound (minBound + 1) IntMap.empty’
      In the second argument of ‘($)’, namely
        ‘I.newIORef $ ReleaseMap maxBound (minBound + 1) IntMap.empty’
Failed to install resourcet-1.1.7
cabal: Error: some packages failed to install:
resourcet-1.1.7 failed during the building phase. The exception was:
ExitFailure 1
@RyanGlScott

This comment has been minimized.

Copy link
Contributor

RyanGlScott commented Jan 15, 2016

Be aware that these errors might be the result of a GHC bug involving ImpredicativeTypes (see Trac #11319). There's also another bug that triggers a GHC panic lurking in conduit as well (see Trac #11428). To get around these when building them on GHC 8.0-rc1, I had to:

  1. Remove ImpredicativeTypes altogether

  2. In resourcet, I believe I had to change the definition of resourceMask from

    resourceMask :: MonadResource m => ((forall a. ResourceT IO a -> ResourceT IO a) -> ResourceT IO b) -> m b
    resourceMask = liftResourceT . resourceMaskRIO

    to

    resourceMask :: MonadResource m => ((forall a. ResourceT IO a -> ResourceT IO a) -> ResourceT IO b) -> m b
    resourceMask r = liftResourceT (resourceMaskRIO r)

    since the former requires impredicativity.

@ocharles

This comment has been minimized.

Copy link
Contributor

ocharles commented Feb 8, 2016

I can confirm this is still problematic with GHC 8-rc2

@RyanGlScott

This comment has been minimized.

Copy link
Contributor

RyanGlScott commented Feb 8, 2016

The good news is that on GHC 8.0.1-rc2, Trac #11319 has been fixed! I've opened #247 to fix GHC 8-specific issues.

@snoyberg

This comment has been minimized.

Copy link
Owner

snoyberg commented Aug 8, 2016

This is now working with the released GHC 8.

@snoyberg snoyberg closed this Aug 8, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.