[Haskell-cafe] Applicative of Applicative

martin martin.drautzburg at web.de
Mon Mar 23 21:02:41 UTC 2015


Hello all,

I've been playing with temporal values, i.e. values which change over time at discrete points in time. I thought it
would be good to make it an instance of Applicative and I was pleased with the results. I may be re-inventing some of
frp here, but hey.

Then I wondered how I would replace one Temporal by another at some point in time. Kind of like switching from summer
schedule to winter schedule. Or switching channels on the TV, where each channel is a Temporal Image.

It seems that by stacking up Temporals in this way, I could theoretically start with sample values and abstract my way
up to a symphony. What is unclear to me is the following: when I have two Temporal Ints, I know what (+) <$> does. It
operates on the Ints. But when I have Temporal Temporal Ints, then the function before the <$> would operate on the next
level, i.e. it has to be a function which accepts a Temporal.

But a Temporal Temporal Int can always be flattened into a Temporal Int. So I may just as well ask to apply a function
to the bottom level, namely the Ints.

How to I choose how deep down I want to reach? And any other guidance will also be much appreciated.

Martin


More information about the Haskell-Cafe mailing list