module Store1(Store, initial, value, update) where initial :: Store a b value :: Eq a=> Store a b-> a-> Maybe b update :: Eq a=> Store a b-> a-> b-> Store a b data Store a b = Store [(a, b)] deriving Show initial = Store [] value (Store ls) a = case filter ((a ==).fst) ls of (_, x):_ -> Just x [] -> Nothing update (Store ls) a b = Store ((a, b): ls)