# Ticket #1985: patch.txt

File patch.txt, 3.3 KB (added by dbenbenn, 9 years ago) |
---|

Line | |
---|---|

1 | |

2 | New patches: |

3 | |

4 | [Fix bug 1985 |

5 | David Benbennick <dbenbenn@gmail.com>**20071224012920] { |

6 | hunk ./Data/IntSet.hs 547 |

7 | --- | /O(min(n,W))/. Retrieves the maximal key of the set, and the set stripped from that element |

8 | +-- | /O(min(n,W))/. Retrieves the maximal key of the set, and the set stripped of that element. |

9 | hunk ./Data/IntSet.hs 550 |

10 | -maxView t |

11 | - = case t of |

12 | - Bin p m l r | m < 0 -> let (result,t') = maxViewUnsigned l in return (result, bin p m t' r) |

13 | - Bin p m l r -> let (result,t') = maxViewUnsigned r in return (result, bin p m l t') |

14 | - Tip y -> return (y,Nil) |

15 | - Nil -> fail "maxView: empty set has no maximal element" |

16 | +maxView Nil = fail "maxView: empty set has no maximal element" |

17 | +maxView t = return $ deleteFindMax t |

18 | hunk ./Data/IntSet.hs 559 |

19 | --- | /O(min(n,W))/. Retrieves the minimal key of the set, and the set stripped from that element |

20 | +-- | /O(min(n,W))/. Retrieves the minimal key of the set, and the set stripped of that element. |

21 | hunk ./Data/IntSet.hs 562 |

22 | -minView t |

23 | - = case t of |

24 | - Bin p m l r | m < 0 -> let (result,t') = minViewUnsigned r in return (result, bin p m l t') |

25 | - Bin p m l r -> let (result,t') = minViewUnsigned l in return (result, bin p m t' r) |

26 | - Tip y -> return (y, Nil) |

27 | - Nil -> fail "minView: empty set has no minimal element" |

28 | +minView Nil = fail "minView: empty set has no minimal element" |

29 | +minView t = return $ deleteFindMin t |

30 | hunk ./Data/IntSet.hs 572 |

31 | --- Duplicate the Identity monad here because base < mtl. |

32 | -newtype Identity a = Identity { runIdentity :: a } |

33 | -instance Monad Identity where |

34 | - return a = Identity a |

35 | - m >>= k = k (runIdentity m) |

36 | - |

37 | - |

38 | hunk ./Data/IntSet.hs 576 |

39 | -deleteFindMin = runIdentity . minView |

40 | +deleteFindMin Nil = (error "deleteFindMin: cannot return the minimal element of an empty set", Nil) |

41 | +deleteFindMin (Tip y) = (y, Nil) |

42 | +deleteFindMin (Bin p m l r) |

43 | + | m < 0 = let (result, t') = minViewUnsigned r in (result, bin p m l t') |

44 | + | otherwise = let (result, t') = minViewUnsigned l in (result, bin p m t' r) |

45 | hunk ./Data/IntSet.hs 586 |

46 | -deleteFindMax = runIdentity . maxView |

47 | +deleteFindMax Nil = (error "deleteFindMax: cannot return the maximal element of an empty set", Nil) |

48 | +deleteFindMax (Tip y) = (y, Nil) |

49 | +deleteFindMax (Bin p m l r) |

50 | + | m < 0 = let (result, t') = maxViewUnsigned l in (result, bin p m t' r) |

51 | + | otherwise = let (result, t') = maxViewUnsigned r in (result, bin p m l t') |

52 | hunk ./Data/IntSet.hs 594 |

53 | -findMin = fst . runIdentity . minView |

54 | +findMin = fst . deleteFindMin |

55 | hunk ./Data/IntSet.hs 598 |

56 | -findMax = fst . runIdentity . maxView |

57 | +findMax = fst . deleteFindMax |

58 | hunk ./Data/IntSet.hs 602 |

59 | -deleteMin = snd . runIdentity . minView |

60 | +deleteMin = snd . deleteFindMin |

61 | hunk ./Data/IntSet.hs 606 |

62 | -deleteMax = snd . runIdentity . maxView |

63 | +deleteMax = snd . deleteFindMax |

64 | } |

65 | |

66 | Context: |

67 | |

68 | [Fix a link in haddock docs |

69 | Ian Lynagh <igloo@earth.li>**20071126184450] |

70 | [Fix some URLs |

71 | Ian Lynagh <igloo@earth.li>**20071126214233] |

72 | [Add tiny regression test |

73 | David Benbennick <dbenbenn@gmail.com>**20071113045358] |

74 | [Fix ticket 1762 |

75 | David Benbennick <dbenbenn@gmail.com>**20071111201939] |

76 | [Specify build-type: Simple |

77 | Duncan Coutts <duncan@haskell.org>**20071018125404] |

78 | [Add a boring file |

79 | Ian Lynagh <igloo@earth.li>**20070913204647] |

80 | [TAG 2007-09-13 |

81 | Ian Lynagh <igloo@earth.li>**20070913215901] |

82 | Patch bundle hash: |

83 | ad8baf94a3c4817286c5a499d8b8e658ad874cd8 |