I am reading this bit of code since yesterday and trying to come up with a reasonable explanation, could you please check that my assumptions are correct.
This code comes from here.
port requests : Signal (Task x ())
port requests =
Signal.map lookupZipCode query.signal
|> Signal.map (\task -> Task.toResult task `andThen` Signal.send results.address)
Line 1 defines a port, is returns a Signal
which is composed by a Task
, a type identified by x
and an empty value (this doesn't make sense to me, and I suppose it's plain wrong).
Line 4 and 5 make use of the forward function application construct, so the result of line 4 is passed as argument to line 5, but what is happening in detail in those lines?
To learn about functional reactive programming I'm going through this post is it a good resource?
I've read the documentation about signals but I can't really get the point here. An explanation in plain english with an example would be much appreciated, many thanks to anyone who would help me!