What is a pattern in a helmet?

There does not seem to be much documentation for the Sample a

Haskell library in Helm FCP. I am trying to write a function similar to the one sample on

in Elm and I think it update

might help. However, I am confused as to how it works update

because from the source code here it seems that the variable p

is not being used at all.

What is this feature supposed to do and why is the input enabled p

when not in use? Is there a better way to do this? I think it seq

might work, but I tried to implement my animation with seq

and it doesn't do what I'm looking for.

+3


source to share


1 answer


The first argument probably exists for historical reasons or for consistency with other features offered by the rudder; but I don't know enough to say for sure.

The intended use of a function update

is to wrap the appropriate constructor around its argument: update p a s

will either cast to Changed a

or to Unchanged a

depending on whether the a

value stored in the s

. You can use this, for example, as an argument for foldp

:



foldp (update undefined) :: Eq a => Sample a -> Signal a -> Signal (Sample a)

      

Downstream signals can then easily ignore the values Unchanged

.

+1


source







All Articles