-
Notifications
You must be signed in to change notification settings - Fork 9
Fix the visible type arguments of proxy# #87
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
Conversation
Visibility of the kind argument changed in https://gitlab.haskell.org/ghc/ghc/-/commit/012257c15f584069500af2953ab70856f9a1470e . This makes capability compatible with GHC 8.10 .
```
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"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
```
aherrmann
left a comment
There was a problem hiding this 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
Typeinstead of* - Enable
RankNTypesin one example. - Enable
UndecidableInstancesinCapability.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) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
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.