insert :: (Ord a) => a -> MaxN a -> MaxN a
insert x m@MaxN{ .. } = f $ m { mElems = insertSorted mFull x mElems }
  where
    f = case mFull of
      True  -> id
      False -> \m@MaxN{ .. } -> m { mSize = mSize + 1, mFull = mSize + 1 == mMaxSize }
insert :: (Ord a) => a -> MaxN a -> MaxN a
insert x m@MaxN{ .. } = f $ m { mElems = insertSorted mFull x mElems }
  where
    f = case mFull of
      True  -> id
      False -> \m@MaxN{ .. } -> m { mSize = mSize + 1, mFull = mSize + 1 == mMaxSize }
insert x m@MaxN{ .. } = f $ m { mElems = insertSorted mFull x mElems }
  where
    f = case mFull of
      True  -> id
      False -> \m@MaxN{ .. } -> m { mSize = mSize + 1, mFull = mSize + 1 == mMaxSize }