mirror of
https://github.com/correl/calrissian.git
synced 2024-11-23 19:19:57 +00:00
commit
81abdb806f
2 changed files with 15 additions and 15 deletions
28
README.rst
28
README.rst
|
@ -71,28 +71,28 @@ and execution will cease.
|
||||||
|
|
||||||
.. code:: scheme
|
.. code:: scheme
|
||||||
|
|
||||||
(include-lib "deps/calrissian/include/monads.lfe")
|
(include-lib "calrissian/include/monads.lfe")
|
||||||
|
|
||||||
(defun dostuff ()
|
(defun dostuff ()
|
||||||
(do-m (monad 'error)
|
(do-m (monad 'error)
|
||||||
(input <- (fetch-input)) ;; fetch-input -> (tuple 'ok result) | (tuple 'error reason)
|
(input <- (fetch-input)) ;; fetch-input -> (tuple 'ok result) | (tuple 'error reason)
|
||||||
(parsed <- (parse-input input)) ;; parse-input -> (tuple 'ok result) | (tuple 'error reason)
|
(parsed <- (parse-input input)) ;; parse-input -> (tuple 'ok result) | (tuple 'error reason)
|
||||||
(store-data parsed))) ;; store-data -> 'ok | (tuple 'error reason)
|
(store-data parsed))) ;; store-data -> 'ok | (tuple 'error reason)
|
||||||
|
|
||||||
Without the error monad, the code might have looked like this:
|
Without the error monad, the code might have looked like this:
|
||||||
|
|
||||||
.. code:: scheme
|
.. code:: scheme
|
||||||
|
|
||||||
(defun dostuff ()
|
(defun dostuff ()
|
||||||
(case (fetch-input)
|
(case (fetch-input)
|
||||||
((tuple 'error reason)
|
((tuple 'error reason)
|
||||||
(tuple 'error reason))
|
(tuple 'error reason))
|
||||||
((tuple 'ok input)
|
((tuple 'ok input)
|
||||||
(case (parse-input input)
|
(case (parse-input input)
|
||||||
((tuple 'error reason)
|
((tuple 'error reason)
|
||||||
(tuple 'error reason))
|
(tuple 'error reason))
|
||||||
((tuple 'ok parsed)
|
((tuple 'ok parsed)
|
||||||
(store-data parsed))))))
|
(store-data parsed))))))
|
||||||
|
|
||||||
.. Links
|
.. Links
|
||||||
.. -----
|
.. -----
|
||||||
|
|
|
@ -9,7 +9,7 @@ OUT_DIR = ./ebin
|
||||||
TEST_DIR = ./test
|
TEST_DIR = ./test
|
||||||
TEST_OUT_DIR = ./.eunit
|
TEST_OUT_DIR = ./.eunit
|
||||||
SCRIPT_PATH=$(DEPS)/lfe/bin:.:./bin:"$(PATH)":/usr/local/bin
|
SCRIPT_PATH=$(DEPS)/lfe/bin:.:./bin:"$(PATH)":/usr/local/bin
|
||||||
ERL_LIBS=$(shell $(LFETOOL) info erllibs)
|
ERL_LIBS=$(shell pwd):$(shell $(LFETOOL) info erllibs)
|
||||||
EMPTY =
|
EMPTY =
|
||||||
ifeq ($(shell which lfetool),$EMPTY)
|
ifeq ($(shell which lfetool),$EMPTY)
|
||||||
LFETOOL=$(BIN_DIR)/lfetool
|
LFETOOL=$(BIN_DIR)/lfetool
|
||||||
|
|
Loading…
Reference in a new issue