Is there any beginner-friendly, haskell-ignorant, documentation for Addresses, Mailboxes and such? I am finding the Architecture tutorial to be rather heavy-going.--Also there are tutorials and blog posts, such as elm-by-example and others. As a beginner I am a bit worried whether those tutorials and blog posts are expounding idiomatic elm.Thanks.
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...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Can you say more about what's tough with mailboxes and addresses? What kind of challenges are you running into in code or conceptually?
This stuff is kind of new so the documentation is not fully fleshed out. Any insights you have could be helpful for doing better!
On Monday, June 1, 2015, krish <krish...@gmail.com> wrote:
Is there any beginner-friendly, haskell-ignorant, documentation for Addresses, Mailboxes and such? I am finding the Architecture tutorial to be rather heavy-going.--Also there are tutorials and blog posts, such as elm-by-example and others. As a beginner I am a bit worried whether those tutorials and blog posts are expounding idiomatic elm.Thanks.
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Can you say more about what's tough with mailboxes and addresses? What kind of challenges are you running into in code or conceptually?
This stuff is kind of new so the documentation is not fully fleshed out. Any insights you have could be helpful for doing better!
On Monday, June 1, 2015, krish <krish...@gmail.com> wrote:
Is there any beginner-friendly, haskell-ignorant, documentation for Addresses, Mailboxes and such? I am finding the Architecture tutorial to be rather heavy-going.--Also there are tutorials and blog posts, such as elm-by-example and others. As a beginner I am a bit worried whether those tutorials and blog posts are expounding idiomatic elm.Thanks.
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Signal Action
type Mailbox = Signal.Address Action
view : Signal.Address Action -> Model -> Html
view : Mailbox -> Model -> Html
view : Model -> Mailbox -> Html
Signal.forwardTo address (Modify id)
Signal.message address << UpdateField
Signal.forwardTo address UpdateField
view -> render
Signal.message -> Signal.deliver
:->
()
>><<
Signal foldp example
Max, I think a simple policy of "if it is used in an example, it must feature in the syntax reference" would suffice.
I must say I feel equally confused concerning the Mailbox and Address concept. Before they were introduced, I was starting to feel confortable using elm but since then I have kind of paused (indefinitely) my learning of elm. From the discussions I read on this mailing list, I understand that they are an answer to some limitations of elm that Signal could not bypass alone. Although I'm still not very clear on what those are.
A
/ \
/ \
B1 B2
/ \ / \
C1 C2 C3 C4
A
/ \
/ \
B1 B2
/ \ / \
C1' C2 C3 C4
A'
/ \
/ \
B1' B2
/ \ / \
C1' C2 C3 C4
Couldn't parents just pass a signal to their children, and then let the children put messages in the signal directly?
Couldn't parents just pass a signal to their children, and then let the children put messages in the signal directly?If all you have is a signal, you can't just put messages in it. One, it wouldn't make sense semantically for any part of the program to, say, claim they saw the mouse move. Signals that aren't associated with a mailbox have to come from somewhere. Two, putting an event on a signal is an impure action. (Even creating a mailbox is impure. Create two with the same initial value and the signals aren't the same.)
I don't find the concept of mailbox unintuitive per se, but it becomes murky when you confound it with signal - mailboxes don't handle signals, unless you can call a mailman such!
type alias Something a = {
signal : Signal a,
dispatcher : Dispatcher a
}
It's a Dispatcher of Actions, which makes sense because it lets you dispatch Actions to a Signal.
A SignalDispatcher.
--
You received this message because you are subscribed to a topic in the Google Groups "Elm Discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elm-discuss/J5dBfWJoLoQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elm-discuss...@googlegroups.com.
Perhaps it would be clearer to not name some abstract “Address” thing but instead just give a function?
type alias Dispatcher a =
{ writeTo : a -> Message
, received : Signal a
}
(names are random picks from suggestions, can be different)
Now you don’t need message : Address a -> a -> Message
.
forwardTo : Address b -> (a -> b) -> Address a
gets replaced by simple function composition, which is less magical:
type Action = Undo | Remove Int
port actions : Dispatcher Action
removeAddress : Int -> Message
removeAddress =
actions.writeTo << Remove
send : Address a -> a -> Task x ()
can be replaced by send : Message -> Task x ()
Does this simplified API give inspiration for better names?
On Mon, Jul 6, 2015 at 8:00 AM, Max Goldstein <maxgol...@gmail.com> wrote:
Personally I find the name "dispatcher" to be completely non-intuitive. The best proposal I've seen so far is inbox and outbox. That might fail if people think of the email inbox, where stuff sits rather than where they send stuff. However, I do like the idea of not holding the "signal" field sacrosanct and seeing if we can rename both to come up with something better.
--
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...@googlegroups.com.
Building on the pipe idea:
type alias Pipe a =
{ out : EventSource a
, in : EventSink a
}
An event bus analogy:
type alias Bus a =
{ signal : Signal a
, arbiter : Arbiter a -- this is hard
}
Honestly I find something to the point (Pipe
or EventRouter
) better than a neat analogy (Bus
). It’s not pretty, but it’s clear what it does.
Building on the pipe idea:
I'd like to explore names a little more but I really like the pipes idea as well. It means Message isn't hanging on to the API by one function. And I love how the really wacky forwardTo ("it's like map but switched, huh?") disappears entirely.
view : (Action -> Message) -> Model -> Html
view sendAction model = ...
view : (Action -> Message) -> Model -> Html
view dispatch model =
button [class "load-more"] [onClick dispatch LoadMoreResults]
view : (Action -> Message) -> Model -> Html
view dispatch model =
button [onClick dispatch LoadMoreResults] [text "Load More Results"]
Can you say more about what's tough with mailboxes and addresses? What kind of challenges are you running into in code or conceptually?This stuff is kind of new so the documentation is not fully fleshed out. Any insights you have could be helpful for doing better!
On Monday, June 1, 2015, krish <krish...@gmail.com> wrote:Is there any beginner-friendly, haskell-ignorant, documentation for Addresses, Mailboxes and such? I am finding the Architecture tutorial to be rather heavy-going.Also there are tutorials and blog posts, such as elm-by-example and others. As a beginner I am a bit worried whether those tutorials and blog posts are expounding idiomatic elm.Thanks.
--
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...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Sent from Gmail Mobile
Hey Max, thanks for the link. Can u help me understand the significance of mail boxes? Why do we need them at all? Can't you use a signal without a mailbox?
Couldn't parents just pass a signal to their children, and then let the children put messages in the signal directly?If all you have is a signal, you can't just put messages in it. One, it wouldn't make sense semantically for any part of the program to, say, claim they saw the mouse move. Signals that aren't associated with a mailbox have to come from somewhere. Two, putting an event on a signal is an impure action. (Even creating a mailbox is impure. Create two with the same initial value and the signals aren't the same.)
What if we just forego the option of creating new signals from scratch? The Elm run time should be the interface to the outside world and how it creates the signals should not be visible to the application. All you should be able to do in your applications is just take existing signals, transform and combine them using things like map and fold to create new signals. If you need to pass a new signal around just pass the composed/transformed entity (higher order function?) instead. Would you still need a mailbox for this?