-
Notifications
You must be signed in to change notification settings - Fork 28
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
Add support for receive function #41
Comments
You could always support an after block by mandating it as part of the msg type like: type Msg
= Msg String
| After Int
case receive of
Msg a -> 1
After 10 -> Via the specially named message And it is not technically impure, purity in Erlang is per process, and given the same inputs to the same process at the same time in its life cycle it will always generate the same work. ^.^ |
Wow. This is a very smart and hacky idea. But I definitely like that! |
The Elm syntax does not leave a lot of options open... ^.^; |
Because of the decisions on how to handle side effects and inherent impurity of receive construct, it won't ever be introduced to Elmchemy, and be possible to use only through special Elmchemy constructs for process message boxes |
Maybe instead you could emulate it like a 'subscription', when a message is received that matches a pattern then send it on? Unsure of how to 'start' a receive though, hmm... Would be much easier if an Elm 'program' was exactly a GenServer on the Elixir side... |
After most of Elmchemy's features stabilize and prove themselves in a longer run I will start thinking about redoing Elm runtime in BEAM, so that there are effect modules, and generally pattern for generating side-effects. I just feel like receive is a very controversial feature to put into the project, and I believe it's sacrificing what's the best in Elm |
How to process messages is still up to a debate:
Temporary solution:
Example:
->
But since it's impure, unidiomatic, and totally forbids a case of
after
block it should be discussed and redeveloped afterThe text was updated successfully, but these errors were encountered: