diff --git a/Library/Ancillary/travisci b/Library/Ancillary/travisci index e23cde7..562a87e 100755 --- a/Library/Ancillary/travisci +++ b/Library/Ancillary/travisci @@ -15,7 +15,7 @@ INSTALL_PREFIX="${HOME}/.local" -eval $(opam config env) +eval $(opam config env --switch ${TRAVIS_OCAML_VERSION:?}) autoconf ./configure --prefix="${INSTALL_PREFIX}" bmake -I "${INSTALL_PREFIX}/share/bsdowl" all diff --git a/Makefile b/Makefile index 2c99682..b291589 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt PACKAGE= lemonade -VERSION= 0.3.0 +VERSION= 0.3.1 OFFICER= michipili@gmail.com MODULE= ocaml.lib:src diff --git a/README.md b/README.md index 665641c..60b993f 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,69 @@ monad library for OCaml. It implements the following monads: -- `Lemonade_Lazy` -- `Lemonade_List` -- `Lemonade_Maybe` -- `Lemonade_Success` +- **Lemonade_Continuation** for continuation passing style programming. +- **Lemonade_Lazy** for lazy computations. +- **Lemonade_List** for computations yielding several possible results. +- **Lemonade_Maybe** for computations yielding zero or one result. +- **Lemonade_Reader** for computations explicitly depending on some environment. +- **Lemonade_Retry** for retryable computations. +- **Lemonade_State** for computations modifying a state. +- **Lemonade_Success** for computations failing with context information. +- **Lemonade_Writer** for computations writing a log book. + + +## Setup guide + +It is easy to install **Lemonade** using **opam** and its *pinning* +feature. In a shell visiting the repository, say + +```console +% autoconf +% opam pin add lemonade . +``` + +It is also possible to install **Lemonade** manually. +The installation procedure is based on the portable build system +[BSD Owl Scripts][bsdowl-home] written for BSD Make. + +1. Verify that prerequisites are installed: + - BSD Make + - [BSD OWl][bsdowl-install] + - OCaml + - [Broken][broken-home] + - [Mixture][mixture-home] + - GNU Autoconf + +2. Get the source, either by cloning the repository or by exploding a + [distribution tarball](releases). + +3. Optionally run `autoconf` to produce a configuration script. This + is only required if the script is not already present. + +4. Run `./configure`, you can choose the installation prefix with + `--prefix`. + +5. Run `make build`. + +6. Optionally run `make test` to test your build. + +7. Finally run `make install`. + +Depending on how **BSD Make** is called on your system, you may need to +replace `make` by `bsdmake` or `bmake` in steps 5, 6, and 7. +The **GNU Make** program usually give up the ghost, croaking +`*** missing separator. Stop.` when you mistakingly use it instead of +**BSD Make**. + +Step 7 requires that you can `su -` if you are not already `root`. + + +Michael Grünewald in Aachen, on November 12, 2015 + + [licence-url]: http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html + [licence-en]: COPYING + [licence-fr]: COPYING-FR + [bsdowl-home]: https://github.com/michipili/bsdowl + [bsdowl-install]: https://github.com/michipili/bsdowl/wiki/Install + [broken-home]: https://github.com/michipili/broken + [mixture-home]: https://github.com/michipili/mixture diff --git a/opam/opam b/opam/opam index 23f2909..8c7dcab 100644 --- a/opam/opam +++ b/opam/opam @@ -1,6 +1,7 @@ opam-version: "1.2" maintainer: "michipili@gmail.com" authors: "Michael Grünewald" +version: "0.3.1" license: "CeCILL-B" homepage: "https://github.com/michipili/lemonade" bug-reports: "https://github.com/michipili/lemonade/issues" @@ -25,7 +26,7 @@ remove: [ depends: [ "broken" {>= "0.4.2"} "bsdowl" {>= "3.0.0"} - "mixture"{>= "0.2.0"} + "mixture"{>= "0.2.1"} "ocamlfind" ] depexts: [ diff --git a/src/lemonade_Type.ml b/src/lemonade_Type.ml index 1c79281..49cd07e 100644 --- a/src/lemonade_Type.ml +++ b/src/lemonade_Type.ml @@ -36,6 +36,7 @@ sig val ( <* ) : 'a t -> 'b t -> 'a t val ( >* ) : 'a t -> 'b t -> 'b t val ( >>= ) : 'a t -> ('a -> 'b t) -> 'b t + val ( >|= ) : 'a t -> ('a -> 'b) -> 'b t val ( >> ) : 'a t -> (unit -> 'b t) -> 'b t val ( >=> ) : ('a -> 'b t) -> ('b -> 'c t) -> ('a -> 'c t) val ( <=< ) : ('b -> 'c t) -> ('a -> 'b t) -> ('a -> 'c t) diff --git a/src/lemonade_Type.mli b/src/lemonade_Type.mli index f2f71e3..842c89d 100644 --- a/src/lemonade_Type.mli +++ b/src/lemonade_Type.mli @@ -88,6 +88,9 @@ sig val ( >>= ) : 'a t -> ('a -> 'b t) -> 'b t (** [ m >>= f] is equivalent to [bind m f]. *) + val ( >|= ) : 'a t -> ('a -> 'b) -> 'b t + (** A composable shorthand for [map]. *) + val ( >> ) : 'a t -> (unit -> 'b t) -> 'b t (** [m >> f] binds [m] to [f], a context function. *)