diff options
Diffstat (limited to 'compiler/utils/OrdList.hs')
-rw-r--r-- | compiler/utils/OrdList.hs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/utils/OrdList.hs b/compiler/utils/OrdList.hs index ad72ca1d45..9e735e7d80 100644 --- a/compiler/utils/OrdList.hs +++ b/compiler/utils/OrdList.hs @@ -9,6 +9,7 @@ Provide trees (of instructions), so that lists of instructions can be appended in linear time. -} +{-# LANGUAGE CPP #-} module OrdList ( OrdList, nilOL, isNilOL, unitOL, appOL, consOL, snocOL, concatOL, @@ -17,6 +18,10 @@ module OrdList ( import Outputable +#if __GLASGOW_HASKELL__ < 709 +import Data.Monoid ( Monoid(..) ) +#endif + infixl 5 `appOL` infixl 5 `snocOL` infixr 5 `consOL` @@ -33,6 +38,11 @@ data OrdList a instance Outputable a => Outputable (OrdList a) where ppr ol = ppr (fromOL ol) -- Convert to list and print that +instance Monoid (OrdList a) where + mempty = nilOL + mappend = appOL + mconcat = concatOL + nilOL :: OrdList a isNilOL :: OrdList a -> Bool |