Skip to content

突然想到 Javascript 里的 async-await 和 Haskell 里的 do-notation 是一个东西 #4

Description

@impasse

Javascript 里面的 Promise 对应 Haskell 里的 Monad,把操作封装在 Promise/Monad 里。

async function do(){
  let a = await JobOne();
  let b = await JobTwo();
  return c;
}
do' = do
  a <- job_one
  b <- job_two
  return c

只不过没有haskell那些类型约束=-=

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions