Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functions in Msg objects break import/export in Elm 0.18 debugger #318

Open
MazeChaZer opened this issue Jun 2, 2017 · 3 comments
Open
Milestone

Comments

@MazeChaZer
Copy link
Contributor

Cannot use Import or Export

The Update.Msg type of your program cannot be reliably serialized for history files.

Functions cannot be serialized, nor can values that contain functions. This is a problem in these places:

Material.Dispatch.Config can contain functions and JSON decoders.

The good news is that having values like this in your message type is not so great in the long run. You are better off using simpler data, like union types, in your messages. From there, your update function can pattern match on that data and call whatever functions, JSON decoders, etc. you need. This makes the code much more explicit and easy to follow for other readers (or you in a few months!)

@MazeChaZer
Copy link
Contributor Author

FYI, not using the global mdl state and wiring up all components individually using their Elm architecture functions solves this problem.

@aforemny aforemny modified the milestone: v9 Jun 26, 2017
@Spiralis
Copy link

@MazeChaZer With the very limited experience I have on Elm and elm-mdl, that sounds like an awful lot of work. Or?
Or, is this something that might be fixed at some stage?

@MazeChaZer
Copy link
Contributor Author

@Spiralis The problem is the general architecture of this libraray, so I don't expect it to be fixed soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants