tekul/jose-jwt

Compile errors on nixos.

Closed this issue · 3 comments

[4 of 8] Compiling Jose.Jwk         ( Jose/Jwk.hs, dist/build/Jose/Jwk.o )

Jose/Jwk.hs:145:14:
    No instance for (transformers-0.3.0.0:Control.Monad.Trans.Error.Error
                       Jose.Types.JwtError)
      arising from a use of ‘B64.decode’
    In the expression: B64.decode (TE.encodeUtf8 t)
    In the expression:
      case B64.decode (TE.encodeUtf8 t) of {
        Left _ -> fail "could not base64 decode bytes"
        Right b -> pure $ JwkBytes b }
    In the second argument of ‘($)’, namely
      ‘\ t
         -> case B64.decode (TE.encodeUtf8 t) of {
              Left _ -> fail "could not base64 decode bytes"
              Right b -> pure $ JwkBytes b }’
[5 of 8] Compiling Jose.Internal.Crypto ( Jose/Internal/Crypto.hs, dist/build/Jose/Internal/Crypto.o )
[6 of 8] Compiling Jose.Jws         ( Jose/Jws.hs, dist/build/Jose/Jws.o )

Jose/Jws.hs:84:17:
    No instance for (transformers-0.3.0.0:Control.Monad.Trans.Error.Error
                       JwtError)
      arising from a use of ‘B64.decode’
    In a stmt of a 'do' block: sigBytes <- B64.decode sig
    In the expression:
      do { unless (BC.count '.' jwt == 2) $ Left $ BadDots 2;
           let (hdrPayload, sig) = spanEndDot jwt;
           sigBytes <- B64.decode sig;
           [h, payload] <- mapM B64.decode $ BC.split '.' hdrPayload;
           .... }
    In an equation for ‘decode’:
        decode verify jwt
          = do { unless (BC.count '.' jwt == 2) $ Left $ BadDots 2;
                 let (hdrPayload, sig) = ...;
                 sigBytes <- B64.decode sig;
                 .... }
          where
              spanEndDot bs = let ... in (BC.init toDot, end)

I'd guess it's a problem with the version of mtl. Can you check the version that's being used? It looks like the Error constraint in Error e => MonadError e (Either e) was removed in 2.1.3.1, so the lower bound will need to be increased.

Should be fixed by 69c0de1. Thanks for the report.

mtl-2.1.3.1 is now in nixpkgs again, so this should no longer be an issue.