diff options
Diffstat (limited to 'compiler/utils/OrdList.hs')
-rw-r--r-- | compiler/utils/OrdList.hs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/compiler/utils/OrdList.hs b/compiler/utils/OrdList.hs index 3c5b9d7380..a5739764d4 100644 --- a/compiler/utils/OrdList.hs +++ b/compiler/utils/OrdList.hs @@ -9,19 +9,18 @@ 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, lastOL, mapOL, fromOL, toOL, foldrOL, foldlOL ) where +import GhcPrelude + import Outputable -#if __GLASGOW_HASKELL__ > 710 import Data.Semigroup ( Semigroup ) import qualified Data.Semigroup as Semigroup -#endif infixl 5 `appOL` infixl 5 `snocOL` @@ -39,14 +38,12 @@ data OrdList a instance Outputable a => Outputable (OrdList a) where ppr ol = ppr (fromOL ol) -- Convert to list and print that -#if __GLASGOW_HASKELL__ > 710 instance Semigroup (OrdList a) where (<>) = appOL -#endif instance Monoid (OrdList a) where mempty = nilOL - mappend = appOL + mappend = (Semigroup.<>) mconcat = concatOL instance Functor OrdList where @@ -125,4 +122,5 @@ foldlOL k z (Many xs) = foldl k z xs toOL :: [a] -> OrdList a toOL [] = None +toOL [x] = One x toOL xs = Many xs |