Skip to content

Commit

Permalink
Fix the behavior of repeated inserts in SLMap/CtrieMap. Possibly rela…
Browse files Browse the repository at this point in the history
…ted to #124
  • Loading branch information
rrnewton committed May 11, 2016
1 parent 642d2e1 commit d657ce1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion haskell/lvish/Data/LVar/CtrieMap.hs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ insert !key !elm (IMap (WrapLVar lv)) = WrapPar$ putLV lv putter
where putter cm = do
putRes <- CM.putIfAbsent cm key $ return elm
case putRes of
CM.Added _ -> return $ Just (key, elm)
CM.Added _ -> return $ Just (key, elm)
CM.Found v | elm == v -> return $ Just (key, elm)
CM.Found _ -> throw$ ConflictingPutExn$ "Multiple puts to one entry in an IMap!"

-- | `IMap`s containing other LVars have some additional capabilities compared to
Expand Down
3 changes: 2 additions & 1 deletion haskell/lvish/Data/LVar/SLMap.hs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ insert !key !elm (IMap (WrapLVar lv)) = WrapPar$ putLV lv putter
where putter slm = do
putRes <- SLM.putIfAbsent slm key $ return elm
case putRes of
Added _ -> return $ Just (key, elm)
Added _ -> return $ Just (key, elm)
Found v | elm == v -> return $ Just (key, elm)
Found _ -> throw$ ConflictingPutExn$ "Multiple puts to one entry in an IMap!"

-- | `IMap`s containing other LVars have some additional capabilities compared to
Expand Down

1 comment on commit d657ce1

@rrnewton
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closes #27

Please sign in to comment.