[Haskell-cafe] Proposal: Infix expression keyword: -XInfixExpressions
vogt.adam at gmail.com
Fri Feb 20 19:12:29 UTC 2015
On Thu, Feb 19, 2015 at 10:42 AM, Christopher Done <chrisdone at gmail.com> wrote:
> 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?
I think this is a half-solution to the third option:
Rather than adding more syntax, maybe it's better to make polymorphic
functions/values easier to create. Writing instances of ApplyAB is a
pain, but ghc could help, as it does with this quasiquoter
More information about the Haskell-Cafe