function >>>/2 imported from both Witchcraft.Chain and Exceptional.Raise, call is ambiguous
expanding macro: Witchcraft.Monad.monad/2
If I try to do instead:
use Witchcraft, only: [monad: 2]
use Exceptional
Then I get:
:only and :except can only be given together to import when :only is either :functions or :macros
I am trying to add some error processing to my Timex usage which is not safe presently. I have copy pasted the code below to get an idea of my use case. It is used in a Phoenix web application.
stream = monad Either.new() do
date1 <- case Map.fetch(params, "date1") do
{:ok, date1_s} -> case Date.from_iso8601(date1_s) do
{:ok, date} -> date |> Timex.to_datetime(:local) |> Either.Right.new
{:error, reason} -> Either.Left.new("error for date1: #{inspect(reason)}")
end
:error -> Timex.now(:local) |> Timex.beginning_of_day |> Either.Right.new
end
# ...
return HydroDB.Database.defaults(site, date1, date2, gens, newdefaults, regex)
end
case stream do
%Either.Right{right: stream_} -> send_stream(conn, stream_, "text/xml")
%Either.Left{left: error} -> send_resp(conn, 422, error)
end
I use Elixir 1.10.2. My module has:
but at compilation time I get:
If I try to do instead:
Then I get:
I am trying to add some error processing to my
Timex
usage which is not safe presently. I have copy pasted the code below to get an idea of my use case. It is used in a Phoenix web application.