Modeling the ST monad in Agda

后端 未结 1 533
余生分开走
余生分开走 2021-02-08 02:11

This recent SO question prompted me to write an unsafe and pure emulation of the ST monad in Haskell, a slightly modified version of which you can see below:

{-#         


        
相关标签:
1条回答
  • 2021-02-08 02:50

    Here's some form of a solution done by postulating a parametricity theorem. It also ensures that the postulate does not get in the way of computation.

    http://code.haskell.org/~Saizan/ST/ST.agda

    "darcs get http://code.haskell.org/~Saizan/ST/" for the full source

    I'm not happy about the closed universe of types but it's the easy way to tailor the parametricity theorem to what we actually need.

    0 讨论(0)
提交回复
热议问题