16 ms·
Cutting to the chase: use Haskell or Scala or F# if you need to do some scripting or build a web application that requires lots of different tasks (being a web
by eatonphil 10y ago
Cutting to the chase: use Haskell or Scala or F# if you need to do some scripting or build a web application that requires lots of different tasks (being a web server, rendering templates, connecting to a database, etc.). Haskell and Scala have great libraries and polymorphism that allows you to express things succinctly. Dunno much about F# except .NET.
Use OCaml if you want easily native binaries, predictable performance and need very little in the way of well-documented, high-quality third-party libraries.
Use Standard ML if you want to learn OCaml/Haskell/F#/Scala. Why? Ultimately it comes down to usability. First off, operators (not named functions) are to programming languages as icon-only buttons are to web pages; they are completely unusable. The only reason Standard ML avoided the plague of the operators is because it's a simpler language that was used less. Second, since it's a simpler language, you get a much cleaner introduction to things like monads and modules. It makes it very simple to jump into more complex languages like Haskell or OCaml or Scala.
I work on Ponyo [0] because I want to allow people (myself) to program at a high-level in Standard ML. Furthermore, I want to promote quality and usability. Basically, every function's type is annotated and we avoid abusing operators. The current state is such that you can parse CLI args, parse/marshal JSON, serve web pages, make http requests, browse file trees, and many other ideas in the works. But the most important part about Ponyo is that it is a large, (hopefully) well-documented project that others can study to learn Standard ML (and Haskell and Scala and OCaml and F#) better.
Scala, Haskell, F#, OCaml have their place and do their jobs well. If you don't know their place or just want to get exposure to the history behind these modern languages, I recommend giving Standard ML a shot. You can get started by reading the /r/sml wiki [1] or joining #sml on Freenode.
[0] https://github.com/eatonphil/ponyo https://github.com/eatonphil/ponyo
[1] https://www.reddit.com/r/sml/wiki/index https://www.reddit.com/r/sml/wiki/index
- isomorph 10y agoInteresting, thanks. Worth noting that every Cambridge compsci undergrad has to learn SML. I ended up moving onto OCaml and Scala.
- s3nnyy 10y agoSame as compsci students at TU Munich, if Prof. Rybalchenko does the intro to functional programming course. I really enjoyed it and found it much better suited for students than other languages, especially with the book by Gert Smolka.
- virtualwhys 10y agoComing from Scala I'd like to see successor ML become a reality. Whether it's 1ML, Ponyo, Ur (without the /Web), or another ML derivative that's not OCaml (petty, but the crufty syntax makes Scala seem elegant in this regard) isn't all that important. As it stands every year Rossberg publishes a paper on latest 1ML enhancements; Harper does the same wrt to PLT, and by proxy SML. Meanwhile, nothing's really happening AFAICT in terms of the ML torch really being taken up and carried forward (beyond OCaml and Haskell). Perhaps a charitable donation from an SV unicorn founder or two, corporate backing of some form, or academic backing similar to EPFL for Scala could really get the ball rolling. Moving forward we've got OCaml and upcoming modular implicits; Haskell and the new module system, Backpack; and Scala's transition to Dotty -- basically a lot to look forward to, but would love to see SML in the mix, such a beautiful language...
- cwyers 10y agoI find it interesting that you list all of the ML derivatives except the popular one.
- hroman 10y agoPoly/ML?
- cwyers 10y agoNo. I mean, I know Tiobe isn't great, but the only ML-derivative I see on the top 50 is F#. ML and OCaml crack the top 100.
- groovy2shoes 10y agoF# is an OCaml derivative. I'd reckon that OP's feelings about F# would be rather similar to their feelings about OCaml.
- cwyers 10y ago
- marktangotango 10y agoHoly cow, poly/ml looks outstanding, threads, sockets, signals, a ffi, a lot of things I've been missing in SML all these years. Is there support for unicode in the string library? How's the generated code performance wise? I will definitely keep an eye on this project.
- groovy2shoes 10y agoPoly/ML produces excellent code. It's probably the second most performant SML implementation after MLton.
- Narishma 10y agoDoes it produce native executables that are easy to distribute?
- groovy2shoes 10y agoOn platforms for which it can produce native code, yes. The compiler will produce typical object files which can then be linked with the usual linker. For other platforms it uses a byte compiler.
- Peaker 10y agoMany icons are well known and work well. The back, forward, reload buttons are more usable as icons than text. When not overused, operators are similarly more usable than verbose English names.
- dukerutledge 10y agoTotally agree. There was a great example on /r/haskell the other day. https://www.reddit.com/r/haskell/comments/4sdkch/haskel_newbie_here_so_many_infix_operators/d58yl08 https://www.reddit.com/r/haskell/comments/4sdkch/haskel_newb... Operators are certainly overused in Haskell, but sometimes they make something so much more readable.
- jxy 10y ago> operators (not named functions) are to programming > languages as icon-only buttons are to web pages; > they are completely unusable. I see ( ) ; . you are using already. Latin letters are gibberish to people who don't use it.
- rvense 10y agoI wrote some Scala just today: val list = a +: l :+ b And I knew I had to put in a comment because that stuff always makes my eyes cross over when I come back to it.
- pmontra 10y agoI don't know Scala and I have no idea of what +: :+ means, which at first is not a good sign (think about onboarding.) Then I remembered that many mainstream languages have the a ? b : c construct which maybe was equally puzzling when it was introduced by CPL in 1963.
- billrobertson42 10y agoScala can be extended by users with stuff like that.
- pekk 10y agoThe fact that C-style ternary is hard to pick up doesn't really excuse this kind of thing in new languages.
- rvense 10y agoThey're operators that cons an element on to a list. They're both defined on the List class, but differ in associativity because they start/end in a colon. "a +: l" calls the +: method on l with a as its argument and returns a list with a added to the start, "l :+ b" calls the :+ method on l with b as its argument and returns a list with b added to the end. "a +: l :+ b" (parsed as "(a +: l) :+ b") therefore returns a copy of l with a added to the start and b added to the end. This is user definable, you can make operators whichever way you like (and start them with : if you want them to be right associative). It's very flexible and you do sort of get used to libraries using it, but I'm not entirely sure that getting used to something always means it's good. (TBH though, I use the ternary operator constantly and think nothing of it.)
- coolsunglasses 10y agoLearning SML isn't going to help as much with Haskell as you might think. The others, yes.
- eatonphil 10y agoI have ~4 years experience writing OCaml, and ~1 year experience writing Standard ML. I also once did contracting for a Play app in Scala for 3 months. A month ago, I started looking into Haskell for the first time for another side project and was immediately able to pick it up due to how similar it is to OCaml and Standard ML. In particular, the type syntax and function declarations are similar; understanding monads in SML/OCaml helps understand... everything in Haskell; and understanding of modules/functors/signatures transfers indirectly to type classes as well. (Here is a paper going into even more detail [0].) It felt like Haskell has some of the syntactic sugar I always wished Standard ML had as I learned its limitations. [0] http://www.cse.unsw.edu.au/~chak/papers/modules-classes.pdf http://www.cse.unsw.edu.au/~chak/papers/modules-classes.pdf
- qbrass 10y agoIf you already know SML or OCaml, you'll pick up Haskell easier, but if you don't know them and want to learn Haskell, you're not taking a shortcut by learning SML or OCaml first.
- dtornabene 10y agoIts whatever works for every person, but I'll throw in my own experiences and say, that by taking a detour into Ocaml I was actually greatly aided in understanding Haskell. And that having spent a great deal of time with a number of Lisps. I had grabbed a copy of RWH, dug into it, been a little defeated at first, took a studious detour through RWOcaml and have returned to Haskell with a clearer view. Again, to each their own, my own experience was actually the opposite of your statement.
- eatonphil 10y agoAlthough I happened to learn OCaml first, I am actually arguing that learning SML is a better way to learn the concepts behind tremendously more complex and less user-friendly languages like OCaml and Haskell. I don't know if I'd say it's a shortcut, but it's pretty natural to learn by studying a simpler (perhaps historic) topic before studying a more modern and complex one.