Haskell Tutorial

Поделиться
HTML-код
  • Опубликовано: 21 янв 2025

Комментарии • 1,1 тыс.

  • @derekbanas
    @derekbanas  5 лет назад +80

    Learn in One Videos for Every Programming Language
    Subscribe to Bookmark them: bit.ly/2FWQZTx
    C++ : ruclips.net/video/Rub-JsjMhWY/видео.html
    Python : ruclips.net/video/N4mEzFDjqtA/видео.html
    Java : ruclips.net/video/n-xAqcBCws4/видео.html
    PHP : ruclips.net/video/7TF00hJI78Y/видео.html
    MySQL : ruclips.net/video/yPu6qV5byu4/видео.html
    JavaScript : ruclips.net/video/fju9ii8YsGs/видео.html
    C# : ruclips.net/video/lisiwUZJXqQ/видео.html
    HTML5 : ruclips.net/video/kDyJN7qQETA/видео.html
    CSS3 : ruclips.net/video/CUxH_rWSI1k/видео.html
    JQuery : ruclips.net/video/BWXggB-T1jQ/видео.html
    TypeScript : ruclips.net/video/-PR_XqW9JJU/видео.html
    ECMAScript : ruclips.net/video/Jakoi0G8lBg/видео.html
    Swift : ruclips.net/video/dKaojOZ-az8/видео.html
    R : ruclips.net/video/s3FozVfd7q4/видео.html
    Haskell : ruclips.net/video/02_H3LjqMr8/видео.html
    Handlebars : ruclips.net/video/4HuAnM6b2d8/видео.html
    Bootstrap : ruclips.net/video/gqOEoUR5RHg/видео.html
    Rust : ruclips.net/video/U1EFgCNLDB8/видео.html
    Matlab : ruclips.net/video/NSSTkkKRabI/видео.html
    Arduino : ruclips.net/video/QO_Jlz1qpDw/видео.html
    Crystal : ruclips.net/video/DxFP-Wjqtsc/видео.html
    Emacs : ruclips.net/video/Iagbv974GlQ/видео.html
    Clojure : ruclips.net/video/ciGyHkDuPAE/видео.html
    Shell : ruclips.net/video/hwrnmQumtPw/видео.html
    Perl : ruclips.net/video/WEghIXs8F6c/видео.html
    Perl6 : ruclips.net/video/l0zPwhgWTgM/видео.html
    Elixir : ruclips.net/video/pBNOavRoNL0/видео.html
    D : ruclips.net/video/rwZFTnf9bDU/видео.html
    Fortran : ruclips.net/video/__2UgFNYgf8/видео.html
    LaTeX : ruclips.net/video/VhmkLrOjLsw/видео.html
    F# : ruclips.net/video/c7eNDJN758U/видео.html
    Kotlin : ruclips.net/video/H_oGi8uuDpA/видео.html
    Erlang : ruclips.net/video/IEhwc2q1zG4/видео.html
    Groovy : ruclips.net/video/B98jc8hdu9g/видео.html
    Scala : ruclips.net/video/DzFt0YkZo8M/видео.html
    Lua : ruclips.net/video/iMacxZQMPXs/видео.html
    Ruby : ruclips.net/video/Dji9ALCgfpM/видео.html
    Go : ruclips.net/video/CF9S4QZuV30/видео.html
    Objective C : ruclips.net/video/5esQqZIJ83g/видео.html
    Prolog : ruclips.net/video/SykxWpFwMGs/видео.html
    LISP : ruclips.net/video/ymSq4wHrqyU/видео.html
    Express : ruclips.net/video/xDCKcNBFsuI/видео.html
    Jade : ruclips.net/video/l5AXcXAP4r8/видео.html
    Sass : ruclips.net/video/wz3kElLbEHE/видео.html

    • @chasejefferson2022
      @chasejefferson2022 3 года назад +1

      I guess Im pretty off topic but does anybody know a good place to watch new series online ?

    • @kaimarcus7966
      @kaimarcus7966 3 года назад

      @Chase Jefferson I use Flixzone. Just search on google for it :)

    • @mustafazion1737
      @mustafazion1737 3 года назад

      @Kai Marcus Definitely, been watching on Flixzone for months myself :D

    • @chasejefferson2022
      @chasejefferson2022 3 года назад

      @Kai Marcus Thanks, I went there and it seems like they got a lot of movies there =) Appreciate it!!

    • @kaimarcus7966
      @kaimarcus7966 3 года назад

      @Chase Jefferson happy to help =)

  • @derekbanas
    @derekbanas  9 лет назад +59

    Afonso Matos Thank you for all the great input on the video! Sorry I can't respond to you directly because you don't have a Google+ account, or for what ever reason RUclips has decided. Your points are great and very much appreciated. My main goal here was to cover all of the topics that confuse people about Haskell so that they could easily transfer to a confusing book and understand everything. The script I work off of is basically the list of topics you see in the description. I look at what i want to remember to cover and write code out of my head. I basically set a timer for 2 1/2 hours and cover as much as I can knowing that I'll be able to edit that down to about an hour long video. I know I missed a couple things, and I'm sorry about that, but I figure if I can cover 90% of the basic syntax that that should be enough. I hope that all makes sense. Again thank you for pointing out how I can improve while helping others :)

    • @afonsolfm
      @afonsolfm 9 лет назад +3

      Derek Banas Could you answer my 3rd question?
      3) Can you give me any tips as a 15 years-old programmer and wanna-be professional game developer?
      I started programming watching your Javascript and Java tutorials, so I am very grateful to you , thanks once again!

    • @derekbanas
      @derekbanas  9 лет назад +21

      Afonso Matos I knew a guy that got a job at EA many years ago. He went on to work for a couple other game companies. He was one of the best programmers I have ever met. The best would be to strengthen your problem solving abilities. Get good at understanding and creating optimized algorithms. Strengthen your math skills. Programming at high levels is all about getting very good at problem solving. I want to focus more on these skills. That is why I started teaching the languages again with a special focus on languages that help people get better at programming.

    • @iMaxos
      @iMaxos 9 лет назад +5

      +Derek Banas You probably already know about this website, but Project Euler is really good for getting better at problem solving and programming.

    • @OliverBenson2024
      @OliverBenson2024 9 лет назад +10

      +Afonso Matos Hi Alfonso, my advice to any wanna-be game developer would be to learn some low-level languages e.g. C++, C, Java, and C# (in that order if you can). I'd also recommend getting a degree - preferably a good games degree. For example I'm doing a course in Computer Games Programming which focusses a lot on game programming. It's not essential though. If not, do get a degree - Computer Science would be just as good. Finally, start working on a portfolio - create a website and make videos of projects you've created. Hope that helps and feel free to ask me any other questions :)

    • @Xnoob545
      @Xnoob545 5 лет назад

      GOOGLE+? Ewwww

  • @fedos
    @fedos 3 года назад +181

    If you add the 00:00 timestamp to the description, RUclips will create chapters allowing viewers to find the topic they want on the video's progress bar.
    Edit: He's since made the update, so there's no need for people to pile on the "second"ing.

  • @danielhmorgan
    @danielhmorgan 2 года назад +47

    still great after 6 years. thank you very much

    • @derekbanas
      @derekbanas  2 года назад +9

      Thank you :) I'm very happy that I could help

  • @bibliophileanki
    @bibliophileanki 6 лет назад +8

    One of the best resources for Haskell on internet. Explained with such a clear and lucid understanding that even the lay man can well grasp all the arcane concepts. The voice clarity is great and adds to the charm. Thank you for such a great content !!

    • @derekbanas
      @derekbanas  6 лет назад +4

      Thank you for the nice compliments :)

  • @mitchmitch555
    @mitchmitch555 8 лет назад +17

    That explanation of how the recursive factorial function worked around 36:30 was beautifully explained, much better than my Programming Languages professor has ever explained recursion. I've learned Ruby, Prolog, Scala, and now Haskell in that class and your videos on those languages have been an enormous help to me.

    • @derekbanas
      @derekbanas  8 лет назад +2

      +mitchmitch555 Thank you for the compliment :) I'm glad I could clear it up

  • @charliemeyersohn9371
    @charliemeyersohn9371 8 лет назад +9

    Fantastic tutorial! I could have spent days perusing articles, books, and the like only to come up with nothing more than a few trivial lines of code at best. You have brought the whole thing about Haskell into the light. I have a challenge to complete for a job interview, and there is no way I could have completed it in time without your tutorial. Thank you so much Derek you rock!

    • @derekbanas
      @derekbanas  8 лет назад +1

      Thank you very much :) I did my best with it. Best of luck on your interview.

  • @derekbanas
    @derekbanas  9 лет назад +314

    Sorry I couldn't respond to you directly Manuel Lehertu. I have been programming for 30 years. I have done a ton of consulting work which requires knowing a bunch of languages. I probably learned most of them because I often donate time to help students with research projects at local universities.

    • @PrimeFxcus
      @PrimeFxcus 9 лет назад +3

      Wow

    • @rafsanjanimuhammod309
      @rafsanjanimuhammod309 9 лет назад +14

      Derek Banas Really you're a great man.
      Sir, will you make a tutorial for Assembly Programming Language.

    • @derekbanas
      @derekbanas  9 лет назад +60

      Rafsanjani Muhammod Thank you for the nice compliment :) Sure I can cover assembler. I'd love to make a fun electronics tutorial as well.

    • @zeuglcockatrice4633
      @zeuglcockatrice4633 9 лет назад +6

      Derek Banas yes,yes electronics tutorial please

    • @FSHnegativ
      @FSHnegativ 9 лет назад +2

      Derek Banas Microcontrollers could be a really interesting topic!

  • @p1neapple_pizza522
    @p1neapple_pizza522 4 года назад +133

    The dislikes were from university lecturers

  • @JustADuck
    @JustADuck 2 года назад +4

    75 minutes and they were worth it sooo much. Thank you for this video. You explained everything I could have imagined of. Unfortunately at my university they don‘t give such an overview. Very understandable, with good examples, exactly on point when it comes to giving necessary explaination.
    Must be the best learning video for a programming language I‘ve seen so far. Especially the vocabulary was very confident and without mistakes which made it great to listen to. My prof sometimes calls things the wrong way.

  • @yKrishG
    @yKrishG Год назад +4

    Best Haskell video after 7 years as well .thanks

  • @petermacdonald1008
    @petermacdonald1008 8 лет назад +42

    Amazingly to-the-point and clear coverage of some very difficult material. Thanks!

  • @3croN
    @3croN 9 лет назад +67

    22:20 Divisible by 13 AND divisible by 9, not OR. :)

  • @MasterNoxob
    @MasterNoxob 8 лет назад +30

    51:21 "Because we are angry and they shouldn't have passed garbage into our function." LOL. As always very good tutorial btw.

    • @derekbanas
      @derekbanas  8 лет назад +5

      Thank you :) I'm glad you enjoyed it

    • @jasperwes
      @jasperwes 5 лет назад

      Just about to write this exact comment; but you've beat me to it! I agree; good tutorial.

  • @slidenerd
    @slidenerd 7 лет назад +51

    my boi derek banas is unstoppable :)

    • @derekbanas
      @derekbanas  7 лет назад +1

      Thank you :) Your channel is looking awesome like always!

  • @pol...
    @pol... 8 лет назад +50

    First of all thank you very much for the video. A head start is just what I needed. :)
    I want to ask you (or anyone reading this) about the Fibonacci series example. I've been thinking about it and think that you are kinda wrong in the Fibonacci example. I mean, it works, but what is not true is that fib = 1 and tail fib = 1 at first, but fib = [1,1] and tail fib = [1]. Afterwards fib is longer and equals [1,1,2] and fib tail [1,2] and so on.
    When one zips [1,2,3] with [4,5] one becomes [(1,4),(2,5)].
    If fib is to be, let's say [1,1,2,3,5,8,13] than zip fib (tail fib) becomes zip [1,1,2,3,5,8,13] [1,2,3,5,8,13] and that is [(1,1),(1,2),(2,3),(3,5),(5,8),(8,13)] not taking into account the last member in the fib list. Then you add the pairs in the tuples and you get the list.
    I mean, it's mostly what you said, only that fib and tail fib are not equal to 1 or 2 but are the lists (which actually makes much more sense knowing how lists and the tail method works).

    • @woobilicious.
      @woobilicious. 8 лет назад +3

      +Smalde yes I think you've got it correct it's like:
      [1, 1, 2, 3..]
      + + + ...
      [1, 2, 3..]
      I think he means that the first value is 1
      You can also write it like :
      fibs = 1 : 1 : zipWith (+) fibs (tail fibs)
      or put this at the top of your file:
      {-# LANGUAGE ParallelListComp }
      and try:
      fibs' = 1 : 1 : [a+b | a

    • @Liftwithsepi
      @Liftwithsepi 8 лет назад +9

      Thanks for the comment, I was really confused about that part.

    • @kpmaynard
      @kpmaynard 8 лет назад

      The trick is laziness. If you call fib you only receive the NEXT fib not the whole list... That is why it works as he has explained it. If you want more than one value from the list you must use 'take' e.g. take 5

    • @sara-hc7wb
      @sara-hc7wb 8 лет назад +5

      Keith Maynard no, fib is always a reference to the entire list. the laziness just means that the entire list isn't computed until needed. but it's "still there" the entire time. if you try to print fib to the console your program won't terminate since it'd be trying to output an infinite list.

    • @kpmaynard
      @kpmaynard 8 лет назад +1

      Thank you so much for correcting my whopper :). I did run fib and had to escape out of a large stream of beautiful numbers :). I was forced to re-examine the code. Do you understand which mechanism iterates through the (a,b) tuples? Seems to me that the zip fib (tail fib) recomputes some values. How does the concatenation operator 'remove' these duplicates?

  • @ScottRehorn
    @ScottRehorn Год назад +7

    Excellent work - as a longtime programmer I am very happy about your pace and assumptions about prior experience - too many tutorials will stop to explain something like "what is mod?" rather than just showing what mod looks like in Haskell. Also +1 for clean edits and bookmarks :)

  • @afonsolfm
    @afonsolfm 9 лет назад +40

    Hello Derek! I hope you read this:
    I have just watched your Haskell tutorial, and I have written some notes on typos, suggestions and other annotations (both from the Video and the CheatSheet)
    Your video was a pretty good introduction, I liked it a lot. I have a few questions for you:
    1) Do you use autocompletion or edit the entire video ?
    2) How are you able to talk non-stop? Do you follow a guide on what you're going to say?
    3) Can you give me any tips as a 15 years-old programmer and wanna-be professional game developer?
    I love that you answer all the comments and help people who watch your videos and want some feedback.
    Keep up the good work!
    =====================================
    ============== NOTES ================
    =====================================
    (I am not a native english speaker, so if you don't understand something, please ask)
    I thought these could be useful for you (don't ask me how)
    0:03 - Hello! Let's go!
    10:15 - (**) requires both numbers to be floatings, (^) is prefered for integral exponential
    > 2 ** 3 -- Both are coerced to floatings
    > (2 :: Integer) ** 3 -- Error
    > 2 ^ 3 -- 3 is coerced to an integral
    10:38 - floor doesn't round up, it rounds down
    11:15 - Why the parentheses in `not(True)` ? Seems unnecessary and confusing for beginners.
    13:39 - I would expect you to declare the type of at least one list before jumping into their definitions.
    15:52 - You forgot to mention the tail function
    23:47 - Typo: listBiggerThen5 -> listBiggerThan5 (this is on the cheatsheet too)
    29:56 - If I remember, you haven't said that strings are lists of characters yet. It might be confusing for a beginner to see `++` there.
    35:39 - Integers seem more useful in this case, since the result can become enormous.
    38:31 - Confusing explanation of the otherwise value. Just say that it's equal to True, therefore everything passes it.
    >> :t otherwise
    >> otherwise :: Bool
    40:30 - What a mess, haha! You could check for the bigger values first.
    >> whatGrade age
    >> | age > 18 = "Go to college"
    >> | age > 14 = "High School"
    >> | age > 10 = "Middle School"
    >> | age > 6 = "Elementary school"
    >> | otherwise = "Kindergarten"
    44:41 - I would use [x] and [x, y] but probably just a style preference.
    54:03 - (->) has right precende, so no need for the parentheses in the type declaration (as it could also confuse the student). Also, this is a good time to explain currying in more detail (but maybe it would take too much time and there are more things to cover).
    55:58 - Unnecessary parentheses.
    56:43 - Worth mentioning that `case .. of .. ` pattern matches against a value, just like function pattern matching.
    56:43 - Worth mentioning case of guards.
    1:01:48 - "Error" seems pretty weird to me. Something like "Draw" or "Try again" would look better (as the type declaration requires the arguments to be from type RPS)
    1:07:11 - You could introduce Type constructors.
    1:16:08 - fibs = 1 : 1 : zipWith (+) fibs (tail fibs)
    1:16:47 - Till next time!

    • @kevinparsley6806
      @kevinparsley6806 7 лет назад +4

      it sounds like you should have made these notes to make your own video. i certainly was better off after watching this one than before i watched it. a lot of your corrections were for things that are the same from language to language. haskell isnt usually a first language, so these corrections would generally be inferred by the viewer..
      if you really wanted to be helpful to someone, the notes probably would have been better addressed to the viewers than the author of the video. and certainly more brief than what you have posted. many of them are your own preferences and not required.

    • @TheRealIceman10
      @TheRealIceman10 7 лет назад +2

      You really should work on how to use feedback you get.
      PS: I know you're just some random dude.

  • @DarshanParajuli
    @DarshanParajuli 9 лет назад +15

    I've always been on a look out for a good Haskell tutorial that is easy to understand for someone coming from imperative programming.
    So, thank you! This is fantastic!

    • @derekbanas
      @derekbanas  9 лет назад

      +Darshan Parajuli You're very welcome :) I'm glad you liked it.

  • @simrandotdev
    @simrandotdev 3 года назад

    Hey Derek, I just came here to thank you that because 6 years ago your this video helped me pass the programming languages exam that eventually helped me graduate from my masters degree.
    A functional language was a requirement and I chose Haskel because you had the video for it and it helped me solve the problems in the exam.

    • @derekbanas
      @derekbanas  3 года назад

      Thank you for taking the time to tell me I helped :) Congratulations on your Masters!!!

  • @Ateia22
    @Ateia22 9 лет назад +79

    You sir are a mind reader. Just yesterday I was thinking Haskell looks like a pretty interesting language, It would be cool if Derek did a video on it... and here it is lol

    • @derekbanas
      @derekbanas  9 лет назад +14

      Kevin Baez It is gaining a lot of interest lately. It is a very powerful and fast language. Local universities are using it a lot lately and i was lucky to be able to help them.

  • @johnappleseed8839
    @johnappleseed8839 9 лет назад +1

    I could never have imagined how amazing haskell is... I laughed out of surprise a few times when I realized the things you can do. I think my life changed today.

    • @derekbanas
      @derekbanas  9 лет назад

      +John Appleseed Haskell is very very cool language. I'm glad you liked it :)

  • @xcvsdxvsx
    @xcvsdxvsx 7 лет назад +42

    THE best coding channel on youtube.

    • @derekbanas
      @derekbanas  7 лет назад +1

      Thank you for the nice compliment :)

    • @xcvsdxvsx
      @xcvsdxvsx 7 лет назад +3

      Thank YOU for saving me hours and hours and hours of my life. I love bucky over at thenewboston dont get me wrong but you can say in 10 minutes what takes that boy 10 hours.

    • @xcvsdxvsx
      @xcvsdxvsx 5 лет назад +1

      @@freshprince4552 I said from the outset that I love bucky and his channel. I've spent hours and hours of my life over there and im very grateful. BUT, as stated previously, this guy "can say in 10 minutes what takes that boy 10 hours". Thats just the truth.

    • @xcvsdxvsx
      @xcvsdxvsx 5 лет назад

      @@freshprince4552 ZzZzZz

    • @sagitswag1785
      @sagitswag1785 4 года назад

      @@freshprince4552 ok boomer

  • @shawnbadger2737
    @shawnbadger2737 7 лет назад +1

    I really enjoyed this video. You've got a knack for boiling complexity down to simplicity, and I appreciated the pace at which you moved through the topics. I would love to see a follow-on video talking about the boundaries of pure and impure code, monads, state, other types of IO, etc... I'm at the point where I feel somewhat fluid with the language in the pure functional domain, but struggle translating that into real-world applications.

    • @derekbanas
      @derekbanas  7 лет назад +1

      Thank you :) Yes I definitely need to make a tutorial just about the technical aspects of writing functional code

  • @anonymous1177
    @anonymous1177 8 лет назад +60

    Set replay speed to 0.5 and you might have a chance to code along.

    • @luuclucas
      @luuclucas 5 лет назад

      i set the speed to 1.25

    • @ewertonal
      @ewertonal 4 года назад +3

      Do you know the pause feature?

    • @Raleighthrbub123
      @Raleighthrbub123 3 года назад

      Or. Or... Hear me out... use vim.

  • @devocracy1089
    @devocracy1089 Год назад

    51:16 "Because we're angry and they shouldn't have passed in garbage into our function" 😂 Such a perfect delivery, also I'm doing this tutorial in 2023 and I'm loving it, your method of explaining these concepts is excellent!"

  • @RoryMag
    @RoryMag 8 лет назад +29

    You are a legend, this video saved my life.
    Because Haskell uses so much recursion, is it a smart idea to use tail recursion for all/ most of my functions?

    • @eNSWE
      @eNSWE 8 лет назад +14

      most times you don't need to recurse explicitly. you can use stuff like foldl/r and fmap that encapsulate a lot of the most common ways to recurse. it gives you more readable code and saves you from writing the same thing over and over again.

    • @anselmschueler
      @anselmschueler 5 лет назад

      @@eNSWE ++

  • @MrX-mh7uu
    @MrX-mh7uu 3 года назад +1

    29:58 when I type "ghc --make (name of program)", I get : "error: module `(name of program)' cannot be found locally". How can I fix that?

  • @Willis-no9ym
    @Willis-no9ym 6 лет назад +10

    10:44 floor rounds down, and I don't think you mentioned (explicitly) here that round converts to int (although you did say it a minute earlier or so)

  • @khushaalnandwani3372
    @khushaalnandwani3372 10 месяцев назад +1

    I cannot stress how useful this video was! I am an intermediate advanced programmer and just wanted to know a few things about haskell coz I have this course at university taught by two bozos. This man covered it all. and beautifully! Thanks so much Derek Bhai. On a side note, wheres your accent from? love the voice

  • @nesciusnomen9119
    @nesciusnomen9119 6 лет назад +7

    Min 44:00. (×:[]) is the same as ([x]) so technichally you are covering the pattern match for a singleton. And not " your list starts with". Maybe you meant (x:[_]). Correct me if i am wrong.

  • @uzKantHarrison
    @uzKantHarrison 6 лет назад +1

    I think I am going to watch this kind of videos of yours every time I get started with a new language.
    The Kotlin one was sooo helpful. This one is good, too, even though I have to say the first part was a bit slow for me, while the second part was definitely too fast (custom types etc).
    You're a great explainer anyway. What I'm trying to learn from you is also how to be so clear when teaching, as I might be interested in teaching.

    • @derekbanas
      @derekbanas  6 лет назад

      Thank you for the compliment :) I think I have gotten better over time through pure repetition

  • @UpgrayeDDDDDD
    @UpgrayeDDDDDD 8 лет назад +9

    24:27 You could've explained what the second parameter does in foldl.

  • @TheJpmaster69
    @TheJpmaster69 5 лет назад

    People like you are criminally undervalued, you possibly save student's careers with such amazing tutorials.

    • @derekbanas
      @derekbanas  5 лет назад

      Thank you for the compliment :) It is nice to know I'm helping the world in my small part

  • @salmandjingueinabaye396
    @salmandjingueinabaye396 4 года назад +3

    Great video. Question: At 54:08 for the getAddFunc, the definition (line 7) says it takes one integer but on line 9, it looks like its taking two arguments (x and y). Is y the function that is being returned?

    • @insertoyouroemail
      @insertoyouroemail 4 года назад +2

      y is the argument for the function being returned by getAddFunc. It looks a little confusing but it makes perfect sense when you get used to it. The "pattern" is called currying. You can do it in classical languages as well. For example in javascript it would be
      getAddFunc = x => y => x + y
      and you would invoke it like this
      getAddFunc(3)(4)

    • @salmandjingueinabaye396
      @salmandjingueinabaye396 4 года назад

      @@insertoyouroemail That makes sense. Thank you

  • @goncalvesalves3007
    @goncalvesalves3007 2 года назад

    Hello Derek, how are you?
    Thank you very much for this Haskell tutorial! Right now, I'm taking half a college period programming in Haskell, and this is exactly what I needed to get through. Even if I don't have a chance to use Haskell again, it is a great language to improve your programming skills, especially expressivity.
    Just so you know, I've watched it till the very end. Great job! 😄

  • @wesleyshann6524
    @wesleyshann6524 5 лет назад +3

    I would like to thank you for posting this amazing and comprehensive tutorial. I was struggling to understand Haskell through other tutorials, yet you made things a lot clear.
    Thank you very much =D

    • @derekbanas
      @derekbanas  5 лет назад +1

      That's great! I'm happy I could help 😁

  • @MsEady123
    @MsEady123 2 года назад +1

    Thank you for this tutorial. I've followed you for years; I think you have one of the best tutorials on RUclips. I'm learning Haskell for my PhD program research. I had to buy one of your Udemy classes to refresh on my python. You are the best. If you every make a tutorial on the Haskell Yampa package, then that would be awesome.

    • @derekbanas
      @derekbanas  2 года назад +2

      Thank you for the nice compliment :) I'm very happy you have found my videos useful. I'll look into making more Haskell videos

    • @NareshKumar-sm9yz
      @NareshKumar-sm9yz 2 года назад +1

      @@derekbanas I thought you're a great tutor but you also a legend, still replying a 7 yrs old video

    • @ЮрийДжиндоев
      @ЮрийДжиндоев 2 года назад

      @@derekbanas Is Haskell relevant outside of math? What's your opinion?

  • @maneeshreddy3825
    @maneeshreddy3825 6 лет назад +3

    I think the max value of int is (2^63)-1.

  • @washingtonlgois
    @washingtonlgois 3 года назад

    6 years later and this videos is saving my life. Thank you so much!

    • @derekbanas
      @derekbanas  3 года назад +1

      I'm very happy that I could help :)

  • @manuelnovella39
    @manuelnovella39 9 лет назад +46

    Where did you learn to code in so many languages?

    • @tcroyce8128
      @tcroyce8128 7 лет назад +17

      this reply kinda works for everything nowadays

    • @macward3041
      @macward3041 7 лет назад +3

      most languages are similar

    • @RedEyedJedi
      @RedEyedJedi 7 лет назад +8

      Most popular programming languages are C based i.e. C++, C#, Java, ObjectiveC, PHP, JavaScript etc. What he really learned is how to write code. Languages are just tools, once you understand the logic of how to program, learning a new language is just learning the different syntax. Plus, he's smarter than your average haha

    • @kevinparsley6806
      @kevinparsley6806 7 лет назад +4

      haskell doesnt fit into the learning a new language is just learning the different syntax basket, unless you're talking about functional programming languages..
      I actually think the question as it is is valuable, and the answer Derek provided was equally valuable.

    • @kevinparsley6806
      @kevinparsley6806 7 лет назад +6

      For the benefit of others, Derek's response, which could not be included in this branch of conversation
      "Sorry I couldn't respond to you directly Manuel Lehertu. I have been programming for 30 years. I have done a ton of consulting work which requires knowing a bunch of languages. I probably learned most of them because I often donate time to help students with research projects at local universities."

  • @DGDG0000000
    @DGDG0000000 5 лет назад

    It should be actually the best Haskell beginner tuto i ever see. That's great. Thank you, very clear.

  • @Faisalk786HD
    @Faisalk786HD 9 лет назад +4

    at 21:20 why did you add "x * 3 >= 50" if the list will only go up to 30?

    • @jonny5825
      @jonny5825 8 лет назад

      +FaisalK786 Yeah, I also found it interesting that "[x * 3 | x

  • @MrSama1000
    @MrSama1000 3 года назад +1

    After all this time, this is still the best tutorial. Better than what I had at university. Thank you very much!

    • @derekbanas
      @derekbanas  3 года назад +1

      Thank you very much :) Happy I could help

  • @ole4707
    @ole4707 8 лет назад +7

    Never worked with Haskell before, but couldn't the last example be simplified to:
    fib = 1 : 1 : zipWith (+) fib (tail fib)

    • @derickd6150
      @derickd6150 8 лет назад +1

      Yes I also thought that and tried it. It can indeed. It's funny though, I was able to work that out without really understanding the last example at all...

    • @avi3681
      @avi3681 5 лет назад

      I don’t understand why fib gets the value of the second to last list item.

  • @PheonxD
    @PheonxD 3 года назад

    Really nice tutorial that covers a lot of Haskell ground. Great that you showed how powerful the language is and gives a lot of insight of how it might differ from OOP languages and what we can reuse there. Thanks a lot

    • @derekbanas
      @derekbanas  3 года назад

      Thank you very much :) I'm happy you enjoyed it

  • @MisterComment25
    @MisterComment25 8 лет назад +7

    Great video! thank you very much for making this and explaining everything so well.
    Are you planning on covering Monads and such in a future video?
    And is there a chance for you to do an Erlang or Elixir tutorial?

    • @derekbanas
      @derekbanas  8 лет назад +1

      +Nicolas Torres Thank you :) Yes I hope to do more with Haskell soon and yes Elixir is on the list

  • @slackbraham
    @slackbraham 8 лет назад +23

    The thumbnail makes me wanna learn it so bad.

  • @arkajyotipal5843
    @arkajyotipal5843 6 лет назад +1

    To the point and very clear coverage, that too at the right speed. Thank you so much man!

    • @derekbanas
      @derekbanas  6 лет назад

      Thank you very much :) I'm happy I could help

  • @royalnamikaze1646
    @royalnamikaze1646 4 года назад +3

    Hs: *Main> whatage
    Me: its my birthday today, finally 17
    Hs:"Nothing Important"

  • @Relseg
    @Relseg 9 лет назад +2

    Damn, you sure do cover a lot of languages, and the videos are exceptionally informative. The only language I looked for that you haven't covered is ActionScript 3.0, although that language is a bit different in my opinion from other OO languages. AS was probably the first language I ever tried programming in when I was around 11-12 trying to make flash games. 8 years later and I know Java, C++ and some Lua(thanks to your Lua tutorial) and still want to learn AS.

  • @sanshinron
    @sanshinron 9 лет назад +8

    You're reading putStrLn as "put string length". Obviously I'm just beggining Haskell, but I think it actually means "put string line" :)

  • @boroborable
    @boroborable 4 года назад +1

    first time looking at haskell, couldn't decide which is more amazing, your teaching skills or the haskell language!

  • @rock3tcatU233
    @rock3tcatU233 9 лет назад +6

    Can you do a BASH programming tutorial?

    • @derekbanas
      @derekbanas  9 лет назад +9

      rock3tcat (ⵙⴰⵔⵓⵅ) Sure I'll see what I can do

  • @ernestboston7707
    @ernestboston7707 3 года назад

    Wow, I have been working on Haskell for several weeks, already working my way through the textbook mentioned, and this is a great video!

  • @leoalcock
    @leoalcock 8 лет назад +3

    Hi Derek. A confusion with the last example: You say at the beginning of the second iteration of the recursive definition that the list is now [1,1,2] but that the second time through fib is the second element. How come fib isn't [1,1,2]? On a side note: great video.

    • @sara-hc7wb
      @sara-hc7wb 8 лет назад +2

      fib is always a reference to the entire list. I think some confusion occurs because the video made it sound like fib and tail fib actually change value. they don't.
      I think it's easier to visualize what's happening if you always view fib as the complete infinite list of fibonacci numbers, and what happens in the definition is that you simply say "the first element is 1, the second element is 1, and the rest of the list consists of a + b, where b is the element that comes after a (that's what zip fib (tail fib) gives you)".

    • @derickd6150
      @derickd6150 8 лет назад

      I am also really confused on this. I see it as more of a list inside lists thing, like building a stack. That way of looking at it does give the right answer, but it leaves me confused as to how the compiler knew when it had reached the bottom of the stack. So the explanation presented by Derek must be right

    • @GertCuykens
      @GertCuykens 8 лет назад

      I agree with Kai, picture adding 2 arrays together is better to understand the last example [1,1,2,3,5] + [1,2,3,5,8] also notice how internally your computer itself calculates the list completely differently compared how you read haskell syntax else you would be calculating the same numbers over and over again just to add one in the end.

    • @jonathanlevi2458
      @jonathanlevi2458 6 лет назад

      Where is the `last` function defined? Is it a general function that can be used anywhere? And what does it do, technically?
      `last` obviously is not getting the last value of `fib` because `fib` is either infinite or a simple number as it is used in the case of a. Or if `fib` is the current iteration of `fib` how is it used as a number for `a`.
      I would have expected `(a,b)

  • @makmak-zt6md
    @makmak-zt6md 5 лет назад +1

    great tutorial, the 1 hr video taught me more than the 4 lectures I attended. very good explanations, and easy to follow

    • @derekbanas
      @derekbanas  5 лет назад

      Thank you :) I'm happy it helped

  • @avishekghosh2589
    @avishekghosh2589 8 лет назад +3

    I couldn't understand the Fibonacci series. fib is a List right so how can you add a value to the list because you are saying a->fib summed with the tail of that same list i.e. b.
    P.S: Loved the video, Helped a lot.

    • @harryhowley77
      @harryhowley77 8 лет назад +1

      The reason it works is because your not directly adding values to whole lists, you're isolating pairs of values (one from each list) with zip then adding them and sticking them into the list you're taking from (recursion).
      For example:
      In the first pass; the first element from the initial 'fib' list ('a' / 1) gets paired into a tuple with the first element of the 'tail fib' list ('b' / also 1) which is everything in the initial 'fib' list expect from 'a', i.e. the second element.
      This tuple is shown in (a,b) which would be (1,1) in the first pass. These two values are then added by the code at the start of the list comprehension - (... [a + b | ...]) and this value (2) becomes the value for the first pass and is immediately added to the initial 'fib' list, making it [1,1,2].
      This is done again and again; with each pass matching the two consecutive values from the 'fib' list as its generated, adding them together, and then placing it into the list (which makes 'fib' as a function an infinite list generator).
      Hope this helps!

    • @0LoneTech
      @0LoneTech 6 лет назад

      The key is Haskell's lazy evaluation. It only needs to know how to continue the list to make the list, and the zip always reads a little behind the new values, so will never run out. As this plan for how the list is constructed is part of how the list was created, it's already defined even when it's not yet evaluated.

  • @MxMxffin
    @MxMxffin 2 года назад

    "round" is going to round to the next integer
    "ceiling" is going to round up
    "floor" is going to round down
    round 9.01=9
    ceiling 9.01=10
    floor 9.01=9

  • @TheoAddis
    @TheoAddis 9 лет назад +5

    26:57 Finally! Lists done!

  • @tobiasjennerjahn8659
    @tobiasjennerjahn8659 3 года назад

    Wow. This is still probably the best haskell video on youtube. Thanks!

    • @derekbanas
      @derekbanas  3 года назад

      Thank you very much :) I'm happy I could help

  • @Rjsipad
    @Rjsipad 8 лет назад +4

    How were you able to just type haskell-tut.hs and not the whole users/derek/documents/.... etc thingy?

    • @Rjsipad
      @Rjsipad 8 лет назад +1

      ty!!! :)

    • @XyntXII
      @XyntXII 6 лет назад

      I assume it would be opening the ghci where you have your files.
      so first you do
      cd myFolder1/myHaskellFolder
      then
      ghci
      and then you can just type
      :l myfile.hs
      or just
      :l myfile
      hope this is helping

  • @theloopyproducer3361
    @theloopyproducer3361 3 года назад +1

    Getting started working with Plutus contracts and this got me going in one succinct video on the Haskell front. Many thanks 🙏

  • @crimsun7186
    @crimsun7186 9 лет назад +9

    @Derek Banas No Monads? Why? :(

    • @eNSWE
      @eNSWE 8 лет назад +1

      there was IO with monadic do-notation and list comprehension (which is just syntactic sugar for the list monad), so there was some stuff there, only they didn't mention the m-word :)

    • @crimsun7186
      @crimsun7186 8 лет назад

      eNSWE And a good portion of people tend to give up on Haskell simply because no one seems to be able to explain what monads are and how they work to a complete beginner without delving into unnecessary complexity like category theory and making them even more confused.

    • @eNSWE
      @eNSWE 8 лет назад

      well monads are a fairly complex, but first and foremost very very very abstract, so explaining them to beginners takes time. I don't think it's even possible to explain monads to someone with no prior knowledge in one video like this. it takes exposure and several different explanations over a few days/weeks. it's like asking someone to explain reactive asynchronous design patterns for scalable systems in the cloud with no prior knowledge of programming in a 1h video. it simply can't be done.

    • @crimsun7186
      @crimsun7186 8 лет назад +1

      eNSWE And that's why Haskell will probably only a be an intellectual meandering from smart people trying to impress themselves with their own intellect as oppsed to a general purpose language that could be used because of its benefits over other types of languages.

    • @eNSWE
      @eNSWE 8 лет назад +4

      what? that makes no sense at all. first and foremost, haskell IS general purpose language that is used for a wide variety of purposes (facebook among others are using it in production code).
      secondly, it's not like monads are a haskell invention. it's a mathematical structure, same as a group or a ring.
      C# has monads. python does. C++ does. ruby does. EVERY turing complete language has monads. the thing is that few languages recognize them in the type system. C# has a kind of hacky way of doing it via LINQ. the point is, monads don't exist in haskell because someone wrote a Monad type-class. monads exist because there are types that have monadic structure. recognizing that isn't realted at all to haskell, it's inherent in the structure of lists, of nullable types, of tasks/futures etc.
      in a programming context, functions over monads is basically a design pattern. in haskell, the language designers have realized that monadic types are REALLY useful, and so there has been some syntactic sugar added to the language to make dealing with polymorphic monad types easier.
      it's kind of like how you CAN do OOP in C. you just gotta write some code to get v-tables and to get inheritance right, and you gotta solve the diamond problem and stuff like that, but no one is stopping you. it's just that more pure OOP languages make it MUCH easier by adding keywords and other language constructs that make declaring and using classes/objects much easier.

  • @SamuelHauptmannvanDam
    @SamuelHauptmannvanDam 5 лет назад

    Notes:
    - functions can only start with small letters(is said later in video.)
    -At: 44:40 when he skips to: show xs, the complete line needs additional " ++ ". The line would look like this: getListItems (x:xs) = "first item " ++ show x ++ " and the rest are" ++ show xs
    - At 101:46 shoot _ _ = "Error", can only be reached if you use items in scope, twice. Doesn't catch bullet, but catches: shoot Rock Rock

  • @fadisoliman9637
    @fadisoliman9637 6 лет назад +3

    I keep getting a "variable not in scope" when I try to use notepad++ and terminal. Can't get past the first 10 mins of this tutorial! @Derek Banes

    • @ione6391
      @ione6391 5 лет назад

      Hi, I had the same problem and I was searching for an answer, maybe others will have too. I used Visual Studio Code insted and it worked in his terminal.

  • @alexcarr793
    @alexcarr793 6 лет назад

    I learned more in 3 hours while coding and (generously) commenting along to this video than I would have in 8 weeks of a college course. Thanks so much!

    • @derekbanas
      @derekbanas  6 лет назад +1

      Thank you :) I'm very happy that you found the video useful

  • @bencurtis214
    @bencurtis214 9 лет назад +5

    Hi Derek,
    In your Fibonacci sequence function why does the fib call get the first value.

    • @bobeflick
      @bobeflick 9 лет назад +3

      +Ben Curtis fib actually refers to the list [1,1], so the first zip would be (zip [1,1] [1]) so 1+1 is 2 which is added to fib. The 2 lists are of different lengths, but this is okay because of how zip is implemented. Also these two lists are recursively referring to fib, so zip will actually see that the lists are changing! The next zip is (zip [1,1,2] [1,2]), but it is not a separate call to zip. It is actually the same call to zip! This is because the inputs to zip were both recursively modified. So after zip does 1+1 first, it "magically" sees 1+2, then 2+3, then 3+5, and so on. Of course all of this is lazily computed so if you try (take 2 fib), zip is never actually called. You can verify this by (import Debug.Trace) and trying (take 2 $ 1:1:[a+b | (a,b)

  • @filiplazov5895
    @filiplazov5895 7 лет назад

    I allways wanted to check out haskell and this video is probably the best intro i found, thank you!

    • @derekbanas
      @derekbanas  7 лет назад

      Thank you :) I'm glad it helped

  • @liptherapy
    @liptherapy 5 лет назад +4

    2:23 English level 100

  • @MrVbarroso
    @MrVbarroso 8 лет назад

    Although the video is a bit more than an hour long, it took me many more hours to grasp it. Thanks Derek, your videos saves us quite a lot of time! :)

    • @derekbanas
      @derekbanas  8 лет назад

      You're welcome :) Yes for best results it is best to pause a lot as you type in the code and practice. I guess that is my niche? I'm glad you liked it.

  • @user-hh2pr1gq7c
    @user-hh2pr1gq7c 9 лет назад +3

    can you do an Arduino tutorial

    • @derekbanas
      @derekbanas  9 лет назад +4

      PrestigeBernese Sure I'd be very happy to cover electronics :D

  • @miso_miso95
    @miso_miso95 4 дня назад +1

    Shouldn’t it be 1000 when you calculated area of rectangle? Why you calculated 90*90? And not 10*100?!

  • @HodlTWashington
    @HodlTWashington 9 лет назад +5

    I have a request for a "MIPS assembly language Tutorial" please. these are great btw thank you.

    • @derekbanas
      @derekbanas  9 лет назад +5

      Brandon561 I could cover x86 assembly if you're interested? I could cover AVR programming as well.

    • @HodlTWashington
      @HodlTWashington 9 лет назад +2

      yes that would be helpful and much appreciated.

  • @colin398
    @colin398 Год назад

    Just for clarification at 17:05, product calculates the product of all the numbers in the list, not necessarily the least common multiple of all the numbers in the list (that would be the smallest number that all the numbers in the list divide evenly)

  • @ker-balkanrider
    @ker-balkanrider 6 лет назад +7

    The errors the Haskell interpreter throws are some of the most pedantic and nonsensical I have ever seen. To me this is the Dark Souls of programming :)))) hard but fun in a weird way

  • @marklewis1438
    @marklewis1438 9 лет назад

    This is great as a refresher if you haven't written in Haskell for a while. Thanks man.

    • @derekbanas
      @derekbanas  9 лет назад

      +Mark Lewis Thank you :) I'm glad you found it useful.

  • @nhanang7289
    @nhanang7289 3 года назад +3

    Cardano bring me here :)))

    • @tommychentw
      @tommychentw 7 месяцев назад

      The same here 😂

  • @hideakinakano520
    @hideakinakano520 3 месяца назад

    I enjoyed your tutorial. I'm new to programming, so reading typical tutorials is a bit tedious. It's really useful to have shortcuts like this. Now I feel like I'm ready to read some code about Yoneda written in Haskell. Thanks!

  • @王冠信-o1c
    @王冠信-o1c 3 года назад

    Any idea about being not able to link Prelude in the terminal?
    When I type the ghci in the terminal, it only show ghci at the beginning of the terminal instead of 30:22 , but I can't load any file.
    EDIT:
    I can do
    > ghci filename.hs to load file.

  • @OptimalLivingVision
    @OptimalLivingVision 8 лет назад

    Derek Banas thank you very much for the effort you putting in making all these languages, they are really helpful, keep up the good work and wish u all the best

    • @derekbanas
      @derekbanas  8 лет назад

      +selam araya You're very welcome :) I'm glad you like them

  • @Feelyourbodyallways
    @Feelyourbodyallways 9 лет назад +2

    At 22:25, it's divisible by 9 AND 13 right, not OR, that would print alot more numbers I'm sure

  • @meepk633
    @meepk633 4 года назад

    Can someone please explain the [ ] at 26:30 ? I know there are opening and closing brackets for each, I just don't get what they are surrounding. The first one surrounds the whole function. The second one is closed at the end of the first ..10]? Why?

  • @awilliamwest
    @awilliamwest 9 лет назад

    Quite good. I would probably mention the appropriate terms after each example using that concept, like "pattern-matching" (used for deconstruction of tuples), "type class", "this is called a list comprehension", etc.

    • @derekbanas
      @derekbanas  9 лет назад

      +Aaron West Thank you :) Yes I agree that I could have spent more time explaining jargon.

  • @aes0p895
    @aes0p895 Год назад +1

    unless i'm misunderstanding, you misspoke at 10:41; you said floor rounds up but it rounds down (to nearest int).

  • @tareksellami7346
    @tareksellami7346 5 лет назад +1

    there's something wrong with fib explanation: tail fib ist not 2 but [1,2] so when you do zip with fib you'll get [(1,1)(1,2)]. Then add them you'll get 2,3 and then conc them to 1:1 -> 1:1:2:3

  • @instant_mint
    @instant_mint 6 лет назад

    This was super helpful, I studied this slowly and using the cheat sheet over the course of a few days.

    • @derekbanas
      @derekbanas  6 лет назад +1

      Thank you :) I'm happy it helped

  • @89Valkyrie
    @89Valkyrie 9 лет назад

    Derek... you're the coding saint. Thank you really. Been watching your videos every time I'm lost, and every time I find the answer or at least a way to find it on my own.

    • @derekbanas
      @derekbanas  9 лет назад

      Thank you for the compliment :) I'm very happy that my videos help

  • @tonyamelvin9850
    @tonyamelvin9850 4 года назад

    Thank you so much. I found this "in the last hour" for our class but most things are very clear now. May need Haskell for the future..who knows. Great job!

    • @derekbanas
      @derekbanas  4 года назад

      Thank you for taking the time to tell me I helped :) Best of luck with your class

  • @bozidarmitrovic894
    @bozidarmitrovic894 4 года назад

    On 53:36 you defined a function that takes in ONE integer and returns a function that takes in integer and returns an integer.
    But when you implemented the function, you gave it 2 parameters, x and y. Why does that work?

    • @insertoyouroemail
      @insertoyouroemail 4 года назад

      It's called currying. All functions in Haskell are curried by default. The parentheses in the type signature are redundant. He could just as well have written
      getAddFunc :: Int -> Int -> Int

  • @idontevenlikehavingagoogle8077
    @idontevenlikehavingagoogle8077 7 лет назад

    I watched and clicked all ads that pop up in your channel. keep it up man

    • @derekbanas
      @derekbanas  7 лет назад +1

      Thank you very much :) I appreciate it!

  • @RidvanGER
    @RidvanGER 8 лет назад

    omg thank you, dude, I had huge issues in understanding Haskell..now it's all clearer! subscribed

    • @derekbanas
      @derekbanas  8 лет назад

      Thank you :) I'm glad it helped

  • @LooJulian
    @LooJulian 8 лет назад

    Thanks Derek Banas for showing me all about Haskell language.

    • @derekbanas
      @derekbanas  8 лет назад

      I'm very happy that I could help :)

  • @abhishekranaa23
    @abhishekranaa23 2 года назад

    Couldn't Ask for a better explaination! Nailed it out there brother! keep it up

  • @tobiasschoofs7006
    @tobiasschoofs7006 3 года назад

    foldl and foldr: the suffix does *not* mean from the left/right. You can apply foldr on an infinite list if your operator is not strict. But you cannot do it with foldl; e.g. foldr (:) [] is the identity. For foldl it would be the reverse. But with foldl it doesn't work, because foldl goes to the last value first (i.e. it folds "from the right"). My intuition of the suffix is: fold *to the* left/right.

  • @xKawaiiMikuChanx
    @xKawaiiMikuChanx 2 года назад

    Finished this today in 5hrs in order to prepare for class, feeling very prepared rn even my understanding went downhill after Modules coming from object oriented programming - thank you so much for this video tho!

    • @derekbanas
      @derekbanas  2 года назад

      I’m happy I could help

  • @davidpike5959
    @davidpike5959 7 лет назад

    Thanks for the video, that's about the most effective hour I have ever sat in front of a computer. Good pace, excellent explanations. Appreciated!

    • @derekbanas
      @derekbanas  7 лет назад

      Thank you very much :) I'm glad it helped

  • @ArgumentumAdHominem
    @ArgumentumAdHominem 5 лет назад

    + All examples you presented are clear and understandable
    - Not enough focus on non-intuitive differences between Haskell and C, for example, how to handle huge immutable arrays without running out of memory

  • @ayandalatsha558
    @ayandalatsha558 2 года назад +2

    Excellent explanations even after 7 years. Thank you for a great video. This made me understand the haskell books I've been trying to learn for 2 years.

  • @unperrier
    @unperrier 3 года назад +1

    At 53:15 it doesn't make sense: getAddFunc takes a single argument (an Integer) and returns a function (that takes an Integer and returns an Integer)
    But right after (line 9) he defines getAddFunc with a different signature! (two input arguments)
    I undesrtand it's what other languages call "partial" (like "functools.partial" in Python) but it's not explicit hence confusing. I'd expect Haskell to choke on "getAddFunc x y = x + y" because there's no signature matching two input arguments.

    • @matiziel1
      @matiziel1 3 года назад

      it make sense, Int -> Int -> Int and Int -> (Int -> Int) are equivalent in Haskell, you can read about partial application and currying