Signal Merging

114 views
Skip to first unread message

Kira Ghandhi

unread,
May 30, 2015, 4:38:05 PM5/30/15
to helm...@googlegroups.com
I'm currently trying to use Helm to write a game in Haskell. I know Elm and am very familiar with FRP in Elm. In Elm there is a very useful Signal function called merge which takes two signals and chooses the first one to fire (if they go at the same time it chooses the left one by default). There doesn't appear to be a way to do something similar in Helm. I notice there is a `combine` function but it doesn't seem to do the same thing. Is there a way to write the merge in Helm? I understand I am probably missing something, so any form of explanation would be greatly appreciated.

Thank you!

Kaspar Emanuel

unread,
Jun 3, 2015, 5:26:04 AM6/3/15
to Kira Ghandhi, helm...@googlegroups.com
Merge is not implemented currently. It shouldn't be too hard though. I think the best way to implement it would be via defining a Monoid instance for Signal.

On 30 May 2015 at 21:38, Kira Ghandhi <kira...@gmail.com> wrote:
I'm currently trying to use Helm to write a game in Haskell. I know Elm and am very familiar with FRP in Elm. In Elm there is a very useful Signal function called merge which takes two signals and chooses the first one to fire (if they go at the same time it chooses the left one by default). There doesn't appear to be a way to do something similar in Helm. I notice there is a `combine` function but it doesn't seem to do the same thing. Is there a way to write the merge in Helm? I understand I am probably missing something, so any form of explanation would be greatly appreciated.

Thank you!

--
You received this message because you are subscribed to the Google Groups "Helm Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to helm-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kira Ghandhi

unread,
Jun 4, 2015, 4:21:42 PM6/4/15
to helm...@googlegroups.com, kira...@gmail.com
Wouldn't a monoid instance require knowing how to add the signals together which is the problem? Or are you proposing using something like timestamp to write addition? I have tried writing a merge based on the timestamp function, but it doesn't produce the desired effect.
To unsubscribe from this group and stop receiving emails from it, send an email to helm-dev+unsubscribe@googlegroups.com.

Kaspar Emanuel

unread,
Jun 5, 2015, 9:56:25 AM6/5/15
to Kira Ghandhi, helm...@googlegroups.com
Yes, no, what I meant was: you would be best served by looking at the Elerea documentation and implementing the merge on that level (and then sending a pull-request to Helm :).

To unsubscribe from this group and stop receiving emails from it, send an email to helm-dev+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Helm Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to helm-dev+u...@googlegroups.com.

Kaspar Emanuel

unread,
Jul 4, 2015, 2:36:16 PM7/4/15
to Kira Ghandhi, helm...@googlegroups.com

Hi Kira,

I had a quick stab at implementing merge today. What I said about the Monoid instance was probably misleading as Signal cannot be a Monoid because there is no such thing as an empty Signal. Sorry if that sent you off on the wrong track at all.

I haven’t really tested my implementation yet so I would be grateful if you could see if it behaves as you would expect it.

Cheers,

Kaspar

Reply all
Reply to author
Forward
0 new messages