{-# LANGUAGE MultiParamTypeClasses #-} module RW ( RW(..) ) where class RW a b where get :: b -> a set :: a -> b -> b update :: (a -> a) -> b -> b update f v = set (f (get v)) v