witchcrafters / witchcraft

Monads and other dark magic for Elixir
https://witchcrafters.github.io
MIT License
1.2k stars 58 forks source link

fully qualify Witchcraft.Apply.then/2 to avoid name conflict in Elixir 1.12+ #86

Closed baseballlover723 closed 3 years ago

baseballlover723 commented 3 years ago

Summary

Elixir 1.12 introduces a new kernel method: Kernel.then/2, this causes witchcraft to not compile on Elixir 1.12+ with

** (CompileError) lib/witchcraft/foldable.ex:751: function then/2 imported from both Witchcraft.Apply and Kernel, call is ambiguous
    (elixir 1.12.0-rc.1) src/elixir_dispatch.erl:42: :elixir_dispatch.import_function/4
    (elixir 1.12.0-rc.1) src/elixir_fn.erl:76: :elixir_fn.capture_import/4
    (stdlib 3.14.2) lists.erl:1358: :lists.mapfoldl/3
    (stdlib 3.14.2) lists.erl:1359: :lists.mapfoldl/3

This PR fully qualifies Witchcraft.Apply.then/2 so that then/2 is no longer ambiguous.

This PR fixes/implements the following bugs/features

Explain the motivation for making this change. What existing problem does the pull request solve? You can't use witchcraft on Elixir 1.12+.

Test plan (required)

Run the tests with Elixir 1.12.2

Closing issues

Fixes #

After Merge