Commit 4e03b1c4 authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

Add Base.hs (basic datatypes and imports for the build system).

parent 4139a9c4
{-# LANGUAGE FlexibleInstances #-}
module Base (
module Development.Shake,
module Development.Shake.FilePath,
module Control.Applicative,
module Data.Monoid,
Stage (..),
Args, arg, Condition,
joinArgs, joinArgsWithSpaces,
filterOut,
) where
import Development.Shake hiding ((*>))
import Development.Shake.FilePath
import Control.Applicative
import Data.Monoid
import Data.List
data Stage = Stage0 | Stage1 | Stage2 | Stage3 deriving (Eq, Enum)
type Args = Action [String]
type Condition = Action Bool
instance Monoid a => Monoid (Action a) where
mempty = return mempty
mappend p q = mappend <$> p <*> q
arg :: [String] -> Args
arg = return
intercalateArgs :: String -> Args -> Args
intercalateArgs s args = do
as <- args
return [intercalate s as]
joinArgsWithSpaces :: Args -> Args
joinArgsWithSpaces = intercalateArgs " "
joinArgs :: Args -> Args
joinArgs = intercalateArgs ""
filterOut :: Args -> [String] -> Args
filterOut args list = filter (`notElem` list) <$> args
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment