JSON Parser 100% From Scratch in Haskell (only 111 lines)

แชร์
ฝัง

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

  • @johnwerner3714
    @johnwerner3714 3 ปีที่แล้ว +262

    Are you having trouble understanding haskell? Study this video for a month. His explanations are in perfect English and you listen to him think out loud; his THOUGHT PROCESS IS VERY CLEAR. No textbook can give you that. Great teacher !! OUTSTANDING

    • @edvardm4348
      @edvardm4348 ปีที่แล้ว +10

      My thoughts exactly! I've read lots of Haskell books and even written a clumsy parser, but this guy is amazingly good in explaining things

    • @Antagon666
      @Antagon666 7 หลายเดือนก่อน +4

      "Study this video for a month" this statement doesn't give Haskell a very nice look.

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

      And I still won't know how to indent properly SO IT COMPILES (1:35:03)

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

      i studied it for a month. still didnt understand. moving on to php now.

    • @samuraijosh1595
      @samuraijosh1595 14 วันที่ผ่านมา

      @@andrewbuzz7308 just use a formatter.

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

    this is some extremely high quality content

    • @mnslr
      @mnslr 3 ปีที่แล้ว +8

      absolutely. I heard "emacs" and despite already assigning this guy the "dope tech 'tuber" label he gets the rare "speaks to my soul" label too

    • @elatedbento
      @elatedbento 3 ปีที่แล้ว +3

      Couldn't agree more. Great channel!

  • @Ahmad-if1tt
    @Ahmad-if1tt 4 ปีที่แล้ว +262

    Holy crap, you just covered the first half of my functional programming course in one video (Functors, Applicatives, Monads, Parsing) and I understood more than I did in all my lectures combined. Props man, if I pass it's all cuz of you.

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

      did you pass?

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

      Where do you study?

    • @Ahmad-if1tt
      @Ahmad-if1tt 4 ปีที่แล้ว +11

      @@krishnasivakumar2479 yep, managed to get it done haha

    • @Ahmad-if1tt
      @Ahmad-if1tt 4 ปีที่แล้ว +7

      @@solopernumeri2 University of Toronto

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

      @@Ahmad-if1tt awesome, kudos! What was your grade?

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

    Me, a dirty C#, Java, Javascript, Typescript programmer:
    uh huh, you did some weird functional haskell stuff, when are you gonna get to the parsing?
    Haskell:
    runParser (stringP "null") "null"
    Just ("","null")
    Me:
    Alright, what the fuck is this black magic?

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

    You've just popularized hole-driven development :)

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

      Not surprising, given the amount of penetration in this video. 🙃

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

    next video: how to implement a haskell compiler in haskell.

  • @yecinemegdiche3202
    @yecinemegdiche3202 3 ปีที่แล้ว +7

    I tried to keep my serious face when you kept saying "penetration", but I absolutely lost it when you said "double penetration"
    Awesome video though! Thanks

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

    Just a small caveat: Applicative has some laws that can't be expressed in Haskell code. So the proof that it is Applicative is not complete with just the implementation. But usually the obvious implementation does satisfy the laws.

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

      I'm intrigued. Can you expand on this?

    • @chon-850
      @chon-850 3 ปีที่แล้ว +4

      @@unsafecast3636
      According to hackage.haskell.org/package/base-4.14.1.0/docs/Control-Applicative.html
      A valid applicative needs to satisfy the following laws, some of which are not expressed in the implementation. This means you could write an Applicative instance of a type and have it compile in Haskell, but it doesn't necessarily mean it's mathematically a lawful / valid applicative.
      Identity:
      pure id v = v
      Composition:
      pure (.) u v w = u (v w)
      Homomorphism:
      pure f pure x = pure (f x)
      Interchange:
      u pure y = pure ($ y) u

    • @unsafecast3636
      @unsafecast3636 3 ปีที่แล้ว +3

      @@chon-850oh okay. Thanks

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

    This video got me huge into Haskell, I gave up on Learn You a Haskell when I got to applicatives but you made something so cool and elegant with them that I had to go back and keep learning. Now I can follow along everything you're saying, Haskell has changed how I look at programming

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

      it’s nice that learn you a haskell is free but it’s not really a great book IMO. i have no idea why the first pages of the book are all haskell syntactic sugar and other garbage that has nothing to do with the core of what haskell is (the language) and how to program with the core of the language

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

      @@michaelthompson7217
      agreed. I'm not really sure who LYaH is for, tbh
      I guess it might be okay when it's used in a University course, alongside a lecture and some assignments-I end up referring to it sometimes, for examples of things, and I guess it would serve a similar function for someone who has to pass a class

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

    I’m a C# dev so this Haskell stuff looks like black magic

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

      same here, i'm trying to understand FP.

    • @shubham.1172
      @shubham.1172 4 ปีที่แล้ว +10

      This paper from 1998 is an extremely nice introduction to lambda calculus www.cse.chalmers.se/research/group/logic/TypesSS05/Extra/geuvers.pdf

    • @0xDEAD_Inside
      @0xDEAD_Inside 4 ปีที่แล้ว +1

      @@shubham.1172 Thanks

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

      Same. It was very hard understanding functional programming a few weeks ago, before I started learning haskell. Now it feels really nice, this guy knows what he's doing.

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

      fsharpforfunandprofit.com/posts/understanding-parser-combinators/ might be more approachable if you know or planning to learn F#

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

    I'm intrigued about the Porn Folder indicator on the status bar

    • @josemaria_landa
      @josemaria_landa 3 ปีที่แล้ว

      lol i just saw it

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

      Where do you think the double penetration implementation lives!?

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

    I'm glad you explained the runParser thing. So many tutorials gloss over why a 'field' in a 'struct' would be called runThing.

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

    haskell hurts my brain, but learning it has been so fantastic, I'm getting a new perspective on programming, and this video has been a great resource for that

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

    This is Fcking Amazing!

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

    The way you explain this make this easy to understand. The irony of this is that by not trying to look like a genius, by keeping to a simple style, you actually show your intelligence. Well done. Please do make some more content like this!

  • @pouris
    @pouris 11 หลายเดือนก่อน +21

    "We need to prove that parser is penetrable"
    -- Tsoding 2019

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

    58:00 Why not just implement "jsonBool" as:
    JsonBool ((True

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

      Ah, I see in the GitHub repo that at some point you did kinda the same.

    • @skepticmoderate5790
      @skepticmoderate5790 3 ปีที่แล้ว

      I was thinking (const True) stringP "true" because I didn't know about

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

      Lol I was thinking the same thing and glad someone 4 years ago thought the same

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

    charP could also have been implemented as
    charP x = Parser f
    where
    f x:ys = Just (ys, x)
    f _ = Nothing

  • @Klarpimier
    @Klarpimier 7 หลายเดือนก่อน +3

    I want to add something VERY IMPORTANT here: this code as it’s written in this video won’t work. It will run in an infinite loop and never finish
    The problem is with the many function and definitions like in fmap and the applicative map operator. The way Haskell works involves some lazy evaluation, which means that expressions are evaluated as they are needed. If you unpack the definition as so “(Parser p1)” etc., Haskell will evaluate the contained function p1 before determining what needs to be executed with the given string. This means that, for a recursive call like in many, the program will continue to evaluate the full implementation of the function without knowing when to stop. To fix this, change the instances of (Parsel p) to just p and use runParser p to call the function. This way Haskell will only evaluate the function implementation when it’s given text argument and hence know when to stop.

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

    JS dev be like, I made chat apps, typed 10k lines in 2 mins.
    Haskell deb be like, I made Parsers, only 111 lines in 2 hours.

    • @mikejackson7230
      @mikejackson7230 3 ปีที่แล้ว

      JS dev here. I have no idea what I am watching.

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

    I would be incredibly grateful if you could evolve this into a small series. Much like you start with Functor and move towards Applicative and Monad in implementation, if this could start with an Applicative and move towards an implementation using Monad and then MonadTs. It would still be a JSON parser each time, just showcasing how you would do it with each abstraction.
    edit: This was a great video, thank you

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

    Hey man, really appreciate your taking the time to step through your intuitions especially. There's one thing to know the theory of a programming language. But the real test is being able to construct a program with it. Cheers!

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

    I lost it at around 45 minutes when you introduced operator...

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

      Understandable, is probably the weirdest of them all. I think the problem is that it does way too many things:
      1. It merges the Applicatives.
      2. It applies the function of the right applicative to the value of the left applicative.
      It's really unintuitive what would you use such combination of actions for. Use case example at 41:30 is probably the best thing I could come up with. Sorry if I could not explain it better. I also initially didn't understand why would you need , but over time after working with Maybe-s a lot I eventually sort of realized what it's meant for.

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

      Pure functions perform calculations. But sometimes you want to have not only pure calculations but side effects as well. Functors, applicative functors, and monads are exactly about it: about performing pure calculations AND/OR side effects.
      Let's take for example Double. Pure functions should be deterministic, it means they have to be defined for all possible operations with Doubles. But what if you divide a Double by zero? Dividing by zero is not defined, and the result of it is out of the set of Doubles. Thus, with Maybe Double you perform EITHER pure calculations by getting (Just result) OR perform a side effect (in our case it is Nothing).
      The Parser from the video is an example of performing pure calculations AND (instead of OR which we have seen with Maybe Double in the example above) side effects. When we parse the string we get the result of the pure calculation (the second element of the tuple) AND a side effect (the rest of the string as the tuple's first element).
      Now it is easy to grasp the notion of the () operator (it calls "apply"). You have two entities, and each of them performs pure calculation AND a side effect. When you "apply" the first of it to the second with the help of () operator, you need to perform pure calculations with both second values of tuples AND sequentially perform 2 side effects (to return the rest of the string from the first parser and to return the rest of the rest of the string from the second parser). So you are parsing the input string with the first parser (and get a tuple (the_rest_of_the_string, pure_function)), and then parse the_rest_of_the_string with the second parser (and get a tuple (the_rest_of_the_rest_of_the_string, pure_function_applied_to_value)).
      Hope it will help you to understand.

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

      And later in the video, you will encounter 2 more operators from Applicative: ().
      The first operator () ignores the value of the first parser and takes the value of the second parser but performs side effects of both parsers as well.

    • @therenaissance8322
      @therenaissance8322 4 ปีที่แล้ว

      I get it now... Thanks!

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

      The way I kinda wrapped my mind around it is this:
      Imagine this:
      let a = (5+)
      let b = 5
      In Haskell, everything is a function, and a and b can easily be combined with the expression a b.
      >a b
      10
      But not everything is a nice pure function. Sometimes you have Applicatives, like Maybe. Consider this:
      let a = Just (5+)
      let b = Just 5
      You can no longer just do (a b) to get 10. Since Maybe is Applicative, however, we know that we can turn "inside out" the contents and evaluate the function of one with respect to the value of another.
      >a b
      Just 10
      The result is an Applicative as well, an assertion that has been unadulterated by our .
      I've almost certainly oversimplified it but I hope the explanation makes it clearer.

  • @tiagogoll4142
    @tiagogoll4142 3 ปีที่แล้ว +3

    Are you aware of ghcid --allow-eval mode?
    With it you can evaluate as many conditions as you like using "-- $> " so you just need to save the file and the expression will be evaluated bellow the "all good" confirmation, instead of having a tab bellow just to type some code to have it evaluated.

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

    Nice haskell session. I just started learning it and it's interesting for me to see how your coding workflow is.

  • @stas4112
    @stas4112 ปีที่แล้ว +10

    My favorite thing about this channel is that it takes me like 6 hours to follow along with a 2 hour long video haha. The level of detail is absolutely incredible, we're very lucky to have this content just online like this

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

    This video is absolutely fantastic. I miss my time playing with Haskell... always forgot ':r', too. I would have loved this level of content 8 years ago :). Amazing, man, just amazing.

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

    You made me open my notes on Monoidal Categories, something not even the professor in that course managed to do

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

    This is such a good video, thanks so much :)
    A question though, wouldn't a monadic interface for Parser make it easier to read and write combinators? Especially with do-notation...

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

      I guess it's a personal preference. I personally like the Applicative style better because the set of resulting parsers sort of resembles BNF in structure :D

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

      You could use the language extension ApplicativeDo

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

    Praise our Haskell Wizard Overloard! All jokes aside, this was a really fascinating video that I'll probably rewatch later to learn more from. I've been using C for a class and I miss the rich abstractions in Haskell. It's kinda jarring going from one mindset to the other. In C you can accomplish the same things but with structs, loops, pointers, etc. I imagine working in C helps one reason about performance better in a HLL like Haskell and working in Haskell helps one identify useful abstractions for coding in a lower level language like C.

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

    I came back to this 2 years later, now I'm actually doing a bachelor's thesis on a compiler using Haskell and this was such a great video, it's even better now that I understand Haskell and compilers better
    If it wasn't for you Tsoding I probably wouldn't have discovered my passion for programming language design, I remember tuning in to all of the Porth streams and trying to implement it in C++ myself
    Thank you so much ❤

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

    That's the most ... descriptive ... explanation of a functor I've ever heard. Thank you.

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

    I don't even program in Haskel let alone any functional language but when I do I sure as hell will watch your videos!

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

    Not impressive for me. But surprised that one may do the job without monad. Nice video, thanks

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

    Legendary video. Worth noting that this approach can also be followed in imperative languages (Javascript, anyone?) and leads to an incredibly succinct way of implementing parsers.

  • @minhtu_thomas_hoang
    @minhtu_thomas_hoang 3 ปีที่แล้ว +3

    This tutorial complements real well with The Haskell Book's chapter 24 on "Parser Combinator".

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

    Любое видео по функциональному языку: ничего не понятно, но очень интересно

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

    This is absolutely amazing content. Thank you for this, please keep up the good work man!

  • @neel6
    @neel6 20 วันที่ผ่านมา +1

    I was intrigued by Haskell and decided to follow along with you as you code. Was able to understand a good chunk of it without needing any course or tutorial.
    Thank you for your efforts!

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

    Amazing video. I've used parsec/attoparsec/megaparsec to build parsers, but how they work was always somewhat of a mystery to me. Watching you build a parser from scratch was incredible, and all the little insights along the way were so valuable.

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

    I would enjoy seeing you make a parser for some binary format (exe, mp3, png...) using parser combinators made by hand or from a major library, or hand-made recursive descent, in one of the new languages such as Rust.

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

      You could probably do a similar thing but using Attoparsec instead, since it's specialized on binary formats

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

    thank you for this video, it really helped with functors and applicatives!

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

    I found your video looking for some Haskell tutorials and I am amazed on how well you explain everything. Thank you! My favourite video on Haskell for now.

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

    what is this "P*rn Folder" thing in your bar? :p Great video brother! Love it

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

    I Implemented a JSON Parser with C and took me around 1000 Lines, as JSON is a context free language, and is not a regular Lagrange, you need a push down automaton to implement it, additionally this push-down automaton, need 34 states, I am really surprised that you need just 111 lines to implement it since Haskell is more complicated than C/C++.
    I have troubles learning Haskell, because it is a ridiculously complicated language.

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

    This was literally the first thing I tried when I started learning Haskell, it took me closer to 200 lines though lol

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

    charP '!' *> applause

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

    One day I'll understand this whole vid.

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

    Really great video! Just wanted to ask: Isn't your Parser type (if you made it a Monad) just an instance of State? i.e. Parser a is the same as State String (Maybe a)?

    • @moonythm
      @moonythm 4 ปีที่แล้ว

      I think he wanted to show how it works under the hood

  • @0x1337feed
    @0x1337feed 3 ปีที่แล้ว +2

    mind blown at 1:00:10
    imma go back and rewrite my scheme implementation using all of what I've learned here cause man this is epic

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

    Крутое видео, спасибо!

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

    hoooolyyyyy ...!!!1111
    you just helped me implement a parser for the first time and I am buzzed about it :D
    I got up to 1:39:25, now I am going to grab a beer and drink it with you talking the last 10 mins to celebrate xD
    p.s. you are a swell and entertaining dude

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

    I got this recommended and I just had to watch it

  • @NoOne-ev3jn
    @NoOne-ev3jn 3 หลายเดือนก่อน +2

    Tsoding is just underrated

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

    The chat is not silent - it is speechless!

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

    Pleeease dont stop posting content you're so cool and such a good informative teacher

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

    I was just looking for an excuse to learn how to parse stuff in haskell but didn't know where to begin... Thanks man, this was amazing!!! Looking forward to get more haskell wisdom

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

    This looks like voodoo magic, where to start learning?

  • @freaking1122
    @freaking1122 3 ปีที่แล้ว +3

    Thank you for taking the time to do this. It’s incredibly detailed and informative

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

    Спасибо за то, что показали, как реализовать синтаксический анализ в Haskell. Не зная Haskell, я решил попробовать разобрать XML для альтернативного языка разметки. Вы обеспечили отличное основание.

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

      Для
      парсинга есть библиотека parsec.
      Это почти тоже самое,что он показал в видео.

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

    hundred times better than a college course. thank you

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

    Awesome video!!!! Thank you for taking the time to do this!!!!
    I have a question though:
    In the code below
    instance Functor Parser where
    fmap m (Parser p) = Parser $ \input -> do
    (input', x)

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

    I’ll give a pogchamp. As a java programmer, this looks like black magic. Though I oddly understood some of it. I appreciate the explanations of everything. Not to mention the result was incredible I am impressed.

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

    I Love how Russians speak English, everything hears so clearly

    • @Synthetica9
      @Synthetica9 4 ปีที่แล้ว

      I read his accent as French at first

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

    Every time you say "for the next parser", it would have been good to reinforce how `>>=` works. For a newbie Haskeller seeing that a parser returns `Maybe (String, a)` would make it hard to see how another parser with type `String -> Maybe (String, a)` could accept that because they would probably be thinking in terms of the "raw" types.

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

    Good video.
    It shows how haskell abstractiobs can help us to express our functions or data types.

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

    This video served me a perfect parser combinator tutorial. Vielen Dank!

  • @UODZU-P
    @UODZU-P 4 ปีที่แล้ว +1

    Is this reversible? can you output JSON from your AST

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

    I studied Haskell in class. Loved the language but didn't continued learning it. Makes me want to go back to it.

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

    "Maybe is already an Alternative. May be we can take advantage of that" :D 56:00

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

    Дружище, есть такое на русском?

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

    Moar like this, please :) Good stuff, tsoding.

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

    this is the best video i have seen on youtube in my entire life

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

    would be useful to see how to create simple http server with Haskell, event without database

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

    Data.Map (containers) was never in base, but containers _is_ part of the haskell platform

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

    Double penetration operation is my favourite new applicative related term haha

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

    Definitely the most useful explanation on applicatives. Super cool

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

    Can't you use alternative to parse floats and things, so that if parsing a float, with a decimal point, fails, then it tries to parse the value as an integer?

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

    Wow you make it seem so effortless 🤩

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

    This video is awesome, but it also scares me. It really sounds complicated.

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

    All these combinator parsing tutorials these days. TH-cam is really trying to make me learn this.

    • @0x1337feed
      @0x1337feed 3 ปีที่แล้ว

      ^ said no one ever

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

    It takes two hours to write 111 lines of code in Haskell

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

    спасибо

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

    49:40 to 49:48 had me laughing so hard 😂 this is amazing thank you

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

    This is magic. Thanks for keeping my hope high on learning haskell and parsers.

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

    Why does the thumbnail have a crossed out XML?

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

    I've learned so much from this man! More videos like this please!

  • @nonetrix3066
    @nonetrix3066 3 ปีที่แล้ว

    Trying to make one in C++ code is a mess I have no idea what I am doing

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

    `sepBy` можно легче определить через `many`, поскольку `many parser` парсит 0 или больше вхождений. Таким образом:
    sepBy :: Parser Char -> Parser JsonValue -> Parser [JsonValue]
    sepBy sep parser = many (many sep *> parser)

    • @mechmaker9346
      @mechmaker9346 4 ปีที่แล้ว

      Только ты sep поставил перед,а значит возможен такой случай:
      [ ,1,2,3]

  • @G.dodgyMorning2YA
    @G.dodgyMorning2YA 3 ปีที่แล้ว +1

    Based.

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

    CAN YOUR JAVASCRIPT DO THAT?

  • @protowalker
    @protowalker 3 ปีที่แล้ว

    Alright I've watched this so many times now and another Haskell thing just clicked, I think. Since everything in Haskell is lazy by default, there isn't really a functional difference between a Parser and an "unwrapped" parser that's already been run. That's so cool - - encoding data in advance before we even know what it is!

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

    You teach well enough that you should have a Patreon or similar (I'd support your Haskell endeavours ;))

  • @JannisAdmek
    @JannisAdmek 3 ปีที่แล้ว

    I just started learning Haskell, what have I got myself into? This looks really complicated.

  • @user-ot54ht
    @user-ot54ht 8 หลายเดือนก่อน

    Fantastic video. 10/10. I wanted to learn to program in Lean, and this was such a blessing.

  • @BigBeesNase
    @BigBeesNase 3 ปีที่แล้ว

    In the definition of notNull, you are just mapping/transforming a value inside a Parser. You can just re-write it using a map.

  • @n3ttx580
    @n3ttx580 4 ปีที่แล้ว

    I have 0 idea what are you doing, and honestly it looks more like some forbidden language to summon demons, but I watched it almost to the end just because it is entertaining. I might get into Haskell after this :D

  • @ILoveSoImAlive
    @ILoveSoImAlive 3 ปีที่แล้ว

    looks great, but to me it seems, that for such scenarios finite state machines are still better approach. its possible to make such thing short and adaptable, and to move the rules into some xml/json config file. after that you just need to load a config and have any parser you want.
    the only problem still is the parsing of numerics to valid numbervalues, because they are limited and plattform dependend. there you either need some magic or you just stick to some standart and either block values outside of valid ranges, or make exceptions for them like inf for to big, round for to exact, asf.

  • @noctavel
    @noctavel 3 ปีที่แล้ว

    isnt fmap a subexpression of ?

  • @Neph-00
    @Neph-00 4 ปีที่แล้ว

    Still using only Base, you could cut a few lines by using hackage.haskell.org/package/base-4.12.0.0/docs/Text-ParserCombinators-ReadP.html :) But as a teaching example, this was a great video!