I have a function that I believe is stricter than lens because of Applicative f
context.
Prelude Text.XML.Lens Data.Maybe Data.String Text.XML> :t f
f :: Control.Applicative.Applicative f =>
(Element -> f Element) -> Document -> f Document
This is because I obtained it from some Traversal
.
Prelude Text.XML.Lens Data.Maybe Data.String Text.XML> let f = root ./ ell "parent"
I want to pass it to a function that expects a monomorphic ALens
:
Prelude Text.XML.Lens Data.Maybe Data.String Text.XML> :t textFrom
textFrom
:: Data.Text.Internal.Text
-> s -> ALens s s Element Element -> Maybe Data.Text.Internal.Text
Prelude Text.XML.Lens Data.Maybe Data.String Text.XML> textFrom "groupId" pom f
But I don't really understand why this Applicative
instance is needed. I must be using this API incorrectly. What am I doing wrong?
No instance for (Control.Applicative.Applicative
(Control.Lens.Internal.Context.Pretext (->) Element Element))
arising from a use of ‘f’
In the third argument of ‘textFrom’, namely ‘f’
In the expression: textFrom "groupId" pom f
In an equation for ‘it’: it = textFrom "groupId" pom f
Prelude Text.XML.Lens Data.Maybe Data.String Text.XML> :t f
f :: Control.Applicative.Applicative f =>
(Element -> f Element) -> Document -> f Document
Prelude Text.XML.Lens Data.Maybe Data.String Text.XML> :t textFrom
textFrom
:: Data.Text.Internal.Text
-> s -> ALens s s Element Element -> Maybe Data.Text.Internal.Text
Prelude Text.XML.Lens Data.Maybe Data.String Text.XML> textFrom "groupId" pom f
<interactive>:68:24:
No instance for (Control.Applicative.Applicative
(Control.Lens.Internal.Context.Pretext (->) Element Element))
arising from a use of ‘f’
In the third argument of ‘textFrom’, namely ‘f’
In the expression: textFrom "groupId" pom f
In an equation for ‘it’: it = textFrom "groupId" pom f