There are overlapping instances defined for AsError without OVERLAPS/OVERLAPPABLE pragmas. Attempting to use Error as an AsError results in:
Overlapping instances for Jose.AsError Jose.Error
arising from a use of ‘Jose.decodeCompact’
Matching instances:
instance Jose.AsError Jose.Error -- Defined in ‘Crypto.JOSE.Error’
instance Jose.AsJWTError e => Jose.AsError e
-- Defined in ‘Crypto.JWT’
In the expression: Jose.decodeCompact
In the second argument of ‘($)’, namely
‘Jose.decodeCompact $ BSL.fromStrict hdr’
In the expression:
withExceptT convertErr $ Jose.decodeCompact $ BSL.fromStrict hdr
The options are adding the overlapping pragmas, or making the instance for JWTError just instance AsError JWTError where {...}. The latter seems more reasonable to me, since
dealing with overlapping instances with makeClassy is a little full of boilerplate,
avoiding overlapping instances is always good, and
the current instance rules out any similar instances (i.e., AsError e), and it's not at all obvious to me conceptually why JWTError would get to do this.
There are overlapping instances defined for
AsError
withoutOVERLAPS
/OVERLAPPABLE
pragmas. Attempting to useError
as anAsError
results in:The options are adding the overlapping pragmas, or making the instance for
JWTError
justinstance AsError JWTError where {...}
. The latter seems more reasonable to me, sincemakeClassy
is a little full of boilerplate,AsError e
), and it's not at all obvious to me conceptually whyJWTError
would get to do this.PR #17 implements the second option.
(And thanks for the library, by the way!)