68 points · by Ambolia · 4y ago · 34 comments
https://klaftertief.github.io/elm-search/?q=c%20-%3E%20(a%20...
https://docs.scala-lang.org/scala3/guides/scaladoc/search-en...
But at least the usual programming language rankings would suggest that Scala is quite mainstream by now.
We have it currently at place 15 on RedMonk, place 15 on the IEEE Spectrum ranking, place 19 on PYPL; whereas Haskell does not show up in the Top20 anywhere there.
Also Scala job opportunities and salaries are quite good when looking at the IEEE and Stackoverflow surveys, ranking quite a bit ahead of Haskell.
I would say Scala is pretty much a mainstream language. There's not much room in the Top20 given there are hundreds of languages out there.
Still, scala has always been promoted as being easier to learn (more like Java?) and being on the JVM, rather than winning on its own merits. So kotlin will probably eat scala.
But I agree with your takeaway. Hoogle is one of the coolest development tools I've ever used, and I desperately wish every other statically typed language had their own Hoogle.
In any case, I think we agree that it's not what the parent comment of mine had intended to refer to!
The page could probably stand to have a sentence saying that it is a quiz about "can you tell which of these 4 names of functions are the name of a function with the following type signature?" . Instead it has a picture of a unicorn's face?
I suppose that says something about the descriptiveness of type signatures, or the generality of Haskell's functions.
Anecdotally, though, I got 4/6 while knowing nothing about Haskell just by meta-analysis - a type signature including a "Foldable" term is most likely to relate to a method with "Fold" in the name :)
Rule 5 of Rob Pike[1] says:
> Data dominates. If you've chosen the right data structures and organized things well, the algorithms will almost always be self-evident. Data structures, not algorithms, are central to programming.
which makes a lot of sense to me. You see this concept being used all over the place in Golang/Rust.
But functional languages make you think in very different ways, which makes your program organized in much different ways as well. Although I can't quite put my finger on what exactly is so different.
Agda[1] and Idris[2] turn this idea into interactive editing with typed holes. You put a "?" in the code and the compiler fills the hole in for you based on the type that it infers for it. Haskell has a less expressive type system but it also has typed holes and Wingman[3] extends the Haskell Language Server to use them for interactive editing.
[1] https://www.youtube.com/watch?v=bRudW0aBNg8
Is this true? I understand types are abstract, while data structures are concrete.
Like, the type...
x -> a x y -> z y
...tells me nothing. But that is, among many things, the type for a hash map lookup. Still, a hash map is a particular implementation, and the type alone doesn't capture this – it could mislead me into thinking any implementation that fits this shape is fine.
This is the actual type of Haskell's dictionary lookup:
k -> Map k a -> Maybe a
I don't know about you, but that's pretty self-explanatory to me.
> x -> a x y -> z y
> ...tells me nothing.
I am guessing that you wouldn’t see a type signature like this in a real codebase. The type signature of Data.HashMap.Strict.lookup is
(Eq k, Hashable k) => k -> HashMap k v -> Maybe v
which is quite a bit more readable. You can even search Hoogle for x -> HashMap x y -> y and find it, try it!https://hoogle.haskell.org/?hoogle=x%20-%3E%20HashMap%20x%20...
Not really. Types include datastructures. They define the set of values that a datastructure can assume. They do the same for everything else, like variables, functions etc.
From what I've seen, this is where people usually struggle when it comes to learning functional programming. People are so wrapped up in the algorithms that they have a hard time thinking in data in the way that is required to do functional programming effectively.
Really, in practice this means data is a partially applied, curried, identity function. Put something in, get the same thing out later, acting as memoization.
Functions are just boring implementation detail. The structures tell you everything.