-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
116 additions
and
3 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
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,6 +1,27 @@ | ||
defmodule Control.Helpers do | ||
@moduledoc """ | ||
A set of helper functions to ease the process of | ||
working with the `Control.*` protocols. | ||
""" | ||
|
||
alias Control.Monad | ||
|
||
@compile {:inline, ~>>: 2} | ||
|
||
@doc """ | ||
Bind operator. | ||
The bind operator (`>>=` in Haskell) removes the need | ||
for piping to a call to `Control.Monad.bind/2`, so | ||
functor |> Control.Monad.bind(fun) | ||
becomes | ||
functor ~>> fun | ||
""" | ||
@spec (Monad.t ~>> (term -> Monad.t)) :: Monad.t | ||
def left ~>> right do | ||
Control.Monad.bind(left, right) | ||
Monad.bind(left, right) | ||
end | ||
end |
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
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