3 ms·
To build on this, it's worth noting that you can't implement your own IO monad in Haskell (or at least, not Haksell 98) on top of unsafePerformIO. At root you n
by foldr 4y ago
To build on this, it's worth noting that you can't implement your own IO monad in Haskell (or at least, not Haksell 98) on top of unsafePerformIO. At root you need some special magic to ensure that A's side effects are sequenced before B's in (A >> B). The type of (>>) does not guarantee this.
- nextaccountic 4y agoWell, you have seq. The type of seq also doesn't guarantee this, but the implementation does
- foldr 4y agoI don’t think so? Seq is strict in its first argument, but that doesn’t provide a way of guaranteeing the order of side effects that I can see. Edit: You may be thinking of pseq, but I don't think that's in the Haskell 98 report.