Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/athanclark/purescript-monad-control

A clone of monad-control in purescript
https://github.com/athanclark/purescript-monad-control

lift monad-control monad-transformers purescript

Last synced: 6 days ago
JSON representation

A clone of monad-control in purescript

Awesome Lists containing this project

README

        

# purescript-monad-control

[![Build Status](https://travis-ci.org/athanclark/purescript-monad-control.svg?branch=master)](https://travis-ci.org/athanclark/purescript-monad-control)
[![Pursuit](https://pursuit.purescript.org/packages/purescript-monad-control/badge)](https://pursuit.purescript.org/packages/purescript-monad-control)

This is a clone of Bas van Dijk and Anders Kaseorg's [monad-control](http://hackage.haskell.org/package/monad-control)
library for purescript.

What is the point of this library? From what I see, monad transformers only give you a one-way valve - you can lift "up",
but "running" a transformer is specific for each one. What this library provides is a method to "going down, then coming up".
It is essentially a continuation for monad morphisms. This is extremely useful when you need to run a high-level action
in a lower one (like as `IO` or `Eff`), before lifting it back up:

```haskell
async' :: (MonadBaseControl IO m) => m a -> m (Async a)
asnyc' x = do
liftBaseWith $ \runInBase ->
async $ (runInBase x :: IO a)
```