Explain Haskell like I'm five

I started learning functional programming using python, but I want to level up and I started learning Haskell.

I'm very new in all of this so if you guys can help me explaining it like I'm five, handing me some resources and such, it would be great. Thanks in advance!

Did you find this post useful? Show some love!

Haskell is a language which places a lot of value on the idea that functions should only be able to have effects on the things that they return. In Python, for example, there's nothing to say that calling add(1, 2) won't also change your desktop background to a picture of a unicorn. I mean, it probably shouldn't, but it could. Haskell is designed in such a way that stuff like this isn't possible (or at least, can't be done without you knowing it's happening).

As with any programming style, this has upsides (the flow of data through your program is much easier to understand) and downsides (sometimes you do want to affect the world outside of your function, and it can be a little tricky).

I don't tend to write Haskell very much, but I feel like learning it has changed how I look at code in other languages for the better - it's definitely worth giving it a go!

I'd recommend Haskell Programming From First Principles as a good starting point for learning the language - it's a paid book, but the first 92 pages are free.

Haskell is a language which places a lot of value on the idea that functions should only be able to have effects on the things you pass into them.

Actually, no - functions in Haskell are not able to affect the things that you pass into them. They are only able to affect their own return value.

Whoops, yeah - only affected by the things you pass in, only has an effect on the return value. You're totally right, I'll update my comment.

Like Ben Halpern recommended, Learn You A Haskell for Great Good! was a really good guide for me (and often still is).

Sometimes I think I'm fully into Functional Programming, because coding and reasoning about code is easier with FP than keeping the overview over variable manipulations (and their correct sequence) in imperative programs. I'm really serious. For me, FP is easier.

Explaining like you are five? Not exactly. But:
Programming in Haskell for me is to transform an immutable input to an imutable output. Instead of doing destructive updates of mutable values, piece by piece, hoping I get to a consistent state. Holistic FP vs. atomistic imperative programming.

Easier for me.

As you see, I failed at explaining for 5-year olds, but I hope I could encourage you.

I never got round to finishing it but Learn You a Haskell for Great Good! is a pretty good way to get going. It's a book, but you can read it all online.

Classic DEV Post from Sep 8 '17

What's your favorite useless repo/package/website/etc?

So I'm trying to remedy my carpal tunnel by considering making the decision to ...

READ POST
Follow @andy to see more of their posts in your feed.
Paula
Security freelance auditor, into journalism, privacy and digital rights. Debian ftw,I give speeches, write articles and founded a digital privacy awareness association called Interferencias in Spain.
More from @terceranexus6
Security with Haskell
#security #haskell #functional
Trending on dev.to
Functional approach to Trapezoidal rule Integration
#numericalmethod #haskell #functionalprog
How Art School Prepared Me for Programming
#art #career
Dev and Designer Communication
#discuss
How do you keep track of all the great resources you find?
#discuss #learning #resources
Quick Advice For Junior Devs
#discuss
What kind of breaks do you take throughout the work day?
#discuss
Explain Higher Order Component(HOC) in React.js like I'm five
#explainlikeimfive #beginners
Sweating the very small design details: external links
#css #webdev #design #discuss