Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Last week I was checking out Haskell too. All I can say is that I'm missing my curly braces.
-
Getting to a point where I could do stuff on my own in Haskell took me about two years. Yes, it's easy enough to learn how to make trivial programs, but real stuff (say, a compiler or something), that takes time. You really need time to absorb the monadic and function-composition way of thinking.
Check this out for a great, practical learning path https://github.com/bitemyapp/...
Functional Pearls and Lambda the Ultimate are a series of articles/papers on how to get stuff done with functional programming, super useful.
Code Wars has challenges to keep your skills sharp, I learnt a fair amount from seeing how other Haskellers solve problems.
If you really want to go deep, read Simon Peyton Jones' papers on Haskell (especially for parallel and concurrent Haskell) and Edward Kmett and Bartosz Milewski's (this one is easier, he also has a YouTube course on it, super awesome) blogs on category theory and CT applied to Haskell. -
Brolls31156yBook: Learn You a Haskell For Great Good!
I don’t know Haskell, but the book was instrumental in getting my mind around certain concepts like monads etc.
I’m still a *long* way from proper comprehension, but it’s a great set of tools, and it does carry over into my approach to imperative programming too. -
Kyu9619356y@RememberMe Interesting! You just got me even more hyped to learn Haskell :D But for now I feel like an ape sitting in front of a computer haha. I have so much trouble solving the simplest problems, which I'd solve in an OOP language in 30 seconds but in Haskell it takes me hours. For example, check out this: I am trying to write a function that checks if a list contains a given element, and returns either true or false. I know there are functions to do that, but I am supposed to solve this using only pattern matching and list comprehension to get used to this. Any ideas whats wrong :D ?
-
@Kyu96 Currently, your elementInList function only checks whether the list is empty, or if it is not, whether the first element of the list matches the given value
Hint: you're breaking apart the list using (x:xs) pattern matching, and then seeing if x equals the given n
x is the head of the list, xs is the tail (i.e. the rest of the list). Search in the tail too.
Hint 2: recursion. -
Kyu9619356y@RememberMe Yeah I tried that but the compiler is not happy with the single element check.
parse error on input ‘=’
Perhaps you need a 'let' in a 'do' block?
e.g. 'let x = 5' instead of 'x = 5'
elementInList n [x] = n == x = True
Wow, I am abusing Devrant like SO rn lol -
@Kyu96 wait what no
I didn't mean that you needs single element checks.
Okay I'll solve this for you, sort of
You have two cases
Either the list is empty so you return false
Or the list isn't, so you see if the head is the element you're looking for, return true if so. Otherwise, you apply your function to the tail.
(Yes you can use something like an if-else, look it up)
Related Rants
Any Haskell programmers here?
I started to learn this language for fun two days ago and so far I find it absolutely amazing and really different to OOP languages. Most of the time the solutions make so much sense, but actually coding them requires really abstract thinking of the problem. How fast did you learn Haskell? How long it took you do code it comfortably? Any advises you can give me? I work mainly through a uni exercise sheet from a friend from a different uni, and the rest is hoogle and google :P
question
functional programming
haskell
feelsamazingman