module Store2(Store, initial, value, update) where data Store a b = Store (a-> Maybe b) initial = Store (const Nothing) value (Store f) a = f a update (Store f) a b = Store (\x-> if x== a then Just b else f x)