On Fri, Sep 8, 2017 at 10:35 AM, 'Rupert Smith' via Elm Discuss <
elm-discuss@googlegroups.com> wrote:

> When I try to compile this:
>
> module Model exposing (..)
>
> type Account
>     = Account
>         { uuid : String
>         , username : Maybe String
>         , password : Maybe String
>         , root : Maybe Bool
>         , id : Maybe String
>         }
>
>
>
>
> accountEncoder : Account -> Encode.Value
> accountEncoder (Account model) =
>     [ Just ( "uuid", Encode.string model.uuid )
>     , Maybe.map (\username -> ( "username", Encode.string username ))
> model.username
>     , Maybe.map (\password -> ( "password", Encode.string password ))
> model.password
>     , Maybe.map (\root -> ( "root", Encode.bool root )) model.root
>     , Maybe.map (\id -> ( "id", Encode.string id )) model.id
>     ]
>         |> catMaybes
>         |> Encode.object
>
>
>
> The compiler is somehow blind to the 'uuid' field being there:
>
>
> -- TYPE MISMATCH --------------------------------- src/auth-client/elm/
> Model.elm
>
>
> `model` does not have a field named `uuid`.
>
>
> 176|     [ Just ( "uuid", Encode.string model.uuid )
>                                         ^^^^^^^^^^
> The type of `model` is:
>
>
>     { id : Maybe String
>     , password : Maybe String
>     , roles : Maybe (List Role)
>     , root : Maybe Bool
>     , salt : Maybe String
>     , username : Maybe String
>     }
>
>
>
>
> Which does not contain a field named `uuid`.
>
>
>
>
That absolutely looks like you still some old compiled stuff lying around
somewhere. What happens if you copy the code to a clean directory, run
elm-package install again?

Other possible reasons for weird errors: did you recently upgrade elm?

eelco

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to