{-# OPTIONS_GHC -Wno-orphans #-} module Data.SegTree.RangeAddRangeMax where import Data.SegTree import Data.Semigroup instance (Num a, Ord a, Bounded a) => AsSemigroupEndo (Sum a) (Max a) where sendo :: Sum a -> Max a -> Max a sendo (Sum a x) (Max a y) | a y a -> a -> Bool forall a. Eq a => a -> a -> Bool /= a forall a. Bounded a => a minBound = a -> Max a forall a. a -> Max a Max (a x a -> a -> a forall a. Num a => a -> a -> a + a y) | Bool otherwise = a -> Max a forall a. a -> Max a Max a forall a. Bounded a => a minBound {-# INLINE sendo #-}