diff --git a/.gitignore b/.gitignore index 4d159c2..f1f0da9 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /output/ /.psci* /src/.webpack.js +/test/ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..15bacc0 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,17 @@ +language: node_js +dist: trusty +sudo: required +node_js: 6 +install: + - npm install -g bower + - npm install +script: + - bower install --production + - npm run -s build + - bower install + - npm -s test +after_success: +- >- + test $TRAVIS_TAG && + echo $GITHUB_TOKEN | pulp login && + echo y | pulp publish --no-push diff --git a/README.md b/README.md new file mode 100644 index 0000000..f97b232 --- /dev/null +++ b/README.md @@ -0,0 +1,47 @@ +# purescript-io + +An IO monad for PureScript. + +Don't ask. Don't tell. Joyfully use in secrecy. + +# Introduction + +PureScript's effect system is based on row types, and has no semantic or +algebraic basis. Often, the effect labels have poorly-defined meanings, and +different libraries use completely different labels to represent the same or +overlapping effects. + +While the effect system is undoubtedly useful, there are cases where it's more +of a hindrance — where it doesn't make reasoning about code easier, but instead, +merely adds a ton of boilerplate and semantically meaningless labels get +threaded through endless stacks of functions. + +In those cases, `IO` is here to the rescue! + +`IO a` represents a computation that may be synchronous or asynchronous, and +which will either yield a value of type `a`, run forever, or halt with a +catchable exception. + +Under the covers, `IO` is based on `Aff`, and there is no wrapper so there is +no runtime overhead or performance penalty for `IO`. + +# Usage + +`IO` only has one function, which should only be used in your `main`: + +```haskell +runIO :: forall a. IO a -> AffIO a +``` + +This converts an `IO` into an `Aff`, which you can then "convert" into a +runnable `Eff` using `launchAff` or `runAff`. + +The effect row is closed, which is intentionally because `INFINITY` represents +all possible effects. This will help ensure you only call `runIO` at the top +level of your program. + +Besides this, `IO` has almost all the same instances as `Aff`, and may be used +in the same way. In addition, a new `MonadIO` class has been introduced which +allows you to lift `IO` computations into other monads that are as powerful. + +Happy nuke launching! diff --git a/src/Main.purs b/src/Main.purs deleted file mode 100644 index abe68ec..0000000 --- a/src/Main.purs +++ /dev/null @@ -1,9 +0,0 @@ -module Main where - -import Prelude -import Control.Monad.Eff (Eff) -import Control.Monad.Eff.Console (CONSOLE, log) - -main :: forall e. Eff (console :: CONSOLE | e) Unit -main = do - log "Hello sailor!"