MuniHac 2016: Beautiful folds are practical, too

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 พ.ย. 2024

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

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

    A Beautiful Session on Beautiful Folds
    I am a beginner at Haskell and this talk was entertaining and enlightening but more importantly, it brought together a number of ideas (not just on folds) that I am only beginning to grok.
    Thank you so much.
    Please do more (I am going to search out all of your other sessions and lessons.)
    BTW, I am highly critical of most speakers -- you are superb.

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

    Really amazing stuff, and the speaker did a phenomenal job at explaining it.
    One question I have is whether mapping over a list/traversable just to apply a newtype data constructor could be avoided in some way via type coercion (which is always doable for newtypes) and whether it ends up making a difference. I'm not an experienced haskeller but I'm guessing it would require some type family magic.

  • @123coolmik
    @123coolmik 5 ปีที่แล้ว

    Thanks, this was very enlightening

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

    How can the average-fold be so efficient, if you basically create new list of `Average`s (thus you need extra iteration to copy the list)?

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

      In short, a very smart compiler. 1. All those "Average" constructors are erased at compile time by GHC. They are only used to determine how to do plumbing at the type level. 2. The folds are using stream fusion to compile to a single loop with no intermediate structures. The compiler makes heavy use of inlining to detect these cases, even when your folds are the composition of other folds across module, or even package, boundaries.