Live data from Hacker News

Haskell for Beginners

blog.kalvad.com

21–30 of 46 posts

Re: Haskell for Beginners

#21
Learn Haskell in 1-2-3:

1) WHY: The Functional Programmer's Toolkit - Scott Wlaschin : https://www.youtube.com/watch?v=Nrp_LZ-XGsY

2) WHAT: Learn Haskell in one video : https://www.youtube.com/watch?v=02_H3LjqMr8

3) HOW: Haskell without the theory : https://www.vacationlabs.com/haskell/

It'll teach you enough to be dangerous. Obviously your learning has just begun, but with a mental platform that lets you study other resources in time and practically test things out.

Re: Haskell for Beginners

#22
post #20

I'll add my two cents. Over the past year or so I went from being completely overwhelmed by Haskell to feeling pretty comfortable reading / writing Haskell, even enough to make my first PR to a Haskell package! Here's what worked for me: * I went through LYAH, but at a certain point I felt like it wasn't doing me any favors by sweeping some of the inherent complexity under the rug. So I started listening to talks by…

>forced me to learn stuff like: how to manage a monad transformer stack, how to make http requests, how to parse and serialize json, how to write to a database, etc.. I am currently just before this stage. I can use Haskell for stuff like projecteuler.net problems but I haven't written a single useful, real-world program without copy-pasting some code. I tried doing something with http requests to an API for stock tr…

Try using wreq[0] instead. Here's also a post[1] which describes someone else facing the same pains earlier that you're currently having. For anything to do with JSON, you need Aeson[2]. For working with databases, Persistent[3] and Esqueleto[4] (they're designed to work together) work great.

[0]: https://hackage.haskell.org/package/wreq

[1]: https://bitemyapp.com/blog/haskell-is-not-trivial-not-unfair...

[2]: https://artyom.me/aeson

[3]: https://hackage.haskell.org/package/persistent

[4]: https://hackage.haskell.org/package/esqueleto

Re: Haskell for Beginners

#23
I went through most of the Hutton book but I already had an elementary background in the language. Then some of the recommended CIS194 course. (3-6 months spent studying total.) Finally I decided upon a project that was right in one of Haskell's strong points: parsing/compilation [0]. Everything was a Google search: how to start a Haskell project with Nix? How parse command-line arguments? How to write a parser for a calculator? What the hell does this compiler error mean??!! Find the answer and get straight back to it. I would still consider myself intermediate, and not proficient, at the language.

While it is one person's opinion (albeit well explained) I strongly appreciated Chris Allen's efforts to evaluate existing learning material (prior to co-writing his book) as well as recommending a learning path [2]. Ultimately there is multitudinous material to study. For the textbook-like route, choose something that seems sensible and commit, leaving only when it appears to no longer be fulfilling the purpose. Juggling too many artifacts is like interrupting programmers.

I don't use VS Code but again, my elementary knowledge of the language, plus sufficiency with GHCi, meant I could stay within my Vim comfort zone. If anyone has a good single resource for configuring Vim for Haskell I'd love to see it?

[0] State of the Haskell ecosystem https://github.com/Gabriel439/post-rfc/blob/master/sotu.md [1] Functional Education https://bitemyapp.com/blog/functional-education/ (December 2014) [2] How to learn Haskell https://github.com/bitemyapp/learnhaskell

Re: Haskell for Beginners

#24
post #10

Earlier quoted context omitted.

LYAH is a great resource but it is a bit dated at this point and there have been more entries into the space. Haskell needs more content like this to show people how approachable it is, and especially when they're more up to date and more in line with recent best practices in using haskell. As long as we're not all doing burrito tutorials, the more people that engage with Haskell (and write posts about it), especiall…

So is it still worth reading LYAH nowadays? Are there any other resources that you could recommend instead of it?

I found the Haskell Wikibook [1] the best at introducing the language with just the right amount of theory at each stage.

[1] https://en.m.wikibooks.org/wiki/Haskell

Re: Haskell for Beginners

#25
post #20

Earlier quoted context omitted.

>forced me to learn stuff like: how to manage a monad transformer stack, how to make http requests, how to parse and serialize json, how to write to a database, etc.. I am currently just before this stage. I can use Haskell for stuff like projecteuler.net problems but I haven't written a single useful, real-world program without copy-pasting some code. I tried doing something with http requests to an API for stock tr…

Try using wreq[0] instead. Here's also a post[1] which describes someone else facing the same pains earlier that you're currently having. For anything to do with JSON, you need Aeson[2]. For working with databases, Persistent[3] and Esqueleto[4] (they're designed to work together) work great. [0]: https://hackage.haskell.org/package/wreq [1]: https://bitemyapp.com/blog/haskell-is-not-trivial-not-unfair... [2]: https:…

Persistent is truly amazing. I don't think I've ever had such a smooth experience working with databases in any other language.

Re: Haskell for Beginners

#26
This got me thinking of something a bit ridiculous: could it be possible, given enough carefully designed examples, to effectively teach the basics of a language without using a single word of a human language?

Re: Haskell for Beginners

#27
post #20

I'll add my two cents. Over the past year or so I went from being completely overwhelmed by Haskell to feeling pretty comfortable reading / writing Haskell, even enough to make my first PR to a Haskell package! Here's what worked for me: * I went through LYAH, but at a certain point I felt like it wasn't doing me any favors by sweeping some of the inherent complexity under the rug. So I started listening to talks by…

>forced me to learn stuff like: how to manage a monad transformer stack, how to make http requests, how to parse and serialize json, how to write to a database, etc.. I am currently just before this stage. I can use Haskell for stuff like projecteuler.net problems but I haven't written a single useful, real-world program without copy-pasting some code. I tried doing something with http requests to an API for stock tr…

Yeah, the goal was (rather, is---I'm still working on it!) to learn more about real-world Haskell by actually learning how to use packages and forcing myself to read the Hackage docs, so for this project I pretty liberally import a new library whenever I need something.

The "req" package is very intuitive to use for requests, and plays nicely with "aeson" for parsing JSON. I'm also using "persistent" to manage a sqlite database.

For project ideas, try to scratch a personal itch. If you're solving a problem (or a daily frustration) that's important to you, you'll be more motivated to follow through! For me, I had been using the beets (https://beets.io/) command line tool to manage tags for my music library, but it isn't really optimized for my use case, and I thought I could do better. So I decided to write a cli [1] with Haskell to tag all my local music files with metadata from Discogs/MusicBrainz, modeled after the beets tagging loop. I'm also working on a more advanced tagging system that uses Datalog inference rules, inspired by a blog post [2].

[1] https://github.com/benrbray/borscht-hs [2] https://dodisturb.me/posts/2018-12-25-The-Essence-of-Datalog...

Re: Haskell for Beginners

#28

Noob question: does it worth, for a beginner, to start with Haskell instead of Elm or Purescript?

Yes, Elm ignores many of the more interesting and important aspects of Haskell for the sake of appealing to JS devs. Go Elm if you want a ML based framework for web clients, but for actual language study, go Haskell.

EDIT: Seriously downvotes for that? Go watch some of Evan's talks on Elm, when pressed for why he doesn't implement some of Haskell's more out-there features, he states that his goal is not to appeal to Haskell devs, but to JS devs, and that he wants to keep the language palatable to them.

Re: Haskell for Beginners

#29

This got me thinking of something a bit ridiculous: could it be possible, given enough carefully designed examples, to effectively teach the basics of a language without using a single word of a human language?

Something like http://elixirkoans.io is most of the way there; you'd just have to remove the text description that goes with each koan.

Re: Haskell for Beginners

#30

This got me thinking of something a bit ridiculous: could it be possible, given enough carefully designed examples, to effectively teach the basics of a language without using a single word of a human language?

That's how many puzzle games work, so I'm pretty sure this can be done with programming languages just as well. It would need a good progression of examples/exercises, but I think that could even be better in some aspects. For one it enforces a certain quality for the code examples because they can't rely on any explanation. And it would be less ambiguous when covering more abstract concepts (my biggest difficulties in understanding OOP and interfaces for the first time were caused by misleading explanations).
Post reply on HN