[Haskell-cafe] Applicative of Applicative

Chris Wong lambda.fairy at gmail.com
Tue Mar 24 03:13:43 UTC 2015


Hi Martin,

On Tue, Mar 24, 2015 at 10:02 AM, martin <martin.drautzburg at web.de> wrote:
> 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.

Have you considered making Temporal a Monad? All monads by definition
provide a `join :: m (m a) -> m a` which flattens their nested
structure.

> Martin
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

-- 
https://lambda.xyz


More information about the Haskell-Cafe mailing list