11 lines
198 B
Haskell
11 lines
198 B
Haskell
{-# 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
|