frasertweedale / hs-jose

Haskell JOSE and JWT library
http://hackage.haskell.org/package/jose
Apache License 2.0
122 stars 46 forks source link

MonoLocalBinds warning #69

Closed tmcgilchrist closed 5 years ago

tmcgilchrist commented 5 years ago

Building with GHC 8.2.2 and treating warnings as errors I get the following:

$ mafia build
mafia build
Preprocessing library for jose-0.7.0.0..
Building library for jose-0.7.0.0..
[15 of 18] Compiling Crypto.JOSE.JWS  ( src/Crypto/JOSE/JWS.hs, dist/build/Crypto/JOSE/JWS.o )

src/Crypto/JOSE/JWS.hs:574:7: warning: [-Wsimplifiable-class-constraints]
    • The constraint ‘HasAlgorithms a’ matches an instance declaration
      instance HasValidationSettings a => HasAlgorithms a
        -- Defined at src/Crypto/JOSE/JWS.hs:526:10
      This makes type inference for inner bindings fragile;
        either use MonoLocalBinds, or simplify it using the instance
    • In the type signature:
        verifyJWS :: (HasAlgorithms a,
                      HasValidationPolicy a,
                      AsError e,
                      MonadError e m,
                      HasJWSHeader h,
                      HasParams h,
                      VerificationKeyStore m (h p) s k,
                      Cons s s Word8 Word8,
                      AsEmpty s,
                      Foldable t,
                      ProtectionIndicator p) =>
                     a -> k -> JWS t p h -> m s
    |
574 |   ::  ( HasAlgorithms a, HasValidationPolicy a, AsError e, MonadError e m
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...

src/Crypto/JOSE/JWS.hs:574:7: warning: [-Wsimplifiable-class-constraints]
    • The constraint ‘HasValidationPolicy a’
        matches an instance declaration
      instance HasValidationSettings a => HasValidationPolicy a
        -- Defined at src/Crypto/JOSE/JWS.hs:528:10
      This makes type inference for inner bindings fragile;
        either use MonoLocalBinds, or simplify it using the instance
    • In the type signature:
        verifyJWS :: (HasAlgorithms a,
                      HasValidationPolicy a,
                      AsError e,
                      MonadError e m,
                      HasJWSHeader h,
                      HasParams h,
                      VerificationKeyStore m (h p) s k,
                      Cons s s Word8 Word8,
                      AsEmpty s,
                      Foldable t,
                      ProtectionIndicator p) =>
                     a -> k -> JWS t p h -> m s
    |
574 |   ::  ( HasAlgorithms a, HasValidationPolicy a, AsError e, MonadError e m
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...

src/Crypto/JOSE/JWS.hs:588:7: warning: [-Wsimplifiable-class-constraints]
    • The constraint ‘HasAlgorithms a’ matches an instance declaration
      instance HasValidationSettings a => HasAlgorithms a
        -- Defined at src/Crypto/JOSE/JWS.hs:526:10
      This makes type inference for inner bindings fragile;
        either use MonoLocalBinds, or simplify it using the instance
    • In the type signature:
        verifyJWSWithPayload :: (HasAlgorithms a,
                                 HasValidationPolicy a,
                                 AsError e,
                                 MonadError e m,
                                 HasJWSHeader h,
                                 HasParams h,
                                 VerificationKeyStore m (h p) payload k,
                                 Cons s s Word8 Word8,
                                 AsEmpty s,
                                 Foldable t,
                                 ProtectionIndicator p) =>
                                (s -> m payload) -> a -> k -> JWS t p h -> m payload
    |
588 |   ::  ( HasAlgorithms a, HasValidationPolicy a, AsError e, MonadError e m
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...

src/Crypto/JOSE/JWS.hs:588:7: warning: [-Wsimplifiable-class-constraints]
    • The constraint ‘HasValidationPolicy a’
        matches an instance declaration
      instance HasValidationSettings a => HasValidationPolicy a
        -- Defined at src/Crypto/JOSE/JWS.hs:528:10
      This makes type inference for inner bindings fragile;
        either use MonoLocalBinds, or simplify it using the instance
    • In the type signature:
        verifyJWSWithPayload :: (HasAlgorithms a,
                                 HasValidationPolicy a,
                                 AsError e,
                                 MonadError e m,
                                 HasJWSHeader h,
                                 HasParams h,
                                 VerificationKeyStore m (h p) payload k,
                                 Cons s s Word8 Word8,
                                 AsEmpty s,
                                 Foldable t,
                                 ProtectionIndicator p) =>
                                (s -> m payload) -> a -> k -> JWS t p h -> m payload
    |
588 |   ::  ( HasAlgorithms a, HasValidationPolicy a, AsError e, MonadError e m
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
frasertweedale commented 5 years ago

@tmcgilchrist thanks for the report.