Skip to content

Comment on OCaml for Haskellersparent

Comments

You can cheat in haskell as well. You can store the mutable variable in an mvar and then use unsafePerformIO (modifyMVar action) . It's uglier, but on the other hand the unsafeness of it jumps out at you.

MVars are for sharing data between threads. IORefs are mutable boxes.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.