debois / elm-mdl

Elm-port of the Material Design Lite CSS/JS library
Apache License 2.0
965 stars 133 forks source link

Textfield.error [Maybe String] #330

Closed skinnyjames closed 7 years ago

skinnyjames commented 7 years ago

Awesome library!

It looks like an earlier version of this library took a Maybe String for a Textfield Model. Does that functionality still exist?

This would be useful for server side validation when an error might not exist.

aforemny commented 7 years ago

I think it was deliberately removed in favor of

let
    s = Just "foo"
in
    Textfield.render … [ Textfield.error (Maybe.withDefault "" s) |> when (s /= Nothing) ] []
aforemny commented 7 years ago

It is a bit more verbose, but I guess it either fits Html module better or it is less confusing because you do not have to know what functions expect Just a and what functions expect just a.

aforemny commented 7 years ago

Please re-open if you have any concerns. But I think we will not change the API in that regard any time soon.

skinnyjames commented 7 years ago

Not gonna reopen, but I don't think it's just more verbose.... I think it abstracts the Material.Textfield configuration (in which error is a Maybe String) in a way that I (maybe only I) don't really see the benefit of.

Pretty new to the ecosystem though, is this idiomatic Elm?