[Haskell-cafe] Does this typeclass have a name?

Ivan Lazar Miljenovic ivan.miljenovic at gmail.com
Mon Apr 21 07:04:21 UTC 2014


On 21 April 2014 15:09, Bardur Arantsson <spam at scientician.net> wrote:
> Hi all,
>
> I was wondering if anyone out there knows if this type class has a name?
>
>   class Foo a e where
>      foo :: e -> a -> a
>      bar :: a
>
> (I also have a fundep a -> e, but that's not essential.)
>
> Essentially the usage is:
>
>    You have a sequence of "events" e_i and a starting value
>    "bar" and can use the "foo" function to apply all events
>    to that starting value
>
>       foo e_n $ foo e_{n-1} $ ... $ foo e_0 $ bar

= foldr foo bar [e_n, e_{n-1} .. e_0] ?

>
>    and thus get the final value of the a induced by the
>    events e_i.
>
> (I've included the "bar" starting value in the type class, but I suppose
> it could be supplied by a Default instance.)
>
> Regards,
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
http://IvanMiljenovic.wordpress.com


More information about the Haskell-Cafe mailing list