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

  • Home
  • SEARCH
  • 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 4623358
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:58:32+00:00 2026-05-22T02:58:32+00:00

I only know F#. I haven’t learned the other functional programming languages. All the

  • 0

I only know F#. I haven’t learned the other functional programming languages. All the examples that I have seen for monads only describe the bind and unit methods. F# has lots of keywords (e.g. let!, do!, etc.) that allow you to do different things within the same computational expression. This seemingly gives you more power than your basic bind and unit methods. Is this unique to F# or is it common across functional programming languages?

  • 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-22T02:58:33+00:00Added an answer on May 22, 2026 at 2:58 am

    Yes, I think that the F# syntax for computation expressions is unique in that it provides direct syntactic support for different types of computations. It can be used for working with monoids, usual monads and also MonadPlus computations from Haskell.

    I wrote about these in the introduction of my Master thesis. I believe it is quite readable part, so you can go to page 27 to read it. Anyway, I’ll copy the examples here:

    Monoid is used just for concatenating values using some “+” operation (Combine). You can use it for example for building strings (this is inefficient, but it demonstrates the idea):

    type StringMonoid() =
      member x.Combine(s1, s2) = String.Concat(s1, s2)
      member x.Zero() = ""
      member x.Yield(s) = s
    
    let str = new StringMonoid()
    
    let hello = str { yield "Hello "
                      yield "world!" };;
    

    Monads are the familiar example that uses bind and return operations of comptuation expressions. For example maybe monad represents computations that can fail at any point:

    type MaybeMonad() =
      member x.Bind(m, f) =
        match m with Some(v) -> f v | None -> None
      member x.Return(v) = Some(v)
    
    let maybe = new MaybeMonad()
    
    let rec productNameByID() = maybe {
      let! id = tryReadNumber()
      let! prod = db.TryFindProduct(id)
      return prod.Name }
    

    Additive monads (aka MonadPlus in Haskell) is a combination of the two. It is a bit like monadic computation that can produce multiple values. A common example is list (or sequence), which can implement both bind and combine:

    type ListMonadPlus() =
      member x.Zero() = []
      member x.Yield(v) = [v]
      member x.Combine(a, b) = a @ b
      member x.Bind(l, f) = l |> List.map f |> List.concat
    
    let list = new ListMonadPlus()
    
    let cities = list {
      yield "York"
      yield "Orleans" }
    let moreCities = list {
      let! n = cities
      yield n
      yield "New " + n }
    
    // Creates: [ "York"; "New York"; "Orleans"; "New Orleans" ]
    

    There are some additional keywords that do not directly correspond to any theoretical idea. The use keyword deals with resources and for and while can be used to implement looping. The sequence/list comprehension actually use for instead of let!, because that makes much more sense from the syntactic point of view (and for usually takes some sequence – although it may be e.g. asynchronous).

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

Sidebar

Related Questions

All the examples that I have read have only went over how to create
I have an ICollection that I know will only ever have one member. Currently,
Using web forms I know that you can only have one ASP.NET form on
Haven't seen this feature anywhere else. I know that the 32nd bit is used
I only know a small amount about .NET MVC and haven't used it barely
I only know Wordpress and have started to seek another alternative framework, Zend. I
I only know that the difference between hashmap and map is that hashmap is
I'm currently using mysql w/ PHP because that's what I learned and haven't ever
I know this question could have passed a few times here but I haven't
I know there are other questions on the subject, but I haven't been able

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.