diff options
author | Kavon Farvardin <kavon@farvard.in> | 2018-09-23 15:29:37 -0500 |
---|---|---|
committer | Kavon Farvardin <kavon@farvard.in> | 2018-09-23 15:29:37 -0500 |
commit | 84c2ad99582391005b5e873198b15e9e9eb4f78d (patch) | |
tree | caa8c2f2ec7e97fbb4977263c6817c9af5025cf4 /utils/runghc | |
parent | 8ddb47cfcf5776e9a3c55fd37947c8a95e00fa12 (diff) | |
parent | e68b439fe5de61b9a2ca51af472185c62ccb8b46 (diff) | |
download | haskell-wip/T13904.tar.gz |
update to current master againwip/T13904
Diffstat (limited to 'utils/runghc')
-rw-r--r-- | utils/runghc/Main.hs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/utils/runghc/Main.hs b/utils/runghc/Main.hs index b5d4a4a9ca..dec53eefb0 100644 --- a/utils/runghc/Main.hs +++ b/utils/runghc/Main.hs @@ -19,6 +19,7 @@ module Main (main) where import Control.Exception +import Data.Semigroup as Semi import System.Directory import System.Environment import System.Exit @@ -77,14 +78,17 @@ data RunGhcFlags = RunGhcFlags (Maybe FilePath) -- GHC location | Help -- Print help text | ShowVersion -- Print version info +instance Semi.Semigroup RunGhcFlags where + Help <> _ = Help + _ <> Help = Help + ShowVersion <> _ = ShowVersion + _ <> ShowVersion = ShowVersion + RunGhcFlags _ <> right@(RunGhcFlags (Just _)) = right + left@(RunGhcFlags _) <> RunGhcFlags Nothing = left + instance Monoid RunGhcFlags where mempty = RunGhcFlags Nothing - Help `mappend` _ = Help - _ `mappend` Help = Help - ShowVersion `mappend` _ = ShowVersion - _ `mappend` ShowVersion = ShowVersion - RunGhcFlags _ `mappend` right@(RunGhcFlags (Just _)) = right - left@(RunGhcFlags _) `mappend` RunGhcFlags Nothing = left + mappend = (<>) parseRunGhcFlags :: [String] -> (RunGhcFlags, [String]) parseRunGhcFlags = f mempty |