How to read Haskell code (in 7 minutes)

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 มิ.ย. 2024
  • Hope you liked the video! This took a while to make (mostly bc of uni stuff getting in the way).
    In this video, I will be going over the basics of Haskell syntax. Haskell is syntactically very different from other languages, so this video should clear up a lot of confusion around Haskell code. I won't assume you understand everything covered in this video going onward, this is just to make sure I can explain the more interesting stuff without having to explain syntax-related tangents in full detail.
    ==============================================================
    Discord server: / discord
    Twitch: / peppidesu
    Patreon: patreon.com/user?u=55163786
    Fonts used:
    - Presentation: Comfortaa, Lexend Deca
    - Code: Iosevka SSO7
    Color theme: Ayu Mirage
    Tools used: MS PowerPoint, Adobe Premiere Pro, Visual Studio Code
    Timestamps:
    - [0:00] Intro
    - [0:16] Functions
    - [1:10] Calling functions
    - [1:27] Infix functions
    - [1:43] Types
    - [2:20] Type variables
    - [2:55] Typeclasses
    - [3:40] Currying
    - [4:35] Branching
    - [5:09] Pattern matching
    - [5:35] Guards
    - [6:16] Let-in and where
    - [6:33] Outro
    #haskell #functionalprogramming #tutorial #syntax #programming #computerscience
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 71

  • @TheOrbital5
    @TheOrbital5 ปีที่แล้ว +227

    watching this at 2x so i can do it in 3.5min

    • @sukhmandersingh4306
      @sukhmandersingh4306 11 หลายเดือนก่อน +5

      Install the 3x extension to do it in even less

    • @wlcrutch
      @wlcrutch 11 หลายเดือนก่อน +1

      efficiency FTW

    • @fireheartedtimemanagemente5678
      @fireheartedtimemanagemente5678 3 หลายเดือนก่อน

      You can do it in even less time if you just skip to the end of the video.

    • @lowlevelcodingch
      @lowlevelcodingch 2 หลายเดือนก่อน

      3.25 🤓

  • @pomo1238
    @pomo1238 ปีที่แล้ว +29

    thank you very much! i'm getting into haskell after doing python at my university and this video has everything i need. certainly a sub justified

  • @c0lligo
    @c0lligo หลายเดือนก่อน +2

    The sentence "Haskell doesn't even feature variables" deals immense psychic damage to most programmers

  • @KnightMirkoYo
    @KnightMirkoYo 9 หลายเดือนก่อน +6

    After watching this it's so much clearer where a lot of ideas of Rust came from :)

  • @gareth2021
    @gareth2021 ปีที่แล้ว +18

    great video, your first video actually motivated me to start learning haskell :)

  • @c4llv07e
    @c4llv07e ปีที่แล้ว +5

    One more excellent haskell tutorial series!

  • @oPatrickVico
    @oPatrickVico หลายเดือนก่อน

    Awesome video! Hope your channel blows up

  • @scheimong
    @scheimong 7 หลายเดือนก่อน +9

    Funnily enough, I think Rust may be a very good transitional language to help programmers familiar with IP get started with FP. It allows you to do everything you can do in an imperative language, but it has many functional elements that often make your code cleaner and more concise.
    This is all to say, that instead of nosediving into insanity land, you get to ease into it 😅

    • @user-tx4wj7qk4t
      @user-tx4wj7qk4t 4 หลายเดือนก่อน +1

      Disagree completely. It's a systems language so not even a general purpose one and the fact that it has imperative nonsense undermines everything. Not to mention this isn't insanity, this is computer science. It has math and logic backing it. Imperative languages don't and were made completely adhoc and arbitrary with no denotational semantics behind it

  • @uchennaofoma4624
    @uchennaofoma4624 ปีที่แล้ว +17

    Cool video. Subbed! I've been curious about Haskell for a while, but with all the hype around zig, go and rust, I dunno which path to take 😖😖. I'm presently a web developer.
    Hope you make more videos like this 😀

    • @peppidesu
      @peppidesu  ปีที่แล้ว +6

      Thanks a lot! I should look into zig at some point, hearing more and more about it lately.

  • @samuraijosh1595
    @samuraijosh1595 11 หลายเดือนก่อน

    Amazing content my nakama!!!! Im glad i found you while youre just starting your channel. I hope that one day you post haskell solutions of leetcode problems one day. I feel like if you show elegeant and juicy looking haskell solutions to all of those in the leetcode rat race, thats the easiest way to attract a lot of coders towards haskell as most of us are looking for easy to understand code.

  • @leana8959
    @leana8959 ปีที่แล้ว +4

    Thank you! I've always wanted to learn Haskell!

  • @Mashen_Taterz
    @Mashen_Taterz 5 หลายเดือนก่อน

    Thanks so much. Please keep doing more ❤

  • @praveenraj9713
    @praveenraj9713 ปีที่แล้ว +2

    Excellent video, thank you!

  • @tolycodes
    @tolycodes ปีที่แล้ว +1

    Finally I can at least barely understand my xmonad config lol. Great video!

  • @CarrieForle
    @CarrieForle ปีที่แล้ว +1

    Wonderful video!

  • @crr0ww
    @crr0ww ปีที่แล้ว +2

    YES, NEW PEPSI VIDEO DROPPED; ILY! (THIS WAS SO MUCH FUN TO WATCH) 🥳♥

    • @Mauzy0x00
      @Mauzy0x00 ปีที่แล้ว

      Don't have a verified account yet??? wth

  • @markell1172
    @markell1172 10 หลายเดือนก่อน

    Never moved to see what's the matter with Haskell, this seems like a interesting topic.

  • @okdoomer620
    @okdoomer620 8 หลายเดือนก่อน +4

    Hmm... I think the function type arrow has a better explanation. lets say we have a function f :: a -> a -> a -> a, so it "has three arguments" (which is not the whole truth) and returns a value of the same type. The reason why there are only arrows has indeed something to do with currying, but I think it's best explained with implicit braces. if you call the function you can do it like that: f x y z, but there you are leaving off unnecessary braces, equivalent to: (((f x) y) z), and here comes the interesting part. It's the other way around in the type, here we're leaving off these braces: f :: a -> (a -> (a -> a)). So every function ever only takes a single argument, and just returns another function. In practice it doesn't really hurt to think of function taking multiple arguments, but to really understand the syntax it's not that helpful.

    • @user-tx4wj7qk4t
      @user-tx4wj7qk4t 4 หลายเดือนก่อน

      That's literally what currying is

  • @aev6075
    @aev6075 6 หลายเดือนก่อน +3

    Haskell syntax is so simple and pretty... When you are doing tiny to small things. The moment you do medium or larger, the syntax becomes unreadable.

    • @peppidesu
      @peppidesu  6 หลายเดือนก่อน +1

      ok cool ig?

    • @IronicHavoc
      @IronicHavoc 2 หลายเดือนก่อน

      I think the idea (in theory) is that it's predisposes you to break up medium and large tasks into smaller ones. Obviously thats not always possible, but I also wouldn't write off that aspect of it.

    • @IronicHavoc
      @IronicHavoc 2 หลายเดือนก่อน +1

      Like I know people who work with Haskell who have similar criticisms but they provide a lot more nuance than "it only works for small things"

  • @Zetty
    @Zetty ปีที่แล้ว +4

    banger

  • @perarneng
    @perarneng 7 หลายเดือนก่อน +2

    Excellent video! 🎉I think the currying part might be a little bit wrong though. Calling a function with only some of the arguments is called Partial Application. Currying is afaik know the process of turning a “normal “ function in to a curried function. Other than that very nice video, great visuals and clear explanations 🤩

  • @harune6594
    @harune6594 หลายเดือนก่อน

    wow, great video

  • @callyral
    @callyral 6 หลายเดือนก่อน

    as someone who mainly uses rust and has used lisps, i recognize a lot of similarity.
    type variables are like rust's generics, guards are like lisp if

    • @peppidesu
      @peppidesu  6 หลายเดือนก่อน +1

      the likeness with rust will be even more when we start talking about typeclasses and monads, most of the "errors as values" and "make invalid states unrepresentable" philosophy stems from that.

  • @victorpinasarnault9135
    @victorpinasarnault9135 9 หลายเดือนก่อน

    Really nice

  • @Mantorp86
    @Mantorp86 ปีที่แล้ว +2

    Very good video! Do yo have any recommendations on literature for haskel that is relevant today? Thanks!

    • @peppidesu
      @peppidesu  ปีที่แล้ว

      The haskell wiki has a ton of good resources listed i am pretty sure.

  • @HTWwpzIuqaObMt
    @HTWwpzIuqaObMt ปีที่แล้ว +1

    Heck yeah🎉

  • @execute214
    @execute214 6 หลายเดือนก่อน

    how did you make the animation?

  • @nomoredarts8918
    @nomoredarts8918 10 หลายเดือนก่อน +3

    Haskell, one language to curry them all, one to map them, One to all, and in the darkness >>= them

  • @Mauzy0x00
    @Mauzy0x00 ปีที่แล้ว

    You have a perfect voice for this.

  • @lawrencejob
    @lawrencejob ปีที่แล้ว +1

    Amazing video again. May I ask what you’re using to animate your slides?

    • @peppidesu
      @peppidesu  ปีที่แล้ว

      description^^ :)

    • @lawrencejob
      @lawrencejob 11 หลายเดือนก่อน

      @@peppidesu mad at myself for missing that; thank you and sorry!

  • @crazymarxistguy
    @crazymarxistguy 4 หลายเดือนก่อน +2

    Wow! Just amazing. Incredible video, highly detailed and well explaining, while still remaining very short and concise. Great job!

  • @tordjarv3802
    @tordjarv3802 7 หลายเดือนก่อน

    Nice introduction video to the art of Haskell programming, I think that a good programmer should learn some Haskell since it introduces new and useful concepts that most other languages don’t have direct support for. Even if you end up using other languages for your project the spill over effects from learning Haskell can be very useful.

  • @rainboyliu6496
    @rainboyliu6496 ปีที่แล้ว

    hello peppidesu? can you tell that how to make video like this? PPT or Manim or others?

    • @peppidesu
      @peppidesu  ปีที่แล้ว

      latest version of ppt and some editing

    • @rainboyliu6496
      @rainboyliu6496 ปีที่แล้ว

      @@peppidesu thk you

  • @yugalkhanal6967
    @yugalkhanal6967 ปีที่แล้ว +4

    cant wait for monads

  • @man0utoftime
    @man0utoftime 10 หลายเดือนก่อน +1

    Does anyone (i.e.: significant organization) really use Haskell for any production code, though?

    • @peppidesu
      @peppidesu  10 หลายเดือนก่อน +1

      see first video

  • @Wordsalad69420
    @Wordsalad69420 11 หลายเดือนก่อน +4

    Fascinating, but if it’s a purely functional language, then how do I write to a database? You know, the normal shit you have to do once you get out of the functional bubble.

    • @peppidesu
      @peppidesu  10 หลายเดือนก่อน

      I intentionally left that part out, because it is a bit more complicated than usual

  • @SolathPrime
    @SolathPrime 11 หลายเดือนก่อน

    Thanks for explaining my favorite language's syntax to dummies
    Now I can't say I'm smarter than them by evaluating simple code as if it was impossible to process
    now I need to find a better way to commit programming fraud lol😂😂

  • @ClayShentrup
    @ClayShentrup 6 วันที่ผ่านมา

    type signatures are an anti-pattern. just use inference.

  • @sbk1398
    @sbk1398 11 หลายเดือนก่อน +1

    Bout to put Haskell on my resume now

  • @zkreso
    @zkreso 10 หลายเดือนก่อน +1

    Now explain , and >>=

  • @MrSenserus
    @MrSenserus 4 หลายเดือนก่อน

    And I don't even need to memory allocate in my brain to learn this - Haskell has it built in!

  • @danser_theplayer01
    @danser_theplayer01 6 หลายเดือนก่อน

    Hello to people who care about Haskell, I see almost the entirety of you came to this comment section.

  • @kaninchengaming-inactive-6529
    @kaninchengaming-inactive-6529 11 หลายเดือนก่อน +5

    Haskell: A language which solves a non-existing problem

    • @TheEagleWithGlasse
      @TheEagleWithGlasse หลายเดือนก่อน +2

      Lol ^^’
      You have to develop the idea, because I use Haskell and Haskell like languages since 8 years and it solves in a really fast and elegant way all my problems ^^’.
      ( I’m doing video game, I started with OOP.. )

  • @laughingvampire7555
    @laughingvampire7555 3 หลายเดือนก่อน

    stop saying that is a very complicated topic because it isn't

    • @IronicHavoc
      @IronicHavoc 2 หลายเดือนก่อน

      It is to some people, and they often get turned away when someone says it's simple. It's not like hes saying its impenetrable, just chill out.

  • @LukasSkywalker_
    @LukasSkywalker_ 10 หลายเดือนก่อน +1

    Thanks for the video. Now I'm sure that I'll never touch Haskell.
    The syntax doesn't make any sense and there is no real solid reason.
    I like funcional languages but this one is a big no.
    Thanks again

    • @gJonii
      @gJonii 10 หลายเดือนก่อน

      For me this seems to make much more sense than other (functional or otherwise) languages I've seen.

    • @IronicHavoc
      @IronicHavoc 2 หลายเดือนก่อน

      To be fair, those other languages are often more intuitive *because* they borrowed from or built off of Haskell.
      Also the only "weird" about the syntax here I can think of is currying? Which I think is just something you have to get used to for functional programming / lambda calculus in general.

  • @Gkcrafting
    @Gkcrafting 10 หลายเดือนก่อน

    And y'all be saying C++ is the hardest language

  • @nuisho.studio
    @nuisho.studio 4 หลายเดือนก่อน

    Arguments and parameters are different things. The function declaration (not applying or execution) uses parameters, not arguments.