Last active
September 24, 2017 17:29
-
-
Save drager/618de8090b196416b2c62c2293b87b40 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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