Permalink
Cannot retrieve contributors at this time
Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign up
Fetching contributors…
| module Types.SpecialType exposing (SpecialType, decoder, elmProgram, elmTest, encoder, none, toString) | |
| import Json.Decode as JD exposing (Decoder) | |
| import Json.Encode as JE exposing (Value) | |
| type SpecialType | |
| = None | |
| | ElmProgram | |
| | ElmTest | |
| none : SpecialType | |
| none = | |
| None | |
| elmProgram : SpecialType | |
| elmProgram = | |
| ElmProgram | |
| elmTest : SpecialType | |
| elmTest = | |
| ElmTest | |
| decoder : Decoder SpecialType | |
| decoder = | |
| JD.string |> JD.andThen fromString | |
| encoder : SpecialType -> Value | |
| encoder specialType = | |
| case specialType of | |
| None -> | |
| JE.string "None" | |
| ElmProgram -> | |
| JE.string "ElmProgram" | |
| ElmTest -> | |
| JE.string "ElmTest" | |
| fromString : String -> Decoder SpecialType | |
| fromString string = | |
| case string of | |
| "ElmProgram" -> | |
| JD.succeed ElmProgram | |
| "ElmTest" -> | |
| JD.succeed ElmTest | |
| _ -> | |
| JD.succeed None | |
| toString : SpecialType -> String | |
| toString specialType = | |
| case specialType of | |
| None -> | |
| "None" | |
| ElmProgram -> | |
| "ElmProgram" | |
| ElmTest -> | |
| "ElmTest" |