-- esempio di Var e Value data Var = Var Int deriving (Show) instance Eq Var where Var n == Var m = n==m type Value = String -- soluzione type Binding = Var -> (Maybe Value) update :: Binding -> Var -> Value -> Binding update b varUpd valUpd var = if (var == varUpd) then (Just valUpd) else (b var) -- esempio di uso myb v = if (v==(Var 1)) then (Just "cucu") else Nothing newb = update myb (Var 2) "settete"