48 points · by behnamoh · 2y ago · 42 comments
The only potential for misunderstanding the headline is if you fail to see that it’s hyperbole. Otherwise I don’t see how it’s being taken “out of context”.
But you can still make a nice universal machine that can run any computable function from stdin to stdout, by parsing a lambda term from the start of stdin, and applying it to the remainder [1].
What are you talking about? One of the world's most resilient systems was written in Erlang (the AXD301)... and was dynamically typed at that, lol. Not to mention WhatsApp, Discord, and others.
Based on a thread a few days ago, I think a lot of people who have never used FP before don't seem to realize that outside of Haskell, it's generally very easy to do state in functional languages. Also, they aren't constantly copying entire data structures every time you modify them which some people just refuse to believe for some reason.
Simon Peyton Jones – Haskell is useless [video] - https://news.ycombinator.com/item?id=23957953 - July 2020 (1 comment)
Haskell People - https://news.ycombinator.com/item?id=15371448 - Sept 2017 (97 comments)
A previous discussion from 2007: http://lambda-the-ultimate.org/node/2356
To execute an `action :: IO Ty' for a value of `a :: Ty', you use <-
do (a :: Ty) <- (action :: IO Ty)
..
The 'function' rand is not really a function, but an action. It doesn't make sense to ask which int rand() evaluates to, and we can't equationally reason about rand() as an int. We cannot factor it from `rand() + rand()', or replace it with `2 * rand()' because it is not an int! Haskell is explicit about this, `rand :: IO Int' an action that produces an Int when (effectfully) executed.The addition of actions doesn't make sense `rand + rand': Num-eric operations do not automatically lift over IO Int.[1] Instead we explicitly write `liftA2 (+) rand rand'. Shorthand for
do r1 <- rand
r2 <- rand
pure (r1 + r2)
where r{1,2} are Ints. The separation between evaluation and execution means we can factor rand out while still executing it twice. do let r :: IO Int
r = rand
r1 <- r
r2 <- r
pure (r1 + r2)
This factors out the 'recipe', not the value it produces. To factor out the result of the IO-action, we just use a single bind/draw <-. do r1 <- rand
pure (r1 + r1)
[1] This can be changed with Applicative lifting: {-# Language DerivingVia #-}
deriving via Ap IO a
instance Num a => Num (IO a)https://www.microsoft.com/en-us/research/wp-content/uploads/...
There are more ways to implement rule engines and rules than to learn Haskell. One of them could be to use Prolog.
Isn't that just Haskell without the use of IO... ? Which is already a thing...
It's a good idea, and Facebook actually does something like this for their spam filtering rules: https://engineering.fb.com/2015/06/26/security/fighting-spam...
They made the claim that the primary function (lol) of Haskell was to discover new PL ideas which then got adopted by the major languages.
For those who may not know it: SPJ was employed at Microsoft Research for a long time. He recently moved to Epic Games, where he co-developed the Verse language.
Erik Meijer, he's in the video :)
I didn't editorialize the title. The original title I posted was "Simon Peyton Jones — Haskell is useless".
FYI: Simon is a major contributor to the design of the Haskell programming language and a lead developer of the Glasgow Haskell Compiler (GHC).
From memory the example in the video was 'pure functions first - then figure out IO'. But it could just as easily apply to memory safety, or nulls.
Why build a new language with state-of-the-art static analysis for detecting nulls, when you could just refrain from putting nulls into your new language?
read that as:
"beyond the well-established idea, from Haskell, that side effects are troublesome and need to be explicitly modelled and thought about."