No title

1
2
3
4
5
6
7
8
9
10
11
12
13
14
newtype Priority = Priority Int
newtype Size = Size Int

instance Monoid Size where
  mempty = Size 0
  mappend a b = Size $ (getNum a) + (getNum b)
    where
      getNum (Size n) = n

instance Monoid Priority where
  mempty = Priority maxBound
  mappend a b = Priority $ (getNum a) `min` (getNum b)
    where
      getNum (Priority n) = n