-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Trying to type
:t (,)
$>> f_1 >-< pure ()
>>> f_2 >-< pure 'a' :: (Applicative fr, Applicative fw) => Codec fr fw ((), Char)
results in some "could not deduce" errors
Could not deduce (Buildable ((), Char) y0)
Could not deduce (Field1 ((), Char) () (a0 -> b0 -> (a0, b0)) b1)
Could not deduce (Field2 ((), Char) Char b1 y0)
While an instance Field1 (a, b) a (a -> c -> (a, b)) (X -> c -> (a, b)) exists, it cannot be selected here because the compiler cannot first deduce that ((), Char) should be equal to (a0, b0) (fundeps would then take care of the rest).
Annotating (,) :: () -> Char -> ((), Char) makes the above typecheck, though this causes f_1 and f_2 to be rather annoying to use.
Making them regular functions would be a better fix IMO. Is there a reason why they are defined in typeclasses that I am missing?
Metadata
Metadata
Assignees
Labels
No labels