You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
src/Lets/Lens.hs:756:26: error:
• Could not deduce (Applicative f) arising from a use of ‘intOrP’
from the context: Functor f
bound by a type expected by the context:
Lens (IntOr [a]) (IntOr Bool) [a] Bool
at src/Lets/Lens.hs:756:19-47
Possible fix:
add (Applicative f) to the context of
a type expected by the context:
Lens (IntOr [a]) (IntOr Bool) [a] Bool
• In the first argument of ‘modify’, namely ‘intOrP’
In the expression: modify intOrP (even . length)
In an equation for ‘intOrLengthEven’:
intOrLengthEven = modify intOrP (even . length)
|
756 | intOrLengthEven = modify intOrP (even . length)
| ^^^^^^
Changing the type of modify to modify :: Set s t a b -> (a -> b) -> s -> t fixes this problem. I note that lens uses this type for over :: ASetter s t a b -> (a -> b) -> s -> t (because type ASetter s t a b = (a -> Identity b) -> s -> Identity t ).
The text was updated successfully, but these errors were encountered:
In
Lets.Lens
,modify
has the following type signature:This is fine until the final exercise, which seems to want me to use a
Prism
withmodify
:This fails with the following type error:
Changing the type of
modify
tomodify :: Set s t a b -> (a -> b) -> s -> t
fixes this problem. I note thatlens
uses this type forover :: ASetter s t a b -> (a -> b) -> s -> t
(becausetype ASetter s t a b = (a -> Identity b) -> s -> Identity t
).The text was updated successfully, but these errors were encountered: