Hacker News new | past | comments | ask | show | jobs | submit login
School of Haskell: Basics (2013) (schoolofhaskell.com)
93 points by bjourne on Nov 11, 2022 | hide | past | favorite | 32 comments



If you're interested in building web apps with Haskell, check out IHP. IHP is the Laravel/Rails/Django of the Haskell world. Might be a more pragmatic way to get into Haskell than SchoolOfHaskell

- Intro video demoing how to build apps with IHP: https://www.youtube.com/watch?v=UbDtS_mUMpI

- Docs to get started: https://ihp.digitallyinduced.com/Guide/index.html

- IHP reviews: https://www.g2.com/products/ihp/reviews


If you're not a fan of the ruby-on-rails / swiss army knife approach that IHP takes, check out Scotty. Add Lucid for Html rendering, and Selda for Postgres. (There are other options for any of these tools if you prefer)

  - Scotty (simple web routing) https://hackage.haskell.org/package/scotty
  - Lucid (html rendering) https://hackage.haskell.org/package/lucid
  - Selda (postgres) https://selda.link/


hmm, last time I used Scotty, I thought it was the exact opposite of Rails and more like Sinatra. It's less batteries included and more flexible and lightweight. Yesod is more like RoR, no? Maybe I'm misunderstanding what you mean by swiss army knife?


you missed the "not a fan" part


Oh gawd. I totally did, my bad! Time for more coffee. Thanks


Did selda get the hug of death?


IHP seems great, but I found it very hard to work with.

The guide said it takes 15 minutes to build initially...it took my laptop 1 1/2 hours. And I didn't use cachix (no idea what it was, didn't want it to mess with my system) so after a nix-gc I had to build again...

And the pro version costs $300/year, and goes up to $1500/year if you make $20k. That might be good for a huge company, but if that's a side project or a solo dev's income, that's way too expensive.


Cachix manages the prebuilt binaries used by IHP. If you don't install Cachix, nix will compile a lot of IHP's dependencies from scratch. This takes a long while and is not recommended.


It manages the prebuilt binaries...but requires being run as root or adding myself to the list of Nix trustedUsers...on an OS level.

Both of those things are scary and dangerous. I don't know what your software or Cachix is doing.

Can you tell me exactly what it will be doing to my system? What changes? Does it use a lot of disk space? Is it easy to undo? And is there anyone who recommends doing it who isn't associated to IHP?


Let alone that it appears on any forum that ever mentions haskell these days.


Who would this be for? It feels very introductory but haskell is unlikely to be one of your first programming languages[1]?

The same author wrote a very popular book about category theory that introduces Haskell in a way i’d think most developers would find more tractable.

[1] there’s exceptions of course, at UofG they threw Haskell at us right after Ada back in at the turn of the millennium. That’s an interesting trajectory for course design, first lang is ada and second is haskell


In Edinburgh (2013) we did get Haskell as the very first language of the very first course (yes, functional programming before OOP!). Having coded before, I was pretty confused, why would they do that, but it ended up being an amazing equalizer. We all started at similar levels of understanding and ramped up together.


I wish I’d learned Haskell as my first language, rather than the imperative/OO route.


From TFA:

"A gentle introduction to Haskell for beginners.

The prerequisite for this series of tutorials is some knowledge of imperative programming, whether C++, Java, Pascal, you name it. If you have some familiarity with functional programming, that's even better."


Order of precedence to correctly read code can be tricky. I learned a bit about Haskell today!

pyth 3 * 2 pyth -1 8


I spent years wasting time on Haskell and wouldn’t recommend it unless you find joy in the purely academic. I’ve never found a practical application for my knowledge and no one has ever paid me to write it. I suppose if I were willing to take a huge pay cut I could have found something, but you’re far better off completely mastering Go, C++, Python, gaining systems knowledge, etc. which people will pay you good money for. The “it teaches you to think a certain way” is IMO a really weak argument. It’s extremely difficult to master one language and you’re far better off going deep in something useful than exposing yourself at a surface level to every technology and paradigm.


