Skip to content

Conversation

@aspiwack
Copy link
Member

Visibility of the kind argument changed in
https://gitlab.haskell.org/ghc/ghc/-/commit/012257c15f584069500af2953ab70856f9a1470e
.

This makes capability compatible with GHC 8.10 .

We still need to change the dependencies to be recent enough.

Visibility of the kind argument changed in
https://gitlab.haskell.org/ghc/ghc/-/commit/012257c15f584069500af2953ab70856f9a1470e
.

This makes capability compatible with GHC 8.10 .
@aspiwack aspiwack requested a review from aherrmann March 15, 2021 08:56
```
src/Capability/Reflection.hs:68:3: error:
    • Variables ‘k, tag’ occur more often
        in the constraint ‘Reifies s (Reified tag c m)’
        than in the instance head ‘c (Reflected s c m)’
      (Use UndecidableInstances to permit this)
    • In the quantified constraint ‘forall s.
                                    Reifies s (Reified tag c m) =>
                                    c (Reflected s c m)’
      In the type signature:
        interpret_ :: forall tag c m a.
                      (Monad m,
                       forall s. Reifies s (Reified tag c m) => c (Reflected s c m)) =>
                      Reified tag c m -> (forall m'. c m' => m' a) -> m a
   |
68 |   forall tag c m a.
   |   ^^^^^^^^^^^^^^^^^...
```
```
examples/Error.hs:84:15: error:
    • Illegal polymorphic type:
        forall (m' :: * -> *).
        (HasCatch "parser" inner0 m', () :: Constraint) =>
        m' a
      Perhaps you intended to use RankNTypes
    • When checking the inferred type
        wrapParserError :: forall a.
                           (forall (m' :: * -> *).
                            (HasCatch "parser" inner0 m', () :: Constraint) =>
                            m' a)
                           -> m0 a
      In the second argument of ‘catch’, namely
        ‘do let wrapParserError
                  = wrapError
                      @"parser" @(Rename "ParserError" :.: Ctor "ParserError" "calc")
                      @'[]
                wrapMathError
                  = wrapError
                      @"math" @(Rename "MathError" :.: Ctor "MathError" "calc") @'[]
            num <- wrapParserError $ parseNumber input
            root <- wrapMathError $ sqrtNumber num
            liftIO $ putStrLn $ "sqrt = " ++ show root’
      In a stmt of a 'do' block:
        catch
          @"calc"
          do let wrapParserError
                   = wrapError
                       @"parser" @(Rename "ParserError" :.: Ctor "ParserError" "calc")
                       @'[]
                 wrapMathError
                   = wrapError
                       @"math" @(Rename "MathError" :.: Ctor "MathError" "calc") @'[]
             num <- wrapParserError $ parseNumber input
             root <- wrapMathError $ sqrtNumber num
             liftIO $ putStrLn $ "sqrt = " ++ show root
          \ e -> liftIO $ putStrLn $ "Error: " ++ show e
   |
84 |           let wrapParserError = wrapError @"parser"
   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
```
Copy link
Member

@aherrmann aherrmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the version bounds and Nix shell for GHC 8.10.4 and to match Stackage LTS 17.4.

Additional fixes that were required:

  • Use Type instead of *
  • Enable RankNTypes in one example.
  • Enable UndecidableInstances in Capability.Reflection.
  • Remove a few now redundant imports.


-- | Deriving two capabilities from the record fields of @MonadReader@.
newtype CountLogM m (a :: *) = CountLogM (ReaderT CountLogCtx m a)
newtype CountLogM m (a :: Type) = CountLogM (ReaderT CountLogCtx m a)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also use toplevel kind signatures. But let's worry about that another day.

-- returns a 'Constraint'. Examples of capabilities includ: @HasReader "foo"
-- Int@, @MonadIO@, …
type Capability = (* -> *) -> Constraint
type Capability = (Type -> Type) -> Constraint
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It probably would have been less noisy to enable -XStarIsKind. But at least, now, we are more future-proof.

@aspiwack aspiwack marked this pull request as ready for review March 15, 2021 10:11
@aspiwack aspiwack merged commit 80062ac into master Mar 15, 2021
@aspiwack aspiwack deleted the proxy-hash-visibility branch March 15, 2021 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants