[Haskell-cafe] Implementing ParseChart with Data.Map
Isaac Dupree
isaacdupree at charter.net
Tue Jun 3 11:56:55 EDT 2008
Duncan Coutts wrote:
> modify :: k -> Map k e -> (e, Maybe e -> Map k e)
>
> so it's a lookup that returns the element at k and also a continuation
> that lets you rebuild a new map with an altered element. I guess that
> doesn't account for the element not existing. There's probably a
> generalisation that does.
isn't it just adding the necessary Maybe?:
modify :: k -> Map k e -> (Maybe e, Maybe e -> Map k e)
?
-Isaac
More information about the Haskell-Cafe
mailing list