Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7615415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:38:23+00:00 2026-05-31T02:38:23+00:00

I have become rather interested in how computation is modeled in Haskell. Several resources

  • 0

I have become rather interested in how computation is modeled in Haskell. Several resources have described monads as “composable computation” and arrows as “abstract views of computation”. I’ve never seen monoids, functors or applicative functors described in this way. It seems that they lack the necessary structure.

I find that idea interesting and wonder if there are any other constructs that do something similar. If so, what are some resources that I can use to acquaint myself with them? Are there any packages on Hackage that might come in handy?

Note: This question is similar to
Monads vs. Arrows and https://stackoverflow.com/questions/2395715/resources-for-learning-monads-functors-monoids-arrows-etc, but I am looking for constructs beyond funtors, applicative functors, monads, and arrows.

Edit: I concede that applicative functors should be considered “computational constructs”, but I’m really looking for something I haven’t come across yet. This includes applicative functors, monads and arrows.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T02:38:24+00:00Added an answer on May 31, 2026 at 2:38 am

    Arrows are generalized by Categories, and so by the Category typeclass.

     class Category f where
         (.) :: f a b -> f b c -> f a c
         id :: f a a
    

    The Arrow typeclass definition has Category as a superclass. Categories (in the haskell sense) generalize functions (you can compose them but not apply them) and so are definitely a “model of computation”. Arrow provides a Category with additional structure for working with tuples. So, while Category mirrors something about Haskell’s function space, Arrow extends that to something about product types.

    Every Monad gives rise to something called a “Kleisli Category” and this construction gives you instances of ArrowApply. You can build a Monad out of any ArrowApply such that going full circle doesn’t change your behavior, so in some deep sense Monad and ArrowApply are the same thing.

     newtype Kleisli m a b = Kleisli { runKleisli :: a -> m b }
    
     instance Monad m => Category (Kleisli m) where
         id = Kleisli return
         (Kleisli f) . (Kleisli g) = Kleisli (\b -> g b >>= f)
    
     instance Monad m => Arrow (Kleisli m) where
         arr f = Kleisli (return . f)
         first (Kleisli f) = Kleisli (\ ~(b,d) -> f b >>= \c -> return (c,d))
         second (Kleisli f) = Kleisli (\ ~(d,b) -> f b >>= \c -> return (d,c))
    

    Actually every Arrow gives rise to an Applicative (universally quantified to get the kinds right) in addition to the Category superclass, and I believe the combination of the appropriate Category and Applicative is enough to reconstruct your Arrow.

    So, these structures are deeply connected.

    Warning: wishy-washy commentary ahead. One central difference between the Functor/Applicative/Monad way of thinking and the Category/Arrow way of thinking is that while Functor and its ilk are generalizations at the level of object (types in Haskell), Category/Arrow are generelazation of the notion of morphism (functions in Haskell). My belief is that thinking at the level of generalized morphism involves a higher level of abstraction than thinking at the level of generalized objects. Sometimes that is a good thing, other times it is not. On the other-hand, despite the fact that Arrows have a categorical basis, and no one in math thinks Applicative is interesting, it is my understanding that Applicative is generally better understood than Arrow.

    Basically you can think of “Category < Arrow < ArrowApply” and “Functor < Applicative < Monad” such that “Category ~ Functor”, “Arrow ~ Applicative” and “ArrowApply ~ Monad”.

    More Concrete Below:
    As for other structures to model computation: one can often reverse the direction of the “arrows” (just meaning morphisms here) in categorical constructions to get the “dual” or “co-construction”. So, if a monad is defined as

    class Functor m => Monad m where
       return :: a -> m a
       join :: m (m a) -> m a
    

    (okay, I know that isn’t how Haskell defines things, but ma >>= f = join $ fmap f ma and join x = x >>= id so it just as well could be)
    then the comonad is

    class Functor m => Comonad m where
       extract :: m a -> a -- this is co-return
       duplicate :: m a -> m (m a) -- this is co-join
    

    This thing turns out to be pretty common also. It turns out that Comonad is the basic underlying structure of cellular automata. For completness, I should point out that Edward Kmett’s Control.Comonad puts duplicate in a class between functor and Comonad for “Extendable Functors” because you can also define

       extend :: (m a -> b) -> m a -> m b -- Looks familiar? this is just the dual of >>=
       extend f = fmap f . duplicate
       --this is enough
       duplicate = extend id
    

    It turns out that all Monads are also “Extendable”

       monadDuplicate :: Monad m => m a -> m (m a)
       monadDuplicate = return
    

    while all Comonads are “Joinable”

       comonadJoin :: Comonad m => m (m a) -> m a
       comonadJoin = extract
    

    so these structures are very close together.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been learning OpenGL and SDL lately and I've become rather confused about
I have found that writing PHP code within classes can become rather long: $this->parser->parse_syntax($this->get_language_path($this->language),
I have become accustomed to using F6 to compile the current document. A third-party
I have become pretty fluent in a few different languages now, but I seem
I have become accustomed to using TryParse for attempting to parse unknown types: Dim
Lately I have become a huge fan of XSL, XPath and XML, but I've
Within the last year I have become addicted to subversion. I am an only
I am learning about SOAP implementation and have become somewhat confused regarding the appropriate
Since beginning to use VB.NET some years ago I have become slowly familiar with
I know that PHP doesn't yet have native Enumerations. But I have become accustomed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.