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.
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%)
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:
Oh look, it's now shorter than the original signature (though somewhat more noisy, I'll give you that)