4 ms·
Being introduced to Miranda was a revelation to me back in the day. I still prefer aspects of Miranda syntax over Haskell. For example, the formatting of guar
by derriz 9y ago
Being introduced to Miranda was a revelation to me back in the day. I still prefer aspects of Miranda syntax over Haskell. For example, the formatting of guards in Miranda:
gcd a b = gcd (a-b) b, if a>b
= gcd a (b-a), if a<b
= a, if a=b
versus Haskell
gcd a b | a>b = gcd (a-b) b
| a<b = gcd a (b-a)
| a==b = a
I know it's a small thing and you can get used to such differences but since FP became just an occasional side interest for me, I never made the switch as a heavyish Miranda user to Haskell. For a long time even getting a Haskell compiler to run was a massive pain.
So I started using Mark Jones' Gofer[1] interpreter which was trivial to build and still is 20 years later assuming you can find the source tar ball. It kept the nicer syntax of Miranda and added most of the power features of Haskell. I particularly liked the generalized list comprehension feature which really should have made it into Haskell; things like combinator parser code reads beautifully with it.
I know it's what you're used to but Haskell code always looks ugly to me in comparison to Miranda or Gofer.
[1] https://en.wikipedia.org/wiki/Gofer_(programming_language) https://en.wikipedia.org/wiki/Gofer_(programming_language)
- i_don_t_know 9y agoI vaguely seem to remember that the designer's of Haskell picked a different syntax for guards to make the language look less like Miranda. Miranda was owned by a private company (IIRC) and they didn't want to run the risk of infringing on their IP. But I don't know if that's really true.
- rjeli 9y agoI agree that Haskell guards are aesthetically uglier, but they're much easier to read with the conditional before the result.
- theoh 9y agoSomeday the equivalence between the notations will make it possible to (gasp) automagically translate between the two. If we're still typing programs.
- rjeli 9y agoAnd then we'll have AST wars instead of language wars... unless we can compile to and from Turing machine instructions :-D
- Risord 9y agoHopefully we skip that AST phase and go directly more meaningful and still less visual related layer. Is it called ASG or something. Edit: We probably have wars anyway but I think after that our wars are about something that really matters.
- n4r9 9y agoI found the Miranda version much easier to read. But then I'm a mathematician who has never used Haskell, and it's fairly similar to how mathematicians write multi-line functions.
- GregBuchholz 9y agoIf you like "if guards", and want a non-whitespace delimited, strict, dynamically typed language, check out the Pure language: gcd a b = gcd (a-b) b if a>b; = gcd a (b-a) if a<b; = a otherwise; https://agraef.github.io/pure-lang/ https://agraef.github.io/pure-lang/
- houli 9y agoIt's mentioned in the Wikipedia article that monad comprehensions are available as a GHC language extension