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
I see functions for querying Text, Choice, Bool, and File via fieldInputText, etc., but there doesn't appear to be a function for querying a Singleton. I attempted to write one myself, but I'm a little baffled by the error I'm getting because I've basically just copied from the fieldInputText function.
fieldInputSingleton::forallva.T.Text->Viewv->a
fieldInputSingleton ref (View _ _ form input _ method) =
queryField path form eval'
where
path = toPath ref
eval'::Fieldvb->a
eval' field =case field ofSingleton x ->undefined--Singleton x -> evalField method [] (Singleton x)
f ->error$T.unpack ref ++": expected (Singleton _), "++"but got: ("++show f ++")"
When I replace Singleton x -> undefined (line 79) with the one below it that's commented out, I get the following error:
src/Util/Digestive/Heist.hs:79:71:
Could not deduce (b ~ a2)
from the context (Monad m)
bound by a pattern with constructor
View :: forall v a (m :: * -> *).
Monad m =>
T.Text
-> Path
-> FormTree Data.Functor.Identity.Identity v m a
-> [(Path, FormInput)]
-> [(Path, v)]
-> Method
-> View v,
in an equation for `fieldInputSingleton'
at src/Util/Digestive/Heist.hs:72:26-53
`b' is a rigid type variable bound by
the type signature for eval' :: Field v1 b -> a2
at src/Util/Digestive/Heist.hs:77:26
`a2' is a rigid type variable bound by
the type signature for eval' :: Field v1 b -> a2
at src/Util/Digestive/Heist.hs:77:26
Relevant bindings include
x :: b (bound at src/Util/Digestive/Heist.hs:79:35)
field :: Field v1 b (bound at src/Util/Digestive/Heist.hs:78:23)
eval' :: Field v1 b -> a2
(bound at src/Util/Digestive/Heist.hs:78:17)
In the first argument of `Singleton', namely `x'
In the third argument of `evalField', namely `(Singleton x)'
What am I missing?
The text was updated successfully, but these errors were encountered:
I see functions for querying Text, Choice, Bool, and File via fieldInputText, etc., but there doesn't appear to be a function for querying a Singleton. I attempted to write one myself, but I'm a little baffled by the error I'm getting because I've basically just copied from the fieldInputText function.
When I replace
Singleton x -> undefined
(line 79) with the one below it that's commented out, I get the following error:What am I missing?
The text was updated successfully, but these errors were encountered: