The Haskell Unfolder Episode 34: you already understand monads

Поділитися
Вставка
  • Опубліковано 19 жов 2024
  • Function composition is the idea that we can take two functions and create a new function, which applies the two functions one after the other. When viewed from the right angle, monads generalize this idea from functions to programs: construct new programs by running other programs one after the other. In this episode we make this simple idea precise. We will also see what the monad laws look like in this setting, and we will discuss an example of what goes wrong when the monad laws are broken.
    Links:
    GitHub repo: github.com/wel...
    Unfolder episode 8 on reasoning: • The Haskell Unfolder E...

КОМЕНТАРІ • 11

  • @christianschafer3724
    @christianschafer3724 3 дні тому +7

    Great way to introduce the Monad. I never thought about it this way. Saying it is composition of two programs also makes a lot of sense and avoids the common Monad container analogy.

  • @dr-Jonas-Birch
    @dr-Jonas-Birch 3 дні тому +1

    Great content as always. Your channel deserves to be bigger. Please heed my advice: remove access to the older livestreams and then you upload the recordings instead, as regular videos. Upload one episode every 4th day on the spot. You will be Amazed of the views and subscriber count after a couple of weeks. You can use the timer feature so it's not much work. I got from 0 subs to 20k in ten months. JB

  • @pedrovasconcelos8260
    @pedrovasconcelos8260 3 дні тому +3

    Great video! I like the choice if using composition rather than bind and will try it whenever I teach monads again. Also: kudos for showing the importance of laws as a way of enabling refactorings. I'd just like to add that laws are also useful for reasoning about functions that operate over general monads e.g. sequence or foldM.

  • @MP3-b5w
    @MP3-b5w 3 дні тому +1

    Thank you for the great video! It was very helpful.

  • @SuperZsomi
    @SuperZsomi День тому

    Thanks for the example.
    Do you have more examples about the monads like Timed ?

  • @georgH
    @georgH 6 годин тому

    It was thanks to a video explaining monads through the operator

  • @samuraijosh1595
    @samuraijosh1595 3 дні тому +2

    No i don't

  • @lucastourinho6370
    @lucastourinho6370 3 дні тому +1

    Great ep! Is it possible to provide a more sensible instance for Monad in the Timed example?
    Link to the 'Laws' episode mentioned @ 28:48 - ua-cam.com/video/V7673JaWXaA/v-deo.html

    • @edskodevries
      @edskodevries 3 дні тому +1

      Maybe the easiest way to do it would be to impose the timeout in the `MonadIO` instance, so that every time you `liftIO` an operation, you implicitly impose the timeout.

    • @well-typed
      @well-typed  2 дні тому

      Thanks for the link, have now added it to the video description also :)