Skip to content

Commit

Permalink
Fix various documentation references and typespecs
Browse files Browse the repository at this point in the history
There's a few classes of fixes here:
- References to types in modules that haven't been aliased
- References to types that haven't been defined
- Overlapping typespecs that refer to the wrong function name or arity
  • Loading branch information
QuinnWilton committed Jan 24, 2022
1 parent af3e4ee commit 5e9b17d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions lib/witchcraft/apply.ex
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ defclass Witchcraft.Apply do
[-2, -3, -1, -2, 1, 0, 3, 2]
"""
@spec over(fun(), Apply.t(), Apply.t(), Apply.t()) :: Apply.t()
@spec over(fun(), Apply.t(), Apply.t(), Apply.t(), Apply.t()) :: Apply.t()
def over(fun, a, b, c, d), do: fun |> over(a, b, c) |> ap(d)

@doc """
Expand Down Expand Up @@ -587,7 +587,7 @@ defclass Witchcraft.Apply do
[-2, -3, -1, -2, 1, 0, 3, 2]
"""
@spec async_over(fun(), Apply.t(), Apply.t(), Apply.t()) :: Apply.t()
@spec async_over(fun(), Apply.t(), Apply.t(), Apply.t(), Apply.t()) :: Apply.t()
def async_over(fun, a, b, c, d), do: fun |> async_over(a, b, c) |> async_ap(d)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/witchcraft/arrow.ex
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ defclass Witchcraft.Arrow do
430
"""
@spec precompose(Arrow.t(), fun()) :: Arrow.t()
@spec postcompose(Arrow.t(), fun()) :: Arrow.t()
def postcompose(arrow, fun), do: arrow <~> arrowize(arrow, fun)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/witchcraft/chain.ex
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ defclass Witchcraft.Chain do
Sequences chainable actions. Note that each line must be of the same type.
For a version with `return`, please see `Witchcraft.Monad.do/2`
For a version with `return`, please see `Witchcraft.Monad.monad/2`
## Examples
Expand Down
6 changes: 3 additions & 3 deletions lib/witchcraft/foldable.ex
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ defclass Witchcraft.Foldable do
2
"""
@spec max(Foldable.t(), by: (any, any -> Order.ordering())) :: Ord.t()
@spec max(Foldable.t(), by: (any, any -> Ord.ordering())) :: Ord.t()
def max(foldable, by: comparator) do
Witchcraft.Foldable.right_fold(foldable, fn focus, acc ->
case comparator.(focus, acc) do
Expand Down Expand Up @@ -395,7 +395,7 @@ defclass Witchcraft.Foldable do
8
"""
@spec min(Foldable.t(), by: (any(), any() -> Order.t())) :: any() | Maybe.t()
@spec min(Foldable.t(), by: (any(), any() -> Ord.t())) :: any()
def min(foldable, by: comparitor) do
right_fold(foldable, fn focus, acc ->
case comparitor.(focus, acc) do
Expand Down Expand Up @@ -787,6 +787,6 @@ defclass Witchcraft.Foldable do
]
"""
@spec then_traverse(Apply.fun(), Foldable.t()) :: Apply.t()
@spec then_through(Apply.fun(), Foldable.t()) :: Apply.t()
def then_through(fun, traversable), do: then_traverse(traversable, fun)
end
8 changes: 6 additions & 2 deletions lib/witchcraft/monad.ex
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ defclass Witchcraft.Monad do
For a nice, illustrated introduction,
see [Functors, Applicatives, And Monads In Pictures](http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_pictures.html).
Having `of` also lets us enhance do-notation with a convenuenct `return` function (see `monad/2`)
Having `of` also lets us enhance do-notation with a convenient `return` function (see `monad/2`)
## Type Class
Expand All @@ -36,6 +36,8 @@ defclass Witchcraft.Monad do
[_]
"""

alias Witchcraft.Chain

extend Witchcraft.Applicative
extend Witchcraft.Chain

Expand All @@ -44,6 +46,8 @@ defclass Witchcraft.Monad do
use Witchcraft.Applicative
use Witchcraft.Chain

@type t :: any()

properties do
import Witchcraft.Applicative
import Witchcraft.Chain
Expand Down Expand Up @@ -110,7 +114,7 @@ defclass Witchcraft.Monad do
end

@doc "Alias for `async_chain/2`"
@spec async_chain(Chain.t(), Chain.link()) :: Chain.t()
@spec async_bind(Chain.t(), Chain.link()) :: Chain.t()
def async_bind(chainable, link), do: async_chain(chainable, link)

@doc """
Expand Down

0 comments on commit 5e9b17d

Please sign in to comment.