Skip to content

Commit

Permalink
Minor consistency fixes.
Browse files Browse the repository at this point in the history
This updates the documentation format to be similar to my other libraries, as well as an update to source indentation.
  • Loading branch information
jkrukoff committed Mar 23, 2019
1 parent 06f5c21 commit 20ebe60
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# pipe #

![Pipeline Construction](doc/pipeline.jpg)

### Overview ###

![Pipeline Construction](doc/pipeline.jpg)
### Overview ###

This is an Erlang/OTP library for piping a value through a list of functions,
in the spirit of [Haskell's do
Expand All @@ -26,6 +26,12 @@ The initial value is threaded through each function given and the final result
is returned.


## Modules ##

<table width="100%" border="0" summary="list of modules">
<tr><td><a href="http://github.com/jkrukoff/pipe/blob/master/doc/pipe.md" class="module">pipe</a></td></tr></table>


### Getting Started ###

This library is published to [hex.pm](https://hex.pm) as
Expand Down Expand Up @@ -279,9 +285,3 @@ the functionality described here could be layered.
Image by Jukka Isokoski

CC BY-SA 3.0 [`https://creativecommons.org/licenses/by-sa/3.0`](https://creativecommons.org/licenses/by-sa/3.0)


## Modules ##

<table width="100%" border="0" summary="list of modules">
<tr><td><a href="http://github.com/jkrukoff/pipe/blob/master/doc/pipe.md" class="module">pipe</a></td></tr></table>
12 changes: 6 additions & 6 deletions src/pipe.erl
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ if_not_error(Fun, Value) ->
?SPEC_MONAD(if_not_throw).
if_not_throw(Fun, Value) ->
Try = fun (Unwrapped) ->
try Fun(Unwrapped)
catch
throw:Reason ->
exception_as_error(throw, Reason)
end
end,
try Fun(Unwrapped)
catch
throw:Reason ->
exception_as_error(throw, Reason)
end
end,
case Value of
{ok, Ok} ->
Try(Ok);
Expand Down
8 changes: 4 additions & 4 deletions test/test_pipe.erl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%%%-------------------------------------------------------------------
%%% @doc
%%%
%%% Tests for src/pipe.erl
%%% @end
%%%-------------------------------------------------------------------
-module(test_pipe).
Expand Down Expand Up @@ -82,9 +82,9 @@ pipe_test_() ->
not_commutative()]))},
{"multiple applies",
?_assertEqual(value, pipe:pipe([fun pipe:if_ok/2, fun pipe:ignore/2],
{ok, value},
[constant({ok, computed}),
constant(computed)]))},
{ok, value},
[constant({ok, computed}),
constant(computed)]))},
{"apply ordering",
?_assertEqual({ok, value}, pipe:pipe([fun pipe:ignore/2, fun pipe:if_ok/2],
{ok, value},
Expand Down

0 comments on commit 20ebe60

Please sign in to comment.