Conal Elliott talks about Streams and Comonads here: http://conal.net/blog/posts/sequences-streams-and-segments
However, he doesn't mention Behavior directly. So.. is Behavior a Comonad, and if so - what does that mean practically?
For starters - I suppose Behavior can provide the extend
and extract
functions. The only way I see that working is if it samples the value at a specific moment in time.
Is that what Comonad would mean for Behavior? That it allows one to "fork and freeze" a Behavior?
In other words - if we have a Behavior that has these values over time: A,B,C,D,...
we could extend
it at the time where it's B
, and get a new Behavior which contains B
indefinitely (which is useful - since we could then lift
or map
it etc.)