Ruben Astudillo | 5 Aug 10:46 2014
Picon

Applicative & Monad as interaction between categories

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...
Mike Izbicki | 5 Aug 16:57 2014

Re: Applicative & Monad as interaction between categories

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
(Continue reading)

Carter Schonwald | 5 Aug 18:03 2014
Picon

Re: Applicative & Monad as interaction between categories

huh, that looks neat, i'll have to check it out when i have time.

I'd actually argue that the paper by Sam Lindley, Philip Wadler and Jeremy Yallop is another interesting take

therein, the authors relate Applicatives, Monads and Arrows and their respective expressivity in a categorical setting




On Tue, Aug 5, 2014 at 10:57 AM, Mike Izbicki <mike <at> izbicki.me> wrote:
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
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Gmane