-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added logo, updated project desc & README.
- Loading branch information
Showing
5 changed files
with
109 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,23 @@ | ||
 | ||
# coers | ||
|
||
coers | ||
===== | ||
[![Project Logo][logo]][logo-large] | ||
|
||
*A small library for coercion to primitive Erlang types* | ||
|
||
## About | ||
|
||
Coers is a very small library to provide small coercion | ||
on primitive types in Erlang. This library was built | ||
essentially for internal tools at derniercri.io | ||
|
||
Build & test | ||
----- | ||
## Build & Test | ||
|
||
$ # Compile the library | ||
$ rebar3 compile | ||
$ # run the tests using eUnit | ||
$ rebar3 eunit | ||
|
||
|
||
Usage | ||
-------- | ||
|
||
You can run an erlang shell with `coers` completely loaded : `rebar3 shell` : | ||
|
||
```shell | ||
===> Verifying dependencies... | ||
===> Compiling coers | ||
Erlang/OTP 19 [erts-8.1] [source] [64-bit] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false] [dtrace] | ||
|
||
Eshell V8.1 (abort with ^G) | ||
``` | ||
|
||
### Basics | ||
## Usage | ||
|
||
Each coercion is wrapped into a special record: | ||
|
||
|
@@ -62,9 +51,35 @@ For example : | |
[10,0] | ||
``` | ||
|
||
Documentation | ||
-------- | ||
Example usgage in LFE: | ||
|
||
``` lisp | ||
(defun ->lfe (arg) | ||
(case arg | ||
(#"#t" 'true) | ||
(#"#f" 'false) | ||
(#"NIL" 'nil) | ||
(_ (cond ((?= `#(result true ,val) (coers:to_int arg)) | ||
val) | ||
((?= `#(result true ,val) (coers:to_float arg)) | ||
val) | ||
((?= `#(result true ,val) (coers:to_bool arg)) | ||
val) | ||
((?= `#(result true ,val) (coers:to_string arg)) | ||
val) | ||
('true arg))))) | ||
``` | ||
|
||
## License | ||
|
||
MIT | ||
|
||
Copyright © 2016, Xavier van De Woestyne | ||
|
||
Copyright © 2020, Duncan McGreggor <[email protected]>. | ||
|
||
This page exposes the feature list : <http://xvw.github.io/coers/coers.html> | ||
|
||
[//]: ---Named-Links--- | ||
|
||
[logo]: priv/images/logo-v1.png | ||
[logo-large]: priv/images/logo-v1.svg |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.