What are the adjoint functor pairs corresponding to common monads in Haskell?

What you’re looking for is Kleisli category. It was originally developed to show that every monad can be constructed from two adjoint functors. The problem is that Haskell Functor is not a generic functor, it’s an endo-functor in the Haskell category. So we need something different (AFAIK) to represent functors between other categories: {-# LANGUAGE … Read more

What is a monad in FP, in categorical terms?

This question has some good answers: Monads as adjunctions More to the point, Derek Elkins’ “Calculating Monads with Category Theory” article in TMR #13 should have the sort of constructions you’re looking for: http://www.haskell.org/wikiupload/8/85/TMR-Issue13.pdf Finally, and perhaps this is really the closest to what you’re looking for, you can go straight to the source and … Read more

Is there a monad that doesn’t have a corresponding monad transformer (except IO)?

I’m with @Rhymoid on this one, I believe all Monads have two (!!) transformers. My construction is a bit different, and far less complete. I’d like to be able to take this sketch into a proof, but I think I’m either missing the skills/intuition and/or it may be quite involved. Due to Kleisli, every monad … Read more

Monads as adjunctions

Edit: Just for fun, I’m going to do this right. Original answer preserved below The current adjunction code for category-extras now is in the adjunctions package: http://hackage.haskell.org/package/adjunctions I’m just going to work through the state monad explicitly and simply. This code uses Data.Functor.Compose from the transformers package, but is otherwise self-contained. An adjunction between f … Read more

Real-world applications of zygohistomorphic prepromorphisms

Sharon Curtis and Shin-Cheng Mu have a Functional Pearl using zygomorphisms to find maximally dense segments (a generalization of maximum segment sums). Zygomorphisms are seemingly a good fit for sliding window problems once you are accustomed to them. http://www.iis.sinica.edu.tw/~scm/2010/functional-pearl-maximally-dense-segments/ I’d nominate the authors for extra credit as they’ve avoided the use of the fixed-point Mu … Read more

What does “coalgebra” mean in the context of programming?

Algebras I think the place to start would be to understand the idea of an algebra. This is just a generalization of algebraic structures like groups, rings, monoids and so on. Most of the time, these things are introduced in terms of sets, but since we’re among friends, I’ll talk about Haskell types instead. (I … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)