[Haskell-cafe] Proposal: Infix expression keyword: -XInfixExpressions
Christopher Done
chrisdone at gmail.com
Thu Feb 19 15:42:17 UTC 2015
On 19 February 2015 at 16:29, Erik Hesselink <hesselink at gmail.com> wrote:
> If I'm reading it correctly, the only example where a fold wouldn't
> work is <*>, right? And probably conduits, I don't know the types
> there.
Right, I see three use-cases:
* Some things are foldable cleanly like monoids, so you can just
mconcat [x,y,z] and that'll be inlined (I think).
* Other things like x <|> y is not the same as asum [x,y] due to the
additional mempty being introduced. You can also use foldl1 kind of
functions, but they are partial and therefore not desirable.
* Finally, things like <*>, $=, $, ., #/:& (e.g. in HList/vinyl) can't
be folded at all, because the types are different.
The third use-case doesn't have a solution that I'm aware of. So this
solves that. It also solves the second use-case, which has only a
partial (he he) solution. The first use-case is just a bonus. Should I
add this clarification to the proposal?
More information about the Haskell-Cafe
mailing list