How to combine signals in Helm?

I am working on a project using Helm , which is based on the Elm language.

I need to trigger an event based on which signal from the pair of signals comes first. In Elm, I would use the merge function , but I cannot find the equivalent in Helm. The closest I see is a combination (in the signal library) that doesn't seem to do what I want. It seems that the combination just takes a list of signals and makes them right in the signal lists, which is not quite what I am looking for.

EDIT: in particular, I'm looking for a function with a signature Signal a -> Signal a -> Signal athat takes the first signal to trigger and discards the second.

What is the best way to accomplish this in Helm?

+4
source share
2

, - , Helm Signal Elerea merge . , , , .

, Helm. timestamp :

merge sigL sigR =
  let
    tsMerge (t1,v1) (t2,v2) =
        if t1 >= t2
          then v1
          else v2
  in
    tsMerge <~ timestamp sigL ~~ timestamp sigR
+2

, Applicative. , liftA2 (,) Signal a -> Signal b -> Signal (a,b).

( 100%, . , Event a -> Event a -> Event a, , . Signal, .)

+2

All Articles