I'm learning about monads in Haskell, I understood why they are useful, I understood in general what bind, join, return do.

## How to write tail-recursive functions when working inside monads

In general I have problems figuring out how to write tailrecursive functions when working 'inside' monads. Here is a quick example:

## Join two IOs with – in haskell

I need to join two IO Strings with a - in between. Here's what I came up with, which works - what's the right way?

## Implementing Monads in Java 8

I am trying to implement a Monad interface in Java 8 following this article however I've got the following compiling errors

## How to flatten IO (IO ())?

I'm just learning Haskell and monad transformers and I've found myself with an IO (IO ()) that I'd like to flatten into just IO (). I'm sure that I'm doing something wrong, but can't pinpoint exactly where I'm getting lost.

## Why does Haskell not allow pattern matching in comprehensions?

I've written the following (trivial) function:I'd've expected this to be desugared as:In turn, desugared (ignoring the fail stuff) as:

## Do notation for monad in function returning a different type

Is there a way to write do notation for a monad in a function which the return type isn't of said monad?

## Is Haskell's bind operator (>>=) equivalent to F#'s forward pipe operator (|>)?

Type signature of Haskell's bind operator (>>=):Type signature of F#'s forward pipe operator (|>):They look similar. And considering the impure nature of F#, the equivalent operator of |> in Haskell is >>=?

## If a data structure is foldable, is it a monoid?

Obviously, if a data structure is a monoid, it's foldable, but is it safe to say if a data structure is foldable, it's a monoid?

## Is there a standard function like `>>`, but returning the result of the first operand?

For instance, suppose I want to read a line and also ring a bell:The idea seems to have much in common with const, the only difference being that the values given are effectful, and are both executed, even though only the value of the first action is retained. (Unlike with...