TLDR; To use it with the pipe (|>
) operator.
Here is the signature for Task.andThen
:
import Task exposing (andThen)
import Dict | |
-- The transformation function | |
listToDict : (a -> comparable) -> [a] -> Dict.Dict comparable a | |
listToDict getKey values = Dict.fromList (map (\v -> (getKey v, v)) values) | |
-- Demo type | |
type FooBar = | |
{ foo : String | |
, bar : Int |
module Test where | |
import Text (asText) | |
import Array (Array, get) | |
import Json.Decode (..) | |
import Maybe (..) | |
type alias Foo = | |
{ foo : String | |
, bar : Bar |
module MagicJson exposing (encode, decode, decoder) | |
import Json.Encode as Encode exposing (Value) | |
import Json.Decode as Decode exposing (Decoder) | |
import Http | |
encode : a -> Value | |
encode jsonEncodeElmValue = |