How to read Haskell code (in 7 minutes)

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

Комментарии • 101

  • @TheOrbital5
    @TheOrbital5 Год назад +305

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

  • @c0lligo
    @c0lligo 8 месяцев назад +101

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

    • @0LoneTech
      @0LoneTech 4 месяца назад +5

      It's a bit of word games, really. Even if you make the assumption they mean variables as in a mutable location in memory, like a C addressable lvalue, Haskell does support those via Foreign and Storable. There are also other mechanisms like MVar and TVar.
      Point is, those are not how you write basic logic. Starting there would make things harder. For imperative programmers, it's a crucial step to go from "do this then that" to "this is".

    • @MatthewHolevinski
      @MatthewHolevinski 25 дней назад +1

      Not as much damage as someone who titles a video how to READ haskell code without actually ever mention how it is read.

  • @pomo1238
    @pomo1238 Год назад +35

    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

  • @KnightMirkoYo
    @KnightMirkoYo Год назад +10

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

    • @WillEhrendreich
      @WillEhrendreich Месяц назад

      Well, interestingly enough, the likely source of the ideas in rust are probably Ocaml, because the original compiler was written in that. I suppose we might call it a.. Fun.. Fact.

  • @gareth2021
    @gareth2021 Год назад +21

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

  • @c4llv07e
    @c4llv07e Год назад +6

    One more excellent haskell tutorial series!

  • @uchennaofoma4624
    @uchennaofoma4624 Год назад +19

    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  Год назад +7

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

  • @scheimong
    @scheimong Год назад +11

    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 😅

    • @AndreiGeorgescu-j9p
      @AndreiGeorgescu-j9p 10 месяцев назад +3

      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

    • @EpicNicks
      @EpicNicks 5 месяцев назад

      @@AndreiGeorgescu-j9p if forgetting that computer science is not the fundamental basis for computation in the real world, but electrical/computer engineering which has resulted in languages which generalize sequential assembly instructions grouped into procedures, procedural programming being arbitrary might be true.

    • @0LoneTech
      @0LoneTech 4 месяца назад

      @@AndreiGeorgescu-j9p Nonsense. While PLCs exist where you build systems with programming that is specifically not general purpose, what we refer to as a system programming language has to be general purpose. It was mostly introduced with C. Turing and Random Access machines are thorough semantic models, just ones that carry state. Just like lamda calculus, they require abstraction to be practically applied to complex tasks; this is not a limitation of either model, it's one of human minds.
      What makes Rust a bad choice isn't the way it introduces type classes (renamed traits) and loop fusion (via a heap of other abstractions). It's how it insistently distracts the programmer with memory management minutiae at all times (an extremist case of premature optimization). The noisy syntax is a bit of a double edged notion, as it's apparent some people think that's a requirement.

    • @0LoneTech
      @0LoneTech 2 месяца назад

      @@AndreiGeorgescu-j9p Being suitable for one purpose (and the most general one at that) doesn't make a language not general purpose. While Rust's main weakness (its focus on sequential effects like what is freed when) is firmly rooted in imperative style, it does indeed bring over several core advantages directly taken from the ML family, such as sensible sum types, pattern matching and functional iteration fusion.

  • @nomoredarts8918
    @nomoredarts8918 Год назад +8

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

  • @okdoomer620
    @okdoomer620 Год назад +5

    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.

  • @samuraijosh1595
    @samuraijosh1595 Год назад +2

    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.

  • @oPatrickVico
    @oPatrickVico 8 месяцев назад

    Awesome video! Hope your channel blows up

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

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

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

    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  Год назад +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.

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

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

  • @crazymarxistguy
    @crazymarxistguy 11 месяцев назад +2

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

  • @crr0ww
    @crr0ww Год назад +2

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

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

    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  Год назад +1

      ok cool ig?

    • @IronicHavoc
      @IronicHavoc 9 месяцев назад +1

      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 9 месяцев назад +2

      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"

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

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

  • @perarneng
    @perarneng Год назад +3

    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 🤩

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

    This is a crazy helpful video! Thanks.

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

    Thanks so much. Please keep doing more ❤

  • @praveenraj9713
    @praveenraj9713 Год назад +2

    Excellent video, thank you!

  • @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.

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

    Wonderful video!

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

    banger

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

    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.

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

    how did you make the animation?

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

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

  • @ClayShentrup
    @ClayShentrup Месяц назад

    dank u wel. this was great.

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

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

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

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

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

      description^^ :)

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

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

  • @Vijay_2711
    @Vijay_2711 4 дня назад

    Hi,Need some help with Haskell

  • @sbk1398
    @sbk1398 Год назад +2

    Bout to put Haskell on my resume now

  • @harune6594
    @harune6594 8 месяцев назад

    wow, great video

  • @Wordsalad69420
    @Wordsalad69420 Год назад +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  Год назад

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

    • @0LoneTech
      @0LoneTech 4 месяца назад

      Haskell is literally the language that invented the solution for that. And we use libraries like esqueleto, selda or persistent.

    • @Wordsalad69420
      @Wordsalad69420 4 месяца назад

      @@0LoneTech So presumably those libraries are not purely functional?

    • @0LoneTech
      @0LoneTech 4 месяца назад

      @@Wordsalad69420 An incorrect assumption.

    • @Wordsalad69420
      @Wordsalad69420 4 месяца назад

      @@0LoneTech How can they be purely functional if they have side effects?

  • @ClayShentrup
    @ClayShentrup Месяц назад

    type signatures are an anti-pattern.

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

    Really nice

  • @therealist9052
    @therealist9052 5 месяцев назад

    "Haskell doesn't even feature variables"
    Emotional Damage.

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

    cant wait for monads

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

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

    • @0LoneTech
      @0LoneTech 4 месяца назад

      They have their uses. E.g. the Idris way involves writing your type signatures and inferring the logic. :P

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

      The best way is to let the inference write the type signature into your code for you.

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

      @@TheArtikae the best way is to let your complier/editor infer the interface.

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

    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😂😂

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

    Heck yeah🎉

  • @nuisho.studio
    @nuisho.studio 11 месяцев назад

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

  • @danielc1792
    @danielc1792 3 месяца назад +1

    RUclips ads are getting REALLY BAD.

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

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

  • @MrSenserus
    @MrSenserus 11 месяцев назад

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

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

    Now explain , and >>=

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

    🤔🤔🤔🤔

  • @laughingvampire7555
    @laughingvampire7555 10 месяцев назад

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

    • @IronicHavoc
      @IronicHavoc 9 месяцев назад

      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.

    • @alastairleith8612
      @alastairleith8612 5 месяцев назад

      go deeper, read Haskell source code, you'll find complexity all the way down.

  • @kaninchengaming-inactive-6529
    @kaninchengaming-inactive-6529 Год назад +7

    Haskell: A language which solves a non-existing problem

    • @TheEagleWithGlasse
      @TheEagleWithGlasse 8 месяцев назад +3

      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.. )

  • @LukasSkywalker_
    @LukasSkywalker_ Год назад +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 Год назад

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

    • @IronicHavoc
      @IronicHavoc 9 месяцев назад

      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 Год назад

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