4 ms·
Thanks for the proposals. How would you make your first variant, work with pattern matching? I like the second variant better, because it seems to work with p
by reirob 11y ago
Thanks for the proposals.
How would you make your first variant, work with pattern matching?
I like the second variant better, because it seems to work with pattern matching. It would as well have to work without type declarations, letting Haskell infer the types.
But all in all I prefer the way function definition is implemented now. The record issue is more of a trouble - for it Frege actually has some improvements.
- nnq 11y agoThanks for examining the proposals. All in all I don't think improving this bit of syntax would actually mean this much, it's only worth considering when you start a new language from scratch. But the records names / TDNR issue, this makes a real difference, I'll definitely take a look at Frege if I'll need functional programming on the JVM ...as Scala just seems too scary for me. Now, about what I proposed above, I meant the two examples as different cases of the same syntax, newlines should not really make a difference until after the "=". So you'd use the second variant for pattern matching: myFunctionFoo :: Int -> Int -> Int -> Int : 1 b c = 1984 - c : a b c = 2*a + 3*b + 4*c But it's probably better to direct your effort elsewhere. I see that even Typed Clojure prefers to repeat the name of a symbol instead of bothering to rearrange everything else just to avoid this repetition. ...and it's probably not worth spoiling the beauty of the ML-style-syntax for this. I admit it, I find it 10x easier to read either Lisps or C-syntax-like languages than MLs, but there is a beauty in the ML way, and math folks seem to love it, so better keep it that way :)
- voxfrege 11y agoActually, you can write: foo = (\a -> \b -> (a+b)*(a-b)) :: Num z => z -> z -> z HOwever, it is quite un-idiomatic, of course.