jaspervdj / digestive-functors

A general way to consume input using applicative functors
149 stars 71 forks source link

Calling validate on an already-named field #71

Open singpolyma opened 11 years ago

singpolyma commented 11 years ago

If .: has already been used to add a name to a field, then it seems that one can no longer use validate to add validations to the field (the errors end up under the next-highest Ref, if any). It would be very useful to have a way to add validations to a field that already has a name.

singpolyma commented 10 years ago

Could do it if popRef were exposed, but really I probably want some sort of underRef helper that applies a function under the topmost ref

singpolyma commented 10 years ago

This is working for me:

underRef :: (Form v m a -> Form v m b) -> Form v m a -> Form v m b
underRef f (Ref r x) = Ref r (f x)
underRef f form = f form