Hi Robert,
your flags don't have to be of the same type as the model - try modifying
your 'init' function to take only your partial state and return (Model, Cmd
Msg).
пятница, 29 июля 2016 г., 14:14:39 UTC+3 пользователь Robert Walter написал:
>
> Hello,
>
> I try to initialize my elm application using programWithFlags.
>
> My app makes use of elm-mdl, so my model looks something like this:
>
> type alias AppState =
> { mdl : Material.Model
> , viewSelected : Int
> , ...
> , titleEditable : Bool
> , refreshEditorContent : Bool
> }
>
> In other words, it contains a Material.Model that I need to make proper
> use of elm-mdl.
>
> When I try to use App.programWithFlags, however, having Material.Model in
> my AppState leads to the following error:
>
>
> -- BAD FLAGS -------------------------------------------------------
> src/App.elm
> Your `main` is demanding an unsupported type as a flag.
> 68| main =
> ^^^^
> The specific unsupported type is:
> Dict.Dict
> (List Int)
> { animation : Material.Ripple.Animation
> , ignoringMouseDown : Bool
> , metrics :
> Maybe
> { rect :
> { height : Float
> , left : Float
> , top : Float
> , width : Float
> }
> , x : Float
> , y : Float
> }
> }
> The types of values that can flow through in and out of Elm include:
> Ints, Floats, Bools, Strings, Maybes, Lists, Arrays, Tuples,
> Json.Values,
> and concrete records.
>
>
> Currently, I use localStorage to store my AppState partially (I do not
> encode 'mdl'). I don't see how I can make this work, however, since I
> assume that programWithFlags can only decode the types mentioned in the BAD
> FLAGS message and it expects to receive a completely serialized AppState.
>
> Any suggestions from the coomunity?
>
> Thanks,
> Robert
>
>
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.