Is it possible to create a Signal
from a List
? Essentially what I want is something with the signature List a -> Signal a
. I know that a Signal
represents a time-varying value and so something like this doesn't actually make any sense (i.e. I can't think of a reason to use it in production code).
I could see applications of it for testing though. For example, imagine some function which depended on the past values of a Signal
(via foldp
for instance) and you wanted to make assertions about the state of the system given the signal had received values x, y, and z.
Note that there wouldn't have to be anything special about the Signal
denoting that it only would ever receive a fixed number of values. I'm thinking of it more like: in production you have a Signal
of mouse clicks, and you want to test that from a given starting position, after a given set of clicks, the system should be in some other known state. I know you could simulate this by calling the function a fixed number of times and feeding the results back in with new values, I'm just wondering if it is possible.