Closed ocharles closed 3 years ago
It refuses to compile.
Annotation says representational but role nominal is required
I even tried getting down to the root of the parser hierarchy, which is
newtype BinaryParser a =
BinaryParser ( StateT ByteString ( Except Text ) a )
deriving ( Functor , Applicative , Alternative , Monad , MonadPlus , MonadError Text )
type role BinaryParser representational
And it fails for the same reason.
Hmm, I wonder what is causing it be nominal
. Perhaps it gets all the way down to StateT
being nominal
? What if you explicitly write out BinaryParser (ByteString -> Either Text (a, ByteString))
?
You're right! The fix will be released in 1.4.5 in minutes.
Lack of coercibility has been a long observed issue which I didn't understand the roots of. I guess I've learned something today :) Thanks!
Hurrah, thanks @nikita-volkov! Now we can remove our hacky workaround :)
Sorry. Forgot to actually publish the package :) Now it's on Hackage.
Currently
Hasql.Decoders.Value
takes a nominal type. This means thatValue
s cannot be coerced. This is a bit of a shame, because we could imagine havingI can work around this, because I can do:
But this is obviously not ideal.
How do you feel about adding
?