I have some record SomeRecord
and fields like _user
, _password
. And I want to write a Getter
for a "virtual" field, like identity which will look like <user>:<password>
:
identity:: Getter SomeRecord String
identity = to $ \srec -> srec^.user <> ":" <> srec^.password
and this getter leads to the warning:
• Redundant constraint: Functor f
• In the type signature for:
identity :: Getter SomeRecord Stringtypecheck(-Wredundant-constraints)
what's wrong with this getter and how to write it without warnings?
EDIT:
Just found this thread in the Web:
Comment (by ekmett):
In the interest of not getting drowned in complaints by the users of
lens
on GHC 8, we'll likely just add the constraint toto
and rely on{-# INLINE #-}
dropping it out in practice. This is a common enough scenario to warrant us eating the noise on our side.Of course, you'll get the same sort of thing if you go to declare a non- law abiding traversal as a fold, etc. There i'm afraid the only answer will be to squelch the warning. GHC can't see 'laws'.