Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/smondet/flow
DEPRECATED: Exceptionless “systems” library on top of Core and Lwt (and one day Async?)
https://github.com/smondet/flow
Last synced: 16 days ago
JSON representation
DEPRECATED: Exceptionless “systems” library on top of Core and Lwt (and one day Async?)
- Host: GitHub
- URL: https://github.com/smondet/flow
- Owner: smondet
- License: other
- Created: 2012-11-11T00:09:55.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2014-06-17T11:19:01.000Z (over 10 years ago)
- Last Synced: 2023-03-12T03:03:30.352Z (almost 2 years ago)
- Language: OCaml
- Homepage:
- Size: 448 KB
- Stars: 5
- Watchers: 4
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
The Flow Monad
==============Exceptionless “systems” library on top of Core and Lwt.
Build:
======Just run:
```
omake && omake install
```
(you can control the destination with the standard 'OCAMLFIND_DESTDIR'
variable).Quick Example:
=============The idea is to get the type-checker tell you everything that may go
wrong, and also to force you to treat all cases:```ocaml
#use "topfind"
#thread
#require "flow"
open Core.Stdlet read_some_file_with_timeout () =
Flow.System.with_timeout 4.2 ~f:(fun () ->
Flow.IO.read_file "/etc/passwd")
```The possible errors of `with_timeout` and `read_file` will be merged
and automatically documented:```ocaml
val read_some_file_with_timeout :
unit ->
(string,
[> `io_exn of exn | `read_file_error of string * exn | `timeout of float ])
Flow_base.t =
```You cannot forget one case:
```ocaml
let print_what_happens =
let open Flow in
read_some_file_with_timeout ()
>>< begin function
| Ok () -> say "It's OK!\n"
| Error (`io_exn e) ->
say "I/O Error: %s\n" (Exn.to_string e)
| Error (`timeout f) ->
say "It timeout-ed (%f) !\n" f
end
```OCaml says:
```
Error: This pattern matches values of type
(unit, [< `io_exn of 'a | `timeout of 'b ]) Core.Result.t
but a pattern was expected which matches values of type
(string,
[> `io_exn of exn
| `read_file_error of string * exn
| `timeout of float ])
Core.Result.t
```Links
=====Website: [seb.mondet.org/flow](http://seb.mondet.org/flow)
Documentation:
- [Version 0.2](http://seb.mondet.org/flow/doclib-0.2/index.html).
- [Development version](http://seb.mondet.org/flow/doclib-dev/index.html).Source:
- Current version: [0.2](https://github.com/smondet/flow/archive/0.2.tar.gz)
- Version [0.1](https://github.com/smondet/flow/archive/0.1.tar.gz)
- [Github repository](https://github.com/smondet/flow).Authors:
- [Sebastien Mondet](http://seb.mondet.org),
- [Ashish Agarwal](http://ashishagarwal.org/).License
=======This is the [ISC License](http://en.wikipedia.org/wiki/ISC_license):
```
Copyright (c) 2012, 2013,
Sebastien Mondet ,
Ashish Agarwal .Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all
copies.THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
```