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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:52:10+00:00 2026-05-26T10:52:10+00:00

I was inspired to play with FizzBuzz after taking a gander at codepad.org ,

  • 0

I was inspired to play with FizzBuzz after taking a gander at codepad.org, and found myself wanting some function:

mwhen :: MonadPlus m => Bool -> a -> m a
mwhen b = if b then return else const mzero

just so I could do mwhen (n /? 3) "Foo" `mappend` mwhen (n /? 5) "Bar"

I expected it to be up on hoogle, but no dice.

Is this not as useful as I’d think it’d be?

  • 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-26T10:52:11+00:00Added an answer on May 26, 2026 at 10:52 am

    mwhen b a is exactly guard b >> return a. When you’re doing more things after the guard, you normally would have bound the a before the mwhen and not need the return. So mwhen’s usefulness seems to be mostly saving a few keystrokes at the end of do-blocks.

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

Sidebar

Related Questions

Inspired by another question asking about the missing Zip function: Why is there no
Inspired by Apple's LazyTables sample, I've just built myself a class called ImageLoader. It's
Inspired by this question. Why is there no list.clear() method in python? I've found
Inspired after watching Michael Feather's SCNA talk Self-Education and the Craftsman , I am
inspired by some lisp magic of runtime edit sourcecode, I want to do it
Inspired by Muhammad Alkarouri answer in What are good uses for Python3's "Function Annotations"
Inspired by this question I decided to test the rank() function, trying to see
Inspired by this CodingHorror article, Protecting Your Cookies: HttpOnly How do you set this
Inspired by Raymond Chen's post , say you have a 4x4 two dimensional array,
Inspired by the MVC storefront the latest project I'm working on is using extension

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.