Hey everyone, I’ve been playing around with Elm, but I’m getting this compile error that I don’t understand: https://ellie-app.com/4qQRZhfJ6tLa1
Don’t mind if code seems a bit weird, I’ve been cutting things out unrelated to the error I’m getting. Can anyone explain why I get an error saying that view and update should only take Msg and no Model?
Herteby is right, I made some changes, you can go from there, it compiles now, https://ellie-app.com/4qR8gh4dZGNa1, your model should be an alias type (record type), you defined your model as a custom type
Thanks! I guess the compiler can’t really know better when element is generic, and init is the first function it sees, and reduces the generic arguments based on the types provided there. Oh well ¯\(ツ)/¯
The custom type was on purpose, since it allows me to encode my GUI as a nice graph, where the nodes are the variants of my Model and my Msgs are the edges connecting the nodes.
Once I start having state I want to share between different views, I imagine I’ll do something like this:
type alis Model =
{ view : ViewCustomType
, dataStore : SharedDataModel
}