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 984671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:03:05+00:00 2026-05-16T05:03:05+00:00

While monads are represented in Haskell using the bind and return functions, they can

  • 0

While monads are represented in Haskell using the bind and return functions, they can also have another representation using the join function, such as discussed here. I know the type of this function is M(M(X))->M(X), but what does this actually do?

  • 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-16T05:03:05+00:00Added an answer on May 16, 2026 at 5:03 am

    Actually, in a way, join is where all the magic really happens–(>>=) is used mostly for convenience.

    All Functor-based type classes describe additional structure using some type. With Functor this extra structure is often thought of as a “container”, while with Monad it tends to be thought of as “side effects”, but those are just (occasionally misleading) shorthands–it’s the same thing either way and not really anything special[0].

    The distinctive feature of Monad compared to other Functors is that it can embed control flow into the extra structure. The reason it can do this is that, unlike fmap which applies a single flat function over the entire structure, (>>=) inspects individual elements and builds new structure from that.

    With a plain Functor, building new structure from each piece of the original structure would instead nest the Functor, with each layer representing a point of control flow. This obviously limits the utility, as the result is messy and has a type that reflects the structure of flow control used.

    Monadic “side effects” are structures that have a few additional properties[1]:

    • Two side effects can be grouped into one (e.g., “do X” and “do Y” become “do X, then Y”), and the order of grouping doesn’t matter so long as the order of the effects is maintained.
    • A “do nothing” side effect exists (e.g., “do X” and “do nothing” grouped is the same as just “do X”)

    The join function is nothing more than that grouping operation: A nested monad type like m (m a) describes two side effects and the order they occur in, and join groups them together into a single side effect.

    So, as far as monadic side effects are concerned, the bind operation is a shorthand for “take a value with associated side effects and a function that introduces new side effects, then apply the function to the value while combining the side effects for each”.

    [0]: Except IO. IO is very special.

    [1]: If you compare these properties to the rules for an instance of Monoid you’ll see close parallels between the two–this is not a coincidence, and is in fact what that “just a monoid in the category of endofunctors, what’s the problem?” line is referring to.

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

Sidebar

Related Questions

While I can normally do commits and also push to other remote repositories (eg.
While it's very handy, I very rarely, if ever, come across functions that return
While deveoping a site (using Forms authentication and InProc sessionstate) a frequently run into
While developing an application using gwt in ecliplse crashed. Now the server is running
While debugging my NServiceBus enabled application, I have certain messages that are reported in
Let's say I have a number of functions: f :: a -> Maybe a
While most of the time I'd just use file_get_contents and CURL, I can't get
While editing and fixing up code I have thought that sometimes it would be
While scouring the net for an answer to my problem I have seen multiple
While evaluating the line import Control.Monad.State in a Haskell module, GHC gives me the

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.