Commit 81fecb8b authored by Andrey Mokhov's avatar Andrey Mokhov

Fix warnings

parent dd4270a3
......@@ -131,13 +131,15 @@ executable hadrian
, unordered-containers == 0.2.*
build-tools: alex >= 3.1
, happy >= 1.19.4
ghc-options: -Wall
-fno-warn-name-shadowing
-rtsopts
-- Disable idle GC to avoid redundant GCs while waiting
-- for external processes
-with-rtsopts=-I0
-- Don't use parallel GC as the synchronization time tends to eat any
-- benefit.
-with-rtsopts=-qg0
-threaded
ghc-options: -Wall
-Wincomplete-record-updates
-Wredundant-constraints
-fno-warn-name-shadowing
-rtsopts
-- Disable idle GC to avoid redundant GCs while waiting
-- for external processes
-with-rtsopts=-I0
-- Don't use parallel GC as the synchronization time tends to eat any
-- benefit.
-with-rtsopts=-qg0
-threaded
......@@ -6,7 +6,7 @@ module Base (
module Data.Function,
module Data.List.Extra,
module Data.Maybe,
module Data.Monoid,
module Data.Semigroup,
-- * Shake
module Development.Shake,
......@@ -29,7 +29,7 @@ import Data.Char
import Data.Function
import Data.List.Extra
import Data.Maybe
import Data.Monoid
import Data.Semigroup
import Development.Shake hiding (parallel, unit, (*>), Normal)
import Development.Shake.Classes
import Development.Shake.FilePath
......
......@@ -19,7 +19,7 @@ module Expression (
getTopDirectory,
-- * Re-exports
module Data.Monoid,
module Data.Semigroup,
module Builder,
module Package,
module Stage,
......@@ -28,7 +28,7 @@ module Expression (
import Control.Monad.Trans.Reader
import Control.Monad.Trans
import Data.Monoid
import Data.Semigroup
import Base
import Builder
......@@ -52,9 +52,13 @@ expr = Expr . lift
exprIO :: IO a -> Expr a
exprIO = Expr . liftIO
instance Monoid a => Monoid (Expr a) where
mempty = Expr $ return mempty
mappend (Expr x) (Expr y) = Expr $ (<>) <$> x <*> y
instance Semigroup a => Semigroup (Expr a) where
Expr x <> Expr y = Expr $ (<>) <$> x <*> y
-- TODO: The 'Semigroup a' constraint will at some point become redundant.
instance (Semigroup a, Monoid a) => Monoid (Expr a) where
mempty = pure mempty
mappend = (<>)
instance Applicative Expr where
pure = Expr . pure
......@@ -78,15 +82,15 @@ type Ways = Expr [Way]
-- Basic operations on expressions:
-- | Append something to an expression.
append :: Monoid a => a -> Expr a
append = Expr . return
append :: a -> Expr a
append = pure
-- | Remove given elements from a list expression.
remove :: Eq a => [a] -> Expr [a] -> Expr [a]
remove xs e = filter (`notElem` xs) <$> e
-- | Apply a predicate to an expression.
applyPredicate :: Monoid a => Predicate -> Expr a -> Expr a
applyPredicate :: (Monoid a, Semigroup a) => Predicate -> Expr a -> Expr a
applyPredicate predicate expr = do
bool <- predicate
if bool then expr else mempty
......@@ -97,7 +101,7 @@ arg = append . return
-- | A convenient operator for predicate application.
class PredicateLike a where
(?) :: Monoid m => a -> Expr m -> Expr m
(?) :: (Monoid m, Semigroup m) => a -> Expr m -> Expr m
infixr 3 ?
......
......@@ -5,9 +5,9 @@ import Settings.Builders.Ghc
-- | Given a version string such as "2.16.2" produce an integer equivalent.
versionToInt :: String -> Int
versionToInt s = major * 1000 + minor * 10 + patch
where
[major, minor, patch] = map read . words $ replaceEq '.' ' ' s
versionToInt s = case map read . words $ replaceEq '.' ' ' s of
[major, minor, patch] -> major * 1000 + minor * 10 + patch
_ -> error "versionToInt: cannot parse version."
haddockBuilderArgs :: Args
haddockBuilderArgs = builder Haddock ? do
......
Markdown is supported
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