Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
The Evolution of a Haskell Programmer (2001) (ucalgary.ca)
144 points by agomez314 on March 6, 2024 | hide | past | favorite | 45 comments


Church Numeral oriented Haskell Programmer:

    three = \f x -> f (f (f x))
    fac = \n f -> n (\f n -> n (f (\f x -> n f (f x)))) (\x -> f) (\x -> x)
    main = print $ fac three (+ 1) 0


As a C programmer, I think it is missing something like

  -- works for all 32-bit integers
  fac n = [1,1,2,6,24,120,720,5040,40320,362880,3628800,39916800,479001600]!!n


It does have the non-truncated equivalent "Memoizing Haskell programmer"'s

fac n = (scanl (*) 1 [1..]) !! n


https://archive.is/CbAXN for those that get a cert error


"fac n = product [1..n]" is still something I use at times. It's a beautiful line of code.


Plus it fuses the list creation and consumption, there is no list in the compiled program.


I have a similar list of FizzBuzzes in Lean from when I started programming in that language:

https://drive.google.com/file/d/1lPnQiik5cAx0X2E3GNbw_Oaug87...

I wrote more, but it got too silly.


I'm glad I don't work with any post-doc Haskell programmers


They don't _work_ either :P


They do work.

They post docs.


There is a Y Combinator in there!


My first thought was, "Needs more monads".

Sure enough, in the commentary:

> Monads are woefully un-represented here; I would be grateful if someone could contribute a few (progressive) examples in the spirit of the development above.


> fac n = product [1..n]

This is a beautiful line of code.

In all seriousness, I'd probably prefer to find the Junior or "Another junior" version if I was browsing a project.



How often do you code in pico lisp? I think it's a neat project, but haven't really found a use yet.


The invalid certificate and the oddball text encoding is illustrative of the Haskell programmer's inability to cope with practical computing problems.


>The invalid certificate [...] is illustrative of the Haskell programmer's inability

Why would one assume the invalid certificate is caused by that particular professor instead of the IT department's staff at the University of Calgary?


It's a joke.


It is from 2001. And maybe not maintained anymore. Probably also a possible explanation.


The meme that Haskellers never accomplish anything practical is probably even older, maybe as old as the language itself.


The point is that encoding was not a problem just for ivory tower practicians back then. Python is an exemple of definitely-not-an-ivory-tower language that struggled with the same issues.

Also the practical joke is largely independant from haskell. It's pretty much an example of shuhari principles applied.


The meme likely comes from a time when monads (and therefore IO) were not invented yet.


Yeah, after monads were invented Haskell have conquered the world through its reputation as a practical “get things done” language.


As "A Brief, Incomplete, and Mostly Wrong History of Programming Languages" put it:

1990 - A committee formed by Simon Peyton-Jones, Paul Hudak, Philip Wadler, Ashton Kutcher, and People for the Ethical Treatment of Animals creates Haskell, a pure, non-strict, functional language. Haskell gets some resistance due to the complexity of using monads to control side effects. Wadler tries to appease critics by explaining that "a monad is a monoid in the category of endofunctors, what's the problem?"

https://james-iry.blogspot.com/2009/05/brief-incomplete-and-...


It's a funny joke (I love that post), but it's mostly for people looking from outside in. It says nothing about actually doing IO with Haskell using monads, which is practical and done, and not particularly difficult.

We shouldn't mistake memes for actual insight.


Yeah as long as you understand how to use monads IO is easy.

This is why Haskell tutorials tend to have 100 pages of dense type-theory before getting to “hello world”, while other languages have that on the first page.


I'm not sure which tutorials you're thinking of. Not this one I guess

https://wiki.haskell.org/Haskell_in_5_steps#Write_your_first...

or this one

https://riptutorial.com/haskell/example/898/hello--world-

Can you link to the one that has 100 pages before getting to “hello world”?


Learn you a Haskell gets to Hello World at page 128.


Yeah, but that's not because the first 127 pages are "dense type theory". It's because that's the first time it teaches about compiled programs rather than the REPL. Besides, "Hello world" also appears on page 14.

https://learnyouahaskell.com/learnyouahaskell.pdf


This is simply untrue. You can do IO without understanding what a monad is, simply taking it as "there is this keyword and this syntax I need to use".

No Haskell tutorials that I know of take long to reach "hello world", which is in fact a shorter program in Haskell than in some mainstream programming languages.


> and not particularly difficult.

Wait until you want debug output in a deeply nested function that isn't already in the IO monad.


You can use trace for that which is part of the base library:

https://hackage.haskell.org/package/base-4.19.1.0/docs/Debug...


Unrelated, but many thanks for organizing Zurihac year after year.


Debugging output, or just plain debugging, is often difficult regardless of the programming language. I wouldn't say this sets Haskell apart.


The main language creator himself famously called Haskell "useless". It was tongue in cheek of course.


Also with a very specific meaning that often gets lost. It was specifically about Haskell before there was an IO type. Without I/O operations, any language is "useless".

(Further context: in the discussion Haskell is described as starting out useless and carefully approaching useful. Other languages start with the footguns and then retrofit useful limitations from the other end!)


I thought there was an interview where he said that many years after Haskell had I/O. I believe you though as I haven't been enamored with Haskell for a long time. It's a cool language, but just doesn't click with me. I can see why it does for others though.


My experience is that this may be illustrative of academic programmers. People working in industry are expected to produce something, regardless of the language. This is why I'd recommend academics to spend a bit of time in the industry, regardless of it feeling awkward/inconvenient, of not being given time to go deep in any specific subject.


> People working in industry are expected to produce something,

Yeah, academics are only interested in producing silly papers to justify expensive trips to exotic conference locations.

Meanwhile, industry produces important and useful stuff like Scrum™ Poker-planning estimates and Jira®-powered burndown charts to track completion of their Confluence© fully-documented user-stories.


Both are indeed ridiculous organizations. Best not to find yourself a true believer on either side.


Sure, bigger companies have "molded" corners like that, too. But plenty of companies are small, where there there isn't much space in getting nothing practical done.


And yet big companies somehow pay higher wages. My hunch is that they can afford to pay higher wages because while big-tech employees may spend 7:30 a day on scrum poker or whatever, those last 30 minutes they are actually chipping away at some real problem that bothers 100s of millions of people. Whereas startups employees spend 10 hours a day reinventing "Wheels for Dogs"


Don't forget LEGO® Serious Play®.


Shit, TIL. I can now become a Certified Lego® Serious Play® facilitator [1], with a certificate delivered by none other than:

> The Authority on Professional LEGO Serious Play.

[1]: https://www.serious.global/


The article predates the popularity of UTF-8 encoding on the World Wide Web.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: