-
Notifications
You must be signed in to change notification settings - Fork 61
Open
Description
As far as I see, there are multiple places where second argument of chainer
is used:
witchcraft/lib/witchcraft/chain.ex
Lines 410 to 431 in 73e3cc6
def do_notation(input, _chainer) do | |
input | |
|> normalize() | |
|> Enum.reverse() | |
|> Witchcraft.Foldable.left_fold(fn | |
continue, {:let, _, [{:=, _, [assign, value]}]} -> | |
quote do: unquote(value) |> (fn unquote(assign) -> unquote(continue) end).() | |
continue, {:<-, _, [assign, value]} -> | |
quote do | |
import Witchcraft.Chain, only: [>>>: 2] | |
unquote(value) >>> fn unquote(assign) -> unquote(continue) end | |
end | |
continue, value -> | |
quote do | |
import Witchcraft.Chain, only: [>>>: 2] | |
unquote(value) >>> fn _ -> unquote(continue) end | |
end | |
end) | |
end |
Instead >>>
(Witchcraft.Chain.chain
) is used.
Is it designed to be so, or it is a typo?
PS IMO it should be
def do_notation(input, chainer) do
input
|> normalize()
|> Enum.reverse()
|> Witchcraft.Foldable.left_fold(fn
continue, {:let, _, [{:=, _, [assign, value]}]} ->
quote do: unquote(value) |> (fn unquote(assign) -> unquote(continue) end).()
continue, {:<-, _, [assign, value]} ->
quote do
apply(unquote(chainer), [unquote(value), fn unquote(assign) -> unquote(continue) end])
end
continue, value ->
quote do
apply(unquote(chainer), [unquote(value), fn _ -> unquote(continue) end])
end
end)
end
cognivore
Metadata
Metadata
Assignees
Labels
No labels