News for hackers. Stuff that matters.
Re:What I Wish I Knew When Learning Haskell by evincarofautumn on Saturday September 12, 2015 @08:58PM (#10209961)
Well, just for the sake of discussion, would you prefer something like this?

    def M2<T1, T2, Result, Action : Monad>(
      f: (T1, T2) => Result,
      a: Action<T1>,
      b: Action<T2>): Action<Result>
    {
      …
    }
The Haskell notation is a simple, concise representation of the actual semantics. If you try to transpose those semantics to a more conventional notation intended for different semantics, it gets complicated due to the mismatch.

This notation I’ve suggested doesn’t even accurately express such details as currying and typeclasses, which the original notation conveys neatly.

Re:What I Wish I Knew When Learning Haskell by eximius on Sunday September 13, 2015 @02:38PM (#10212329)
Aw, the Rust people will be either happy or sad about this.
Re:What I Wish I Knew When Learning Haskell by evincarofautumn on Sunday September 13, 2015 @04:34PM (#10212719)
Both at once, I imagine. Compromises were struck, and I think they were quite reasonable.
Re:What I Wish I Knew When Learning Haskell by pekk on Saturday September 12, 2015 @10:54PM (#10210190)
Just for the sake of discussion, what is actually wrong with the syntax you just invented?
Re:What I Wish I Knew When Learning Haskell by tel on Sunday September 13, 2015 @01:33AM (#10210454)
Here are a few possible complaints:

    1. It's way longer
    2. Naming the monad "Action" may be misleading depending 
       on choice of Monad
    3. It's tied syntactically to the syntax of the implementation
    4. The <>s are superfluous
    5. The argument names are superfluous (to the type)
    6. The explicit type quantification is superfluous and verbose
Re:What I Wish I Knew When Learning Haskell by masklinn on Sunday September 13, 2015 @04:47AM (#10210743)
> It's way longer

Because of the much longer type names which have nothing to do with the syntax.

By just replacing all the type names by the original single-letter names, it goes from 107 to 72 characters, that's almost 50% increase in size (49%) due to longer type names, which incidentally is nearly double the increase in size between the Haskell signature and this new signature (57 -> 72, or 26%)

    def M2<A1, A2, R, M: Monad>(f: (A1, A2) => R, a: M<A1>, b: M<A2>): M<R>
Funnily enough, this expansion is relatively worse if applied to the Haskell signature (57 -> 87, +53%)

> Naming the monad "Action" may be misleading depending on choice of Monad

Nothing to do with syntax either.

> It's tied syntactically to the syntax of the implementation

?

> The argument names are superfluous (to the type)

That can trivially be removed when just displaying the function's type (`f`'s arguments are not explicitly named after all), likewise for the unnecessary type quantifications, so a type-view of this function (rather than a source view) could be:

    def M2<M: Monad>((A1, A2) => R, M<A1>, M<A2>) => M<R>
Oh look, it's now shorter than the original signature (though somewhat more noisy, I'll give you that)
Re:What I Wish I Knew When Learning Haskell by evincarofautumn on Sunday September 13, 2015 @08:23AM (#10211130)
Conventions are as important as syntax when it comes to legibility of a language, so phrasing “M” as “Action” seemed a fair comparison. And if you want to be true to the semantics, you might write something like this:

    def M2 ((A1 => A2 => R) => M<A1> => M<A2> => M<R>) where Monad<M>
At which point the Haskell syntax is shorter. However, concision is not the goal—it’s merely a proxy for clarity.
Re:What I Wish I Knew When Learning Haskell by masklinn on Monday September 14, 2015 @07:53AM (#10214644)
> Conventions are as important as syntax when it comes to legibility of a language, so phrasing “M” as “Action” seemed a fair comparison.

But the conventions are whatever we want for a resyntacting no?

> However, concision is not the goal

I was answering a comment putting concision forward as reasons to dislike the alternate syntax.

Re:What I Wish I Knew When Learning Haskell by tel on Monday September 14, 2015 @06:16AM (#10214388)
Hey, I didn't say one was worse or better but merely suggested some arguments as to why one might dislike that signature.

Clearly, as you demonstrate, the syntax described can be shortened—but it wasn't.

And by the definition being tied to the implementation I mean that it's not possible to write, e.g.

    foo :: Type1
    bar :: Type2

    foo = ...
    bar = ...
Re:What I Wish I Knew When Learning Haskell by masklinn on Monday September 14, 2015 @07:51AM (#10214639)
> Hey, I didn't say one was worse or better but merely suggested some arguments as to why one might dislike that signature.

pekk asked what was wrong with the syntax.

> Clearly, as you demonstrate, the syntax described can be shortened—but it wasn't.

I didn't change the syntax in any way.

> And by the definition being tied to the implementation I mean that it's not possible to write, e.g.

'k.

Is that actually used? Global type inference I could see, but that seems odder.

Re:What I Wish I Knew When Learning Haskell by tel on Tuesday September 15, 2015 @02:26PM (#10222327)
Fair enough. I conflated syntax with convention.

It is used quite frequently, actually, e.g. in describing type classes.