> I spent years wasting time on Haskell and wouldn’t recommend it unless you find joy in the purely academic.

You must have chose to do academic things then because I was able to use it for simple real world applications the first day.

> The “it teaches you to think a certain way” is IMO a really weak argument

Not when it can be used with all other languages.

> no one has ever paid me to write it. I suppose if I were willing to take a huge pay cut I could have found something,

I got a pay raise and suspect many others would as well.


  > I was able to use it for simple real world applications the first day.
Considering GP's complaint was a common known idiosyncracy of Haskell, examples of your real world applications (first day or otherwise) would be appreciated!



Great, thanks.


Haskell was my favourite language for a decade. Now it’s Rust.

I’ve not spent anywhere as much time getting only moderately good at any other language as I have with Haskell.

> The “it teaches you to think a certain way” is IMO a really weak argument.

I disagree.

It has changed how I write in every other language. Haskell has many principles that are not enforced in other languages, but are good to follow.

I’ve learned a lot from reading open space Haskell code because it’s a language where authors care about the details.

> you’re far better off completely mastering Go, C++, Python

Probably! You could say you’re better off mastering any other language, but you have to define “better”. Certainly, you can get profitable faster with most other languages.

Ten years in, I still don’t know how to make a statically linked executable with Haskell.


> Haskell was my favourite language for a decade. Now it’s Rust.

Sigh...

> Ten years in, I still don’t know how to make a statically linked executable with Haskell.

0) I hope you're targeting Linux

1) Install host (system) GHC

2) Build a new GHC by using the host GHC and Musl Libc, and depending on license restrictions choose either bignum-native or GNU GMP (flags of https://hackage.haskell.org/package/ghc-bignum). This is needed because the compiler will later inject some portions of the GHC components into user applications to support their awesome runtime system.

3) Use the newly built custom GHC to compile your projects with GHC's `-static` flag (needed for pure haskell libs) AND `--ghc-options='-optl-static -optl-pthread'` (needed for non-haskell stuff).

4) Profit

Note that on certain platforms it's not possible (without much of a low-level trouble) to statically link their libc implementations to the user applications. Apple in particular does everything to discourage developers from pursuing this goal[1][2].

[1] https://stackoverflow.com/a/5259427

[2] https://michaelspangler.io/posts/statically-linking-on-macos...


I am paid to write Haskell and I pay several people to write Haskell.

We're happy.


Quite a few well capitalized projects launching on the Cardano blockchain looking for Haskell devs right now.


Yes a lot of smart people like crypto and like Haskell. That "lot" is still miniscule compared to the other languages people have jobs using.


Eee hardly a practical use… blockchain things.


That's what they used to say about the internet. But maybe, just maybe a layer of verifiable truth that disintermediates the need to "trust" someone could be useful?

Looks out at SBF, Liz Holmes, Voting Controversies, etc.

Nahhhh, this is working well!


Given the similarities in their type systems, languages like Rust or Scala might be easier to pick up with some Haskell knowledge than without. Has that not been your experience?


You know what would make easier pick up languages like Rust and Scala? Actually using them, and not making a detour into the language that has different goals.


> You know what would make easier pick up languages like Rust and Scala? Actually using them, and not making a detour into the language that has different goals.

While this is pithily said, I think it is not unreasonable to disagree. It may be that a language that makes unrealistic assumptions and sacrifices almost everything to maintaining a theoretical vision may make it easier to understand that vision, on top of which understanding you can then layer the necessary compromises more easily than you could by learning both theory and compromises at the same time.


You have a point. The best way to learn is to do.

I am lucky because I can use Haskell simply because I enjoy it and don’t need to worry who will pay me for it as long as I produce the output.


You can learn the new way to think really quickly, long before mastering the language, which most never do.




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

Search: