[Haskell-cafe] Applicative & Monad as interaction between categories
Mike Izbicki
mike at izbicki.me
Tue Aug 5 14:57:45 UTC 2014
I have a github repo called subhask that does this. It uses the
ConstraintKinds extension and some other tricks to let us work in
subcategories of hask, and build endofunctors, applicatives, and
monads in those categories. My particular application is building a
dsl for machine learning, so there's a category for linear maps, and a
category for lipschitz maps, among many others. (Normal distributions
are monads in the category Vect, and most metric-based algorithms are
monads in the category of lipshitz maps.) It's not quite ready for
release, but you can check out the in progress work if you want.
The most interesting bits for you are probably the category instances:
https://github.com/mikeizbicki/subhask/blob/master/src/SubHask/Category.hs
and the monad hierarchy:
https://github.com/mikeizbicki/subhask/blob/master/src/SubHask/Functor.hs
The monad definitions currently lack adequate documentation because
some things will still have to change to get the type checker to do
what I want. For example, do notation doesn't work properly yet in
some subcategories.
On Tue, Aug 5, 2014 at 1:46 AM, Ruben Astudillo <ruben.astud at gmail.com> wrote:
> Hi all,
>
> I recently came across of two blog posts[1][2] by Gabriel Gonzales where he
> shows motivation for writing compositional functions -- and thus why the concept
> of category is useful -- and motivation to write functors between them.
>
> I wanted to know if something similar for has been done to `Applicative' and
> `Monad' as design pattern and interaction between categories. I've searching but
> I always hit the Monad tutorials and more info on how to use them.
>
> Thanks in advance. Excuse my English.
>
> [1]: http://www.haskellforall.com/2012/08/the-category-design-pattern.html
> [2]: http://www.haskellforall.com/2012/09/the-functor-design-pattern.html
>
> --
> Ruben Astudillo. pgp: 0x3C332311 , usala en lo posible :-)
> Crear un haiku, en diecisiete silabas, es complica...
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
More information about the Haskell-Cafe
mailing list