Skip to content

Instantly share code, notes, and snippets.

@drager
Last active September 24, 2017 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drager/618de8090b196416b2c62c2293b87b40 to your computer and use it in GitHub Desktop.
Save drager/618de8090b196416b2c62c2293b87b40 to your computer and use it in GitHub Desktop.
import Form exposing (Form)
import Form.Validate as Validate exposing (field, map3, Validation)
import Form.Field
import Http
import Dict exposing (Dict)
import Json.Decode as Decode
import Json.Encode as Encode
type alias Connection a =
{ a
| host : String
, username : String
}
type alias ConnectionFormData =
Connection { password : String }
validation : Validation () ConnectionFormData
validation =
map3 ConnectionFormData
(field "host" Validate.string)
(field "username" Validate.string)
(field "password" Validate.string)
connectionDecoder : Decode.Decoder ConnectionFormData
connectionDecoder =
Decode.map3 ConnectionFormData
(Decode.field "host" Decode.string)
(Decode.field "username" Decode.string)
(Decode.field "password" Decode.string)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment