What are the implications of the recursive joining of Promises in terms of Monads?

The first issue can easily be bypassed by always providing a function with the right type a -> Promise a. Or by not using then as the bind operation of the monad, but some type-correct ones. Creed is a functionally minded promise library that provides map and chain methods which implements the Fantasy-land spec for … Read more

Scalaz Bind[Seq] typeclass

The collections library does backflips to accommodate subtyping: when you use map on a specific collection type (list, map, etc.), you’ll (usually) get the same type back. It manages this through the use of an extremely complex inheritance hierarchy together with type classes like CanBuildFrom. It gets the job done (at least arguably), but the … Read more

Why isn’t Validation a Monad?

As discussed in the Scalaz group, the problem seems to be that ap would accumulate errors whereas (pseudo-)monadic composition would only operate on the value part of Validation. Therefore, one cannot be expressed in terms of the other and thus no monad instance exists for Validation.

In what sense is the IO Monad pure?

I think the best explanation I’ve heard was actually fairly recently on SO. IO Foo is a recipe for creating a Foo. Another common, more literal, way of saying this is that it is a “program that produces a Foo“. It can be executed (many times) to create a Foo or die trying. The execution … Read more