server/src/Data.hs

12 lines
200 B
Haskell

{-# LANGUAGE MultiParamTypeClasses #-}
module Data (
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