Add Oracles.hs (configuration infrastructure).
[ghc.git] / Base.hs
1 {-# LANGUAGE FlexibleInstances #-}
2
3 module Base (
4 module Development.Shake,
5 module Development.Shake.FilePath,
6 module Control.Applicative,
7 module Data.Monoid,
8 Stage (..),
9 Args, arg, Condition,
10 joinArgs, joinArgsWithSpaces,
11 filterOut,
12 ) where
13
14 import Development.Shake hiding ((*>))
15 import Development.Shake.FilePath
16 import Control.Applicative
17 import Data.Monoid
18 import Data.List
19
20 data Stage = Stage0 | Stage1 | Stage2 | Stage3 deriving (Eq, Enum)
21
22 type Args = Action [String]
23
24 type Condition = Action Bool
25
26 instance Monoid a => Monoid (Action a) where
27 mempty = return mempty
28 mappend p q = mappend <$> p <*> q
29
30 arg :: [String] -> Args
31 arg = return
32
33 intercalateArgs :: String -> Args -> Args
34 intercalateArgs s args = do
35 as <- args
36 return [intercalate s as]
37
38 joinArgsWithSpaces :: Args -> Args
39 joinArgsWithSpaces = intercalateArgs " "
40
41 joinArgs :: Args -> Args
42 joinArgs = intercalateArgs ""
43
44 filterOut :: Args -> [String] -> Args
45 filterOut args list = filter (`notElem` list) <$> args