Hi, I’m quite confused about something that will most probably result in a big AHA! and that I suddenly broke without understanding why…
I’m validating a form with elm-form, and implemented the validate function as in the examples: https://github.com/etaque/elm-form/blob/master/example/src/Model.elm
What I did is even simpler:
validate : Validation CustomError User
validate =
succeed User
|> andMap (field "user[kind]" validateKind)
validateKind : Validation CustomError Kind
validateKind =
customValidation
string
(\s ->
case s of
"creator" ->
Ok CreatorKind
"supplier" ->
Ok SupplierKind
_ ->
Err (customError InvalidKind)
)
The error I get is
The type annotation for `validate` says it is a:
Validation CustomError (User)
But the definition (shown above) is a:
Validation CustomError (Role -> User)
I can see what validateKind returns of course, what I don’t get is what is the difference with the example above? If you look at validateSuperpower
it’s basically the same code.
Can anybody share a hint?
Thanks in advance,
ngw