How can I specify that two operations commute in a typeclass?

后端 未结 4 2447
旧时难觅i
旧时难觅i 2021-02-20 15:58

I started reading this paper on CRDTs, which is a way of sharing modifiable data concurrently by ensuring that the operations that modify the data are commutative. It seemed to

4条回答
  •  长情又很酷
    2021-02-20 16:07

    What I can't figure is how to phrase the contract that operations must commute in the specification of the typeclass.

    The reason that you can't figure it out is that it's not possible. You can't encode this kind of property in types - not in Haskell at least.

提交回复
热议问题