-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Still a bunch more to do, but this is already much better. Merging to master, and will continue to tighten stuff up and work through the roadmap.
- Loading branch information
Showing
33 changed files
with
597 additions
and
900 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
language: elixir | ||
elixir: | ||
- 1.3.2 | ||
otp_release: | ||
- 19.0.2 | ||
script: mix test; mix credo --strict | ||
after_script: | ||
- MIX_ENV=docs mix do deps.get, inch.report |
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
File renamed without changes
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
%{ | ||
configs: [ | ||
%{ | ||
name: "default", | ||
files: %{ | ||
included: ["lib/", "test"], | ||
excluded: [] | ||
}, | ||
checks: [ | ||
{Credo.Check.Consistency.TabsOrSpaces}, | ||
{Credo.Check.Design.AliasUsage, false}, | ||
{Credo.Check.Readability.MaxLineLength, priority: :low, max_length: 100} | ||
] | ||
} | ||
] | ||
} |
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,48 +1,13 @@ | ||
defmodule Witchcraft do | ||
@moduledoc ~S""" | ||
For convenience, the most common functions and operators are exported at the top-level | ||
""" | ||
@moduledoc "Convenient top-level `use`" | ||
|
||
# ====== | ||
# Monoid | ||
# ====== | ||
defdelegate identity(specemin), to: Witchcraft.Monoid | ||
defmacro __using__(_) do | ||
quote do | ||
use Witchcraft.Monoid | ||
|
||
defdelegate append(a, b), to: Witchcraft.Monoid | ||
defdelegate a <|> b, to: Witchcraft.Monoid.Operator | ||
|
||
# ======= | ||
# Functor | ||
# ======= | ||
defdelegate lift(data, function), to: Witchcraft.Functor | ||
defdelegate lift(function), to: Witchcraft.Functor.Function | ||
defdelegate lift(), to: Witchcraft.Functor.Function | ||
|
||
defdelegate data ~> func, to: Witchcraft.Functor.Operator | ||
defdelegate func <~ data, to: Witchcraft.Functor.Operator | ||
|
||
defdelegate replace(functor_data, const), to: Witchcraft.Functor.Function | ||
|
||
# =========== | ||
# Applicative | ||
# =========== | ||
defdelegate wrap(specemin, bare), to: Wicthcraft.Applicative | ||
|
||
defdelegate apply(wrapped_value, wrapped_function), to: Witchcraft.Applicative | ||
defdelegate value ~>> fun, to: Witchcraft.Applicative.Operator | ||
defdelegate fun <<~ value, to: Witchcraft.Applicative.Operator | ||
|
||
# Figure out the liftAs | ||
|
||
defdelegate seq_first([a,b]), to: Witchcraft.Applicative.Function | ||
defdelegate seq_second([a,b]), to: Witchcraft.Applicative.Function | ||
|
||
# ===== | ||
# Monad | ||
# ===== | ||
defdelegate join(deep), to: Witchcraft.Monad | ||
|
||
defdelegate bind(wrapped, fun), to: Witchcraft.Monad.Function | ||
defdelegate wrapped >>> fun, to: Witchcraft.Monad.Operator | ||
defdelegate fun <<< wrapped, to: Witchcraft.Monad.Operator | ||
use Witchcraft.Functor | ||
use Witchcraft.Applicative | ||
use Witchcraft.Monad | ||
end | ||
end | ||
end |
File renamed without changes.
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
Oops, something went wrong.