diff options
author | Herbert Valerio Riedel <hvr@gnu.org> | 2017-08-30 01:29:55 +0200 |
---|---|---|
committer | Herbert Valerio Riedel <hvr@gnu.org> | 2017-08-31 09:45:11 +0200 |
commit | c0feee90118333dac817cfad6f2dedc0a886d1bd (patch) | |
tree | f1e7bd59e0c8452d9e51f359d504606a8a346bf0 /compiler/utils/FastString.hs | |
parent | 2c133b67df374c73bc8069cefd7d57e1d2a14fc3 (diff) | |
download | haskell-c0feee90118333dac817cfad6f2dedc0a886d1bd.tar.gz |
Add missing Semigroup instances to compiler
This is a pre-requisite for implementing the Semigroup/Monoid proposal.
The instances have been introduced in a way to minimise warnings.
Diffstat (limited to 'compiler/utils/FastString.hs')
-rw-r--r-- | compiler/utils/FastString.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/utils/FastString.hs b/compiler/utils/FastString.hs index 8653485e0c..ee6dd7a415 100644 --- a/compiler/utils/FastString.hs +++ b/compiler/utils/FastString.hs @@ -118,6 +118,7 @@ import Data.IORef ( IORef, newIORef, readIORef, atomicModifyIORef' ) import Data.Maybe ( isJust ) import Data.Char import Data.List ( elemIndex ) +import Data.Semigroup as Semi import GHC.IO ( IO(..), unsafeDupablePerformIO ) @@ -202,9 +203,12 @@ instance Ord FastString where instance IsString FastString where fromString = fsLit +instance Semi.Semigroup FastString where + (<>) = appendFS + instance Monoid FastString where mempty = nilFS - mappend = appendFS + mappend = (Semi.<>) mconcat = concatFS instance Show FastString where |