New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

monadicjs

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

monadicjs

javascript monad library with do-notation

latest
npmnpm
Version
0.0.6
Version published
Weekly downloads
4
300%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status

Monad library for JavaScript

Monads can be very useful for async IO. They succefully appeared in Haskell. Haskell provides the do notation for executing monads. And this library ports do to JavaScript. Something that looks like this in Haskell

  do {
    fileContent <- readFile "README.md"
    putStr fileContent
  }

will look like this in JavaScript:

  const fs = require("fs")
  do_(function*() {
    const fileContent = yield fs.readFile.bind(null, "README.md")
    console.log(fileContent)
  })

Checkout tests how to experiment with it.

You will not be able to code every monad that one can programm in Haskell (like the list monad), but a lot is possible with this approach. Here is what you can do in Haskell but not with this library:

  do {
    x <- [1,2,3]
    return (2*x)
  } {- [2,4,6] -}

Available monads

Ideas

Keywords

monad

FAQs

Package last updated on 08 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts