Examples of a monad whose Applicative part can be better optimized than the Monad part

Another example is a strict left fold. You can write an applicative instance which allows you to compose folds so that the resulting fold can be performed on the data in a single pass and constant space. However, the monad instance needs to re-iterate from the beginning of the data for each bind and keep … Read more

What is Applicative Functor definition from the category theory POV?

The key to understanding applicative functors is to figure out what structure they preserve. Regular functors preserve the basic categorical structure: they map objects and morphisms between categories, and they preserve the laws of the category (associativity and identity). But a category may have more structure. For instance, it may allow the definition of mappings … Read more

Traversing lists and streams with a function returning a future

I cannot answer it all, but i try on some parts: Is there some reason that the “most asynchronous” behavior—i.e., don’t consume the collection before returning, and don’t wait for each future to complete before moving on to the next—isn’t represented here? If you have dependent calculations and a limited number of threads, you can … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)