witchcrafters / witchcraft

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

Applicative, preserving mempties of each element #88

Open cognivore opened 3 years ago

cognivore commented 3 years ago

Currently, Applicative for tuples duplicates mempty of the first element: https://github.com/witchcrafters/witchcraft/blob/75b62d87bc2c22917f6d5f2bc42d1e0163d40460/lib/witchcraft/applicative.ex#L221

Since we're not constrained by parametricity, couldn't we preserve "type" of every element kind of for free, making the usually controversial instance for n-tuples, where n>2 a tad less controversial?

github-actions[bot] commented 3 years ago

Thank you for submitting an issue! It means a lot that you took the time -- it helps us be better 🙏