From c0d0e57257fe8dee1f9d37a6d49b6322af985a69 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 11 Nov 2016 17:29:11 -0400 Subject: Clean up build warnings about redundant constraints when built with ghc 8.0. Only a couple of the constraints were really redundant. The rest are essential to propellor's tracking of Info propigation, so I silenced the warning for those. It would be better to only silence the warning for the functions with the extra constraints, but IIRC warnings can only be silenced on an entire file basis. This commit was sponsored by Andreas on Patreon. --- src/Propellor/Info.hs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/Propellor/Info.hs') diff --git a/src/Propellor/Info.hs b/src/Propellor/Info.hs index e9218291..75f0b76a 100644 --- a/src/Propellor/Info.hs +++ b/src/Propellor/Info.hs @@ -1,4 +1,5 @@ {-# LANGUAGE PackageImports, TypeFamilies, DataKinds, PolyKinds #-} +{-# OPTIONS_GHC -fno-warn-redundant-constraints #-} module Propellor.Info ( osDebian, @@ -38,6 +39,9 @@ import Prelude -- -- The new Property will include HasInfo in its metatypes. setInfoProperty + -- -Wredundant-constraints is turned off because + -- this constraint appears redundant, but is actually + -- crucial. :: (MetaTypes metatypes' ~ (+) HasInfo metatypes, SingI metatypes') => Property metatypes -> Info @@ -47,6 +51,9 @@ setInfoProperty (Property _ d a oldi c) newi = -- | Adds more info to a Property that already HasInfo. addInfoProperty + -- -Wredundant-constraints is turned off because + -- this constraint appears redundant, but is actually + -- crucial. :: (IncludesInfo metatypes ~ 'True) => Property metatypes -> Info -- cgit v1.2.3 From b1038365960693a013d7026f25d026a1fd098062 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 11 Nov 2016 17:40:32 -0400 Subject: turn off redundant constraints warnings in cabal file ghc 7 does not support -fno-warn-redundant-constraints so this can't be done on a per-module basis. It would be good to revert this commit when dropping support for ghc 7. --- propellor.cabal | 2 ++ src/Propellor/Container.hs | 1 - src/Propellor/EnsureProperty.hs | 1 - src/Propellor/Info.hs | 1 - src/Propellor/PropAccum.hs | 1 - 5 files changed, 2 insertions(+), 4 deletions(-) (limited to 'src/Propellor/Info.hs') diff --git a/propellor.cabal b/propellor.cabal index 7d145024..db70942a 100644 --- a/propellor.cabal +++ b/propellor.cabal @@ -63,6 +63,8 @@ Executable propellor-config Library GHC-Options: -Wall -fno-warn-tabs -O0 + if impl(ghc >= 8.0) + GHC-Options: -fno-warn-redundant-constraints Extensions: TypeOperators Hs-Source-Dirs: src Build-Depends: diff --git a/src/Propellor/Container.hs b/src/Propellor/Container.hs index 5c365f59..26194456 100644 --- a/src/Propellor/Container.hs +++ b/src/Propellor/Container.hs @@ -1,5 +1,4 @@ {-# LANGUAGE DataKinds, TypeFamilies #-} -{-# OPTIONS_GHC -fno-warn-redundant-constraints #-} module Propellor.Container where diff --git a/src/Propellor/EnsureProperty.hs b/src/Propellor/EnsureProperty.hs index e8602047..30dfd5ad 100644 --- a/src/Propellor/EnsureProperty.hs +++ b/src/Propellor/EnsureProperty.hs @@ -3,7 +3,6 @@ {-# LANGUAGE PolyKinds #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UndecidableInstances #-} -{-# OPTIONS_GHC -fno-warn-redundant-constraints #-} module Propellor.EnsureProperty ( ensureProperty diff --git a/src/Propellor/Info.hs b/src/Propellor/Info.hs index 75f0b76a..3d7f07a5 100644 --- a/src/Propellor/Info.hs +++ b/src/Propellor/Info.hs @@ -1,5 +1,4 @@ {-# LANGUAGE PackageImports, TypeFamilies, DataKinds, PolyKinds #-} -{-# OPTIONS_GHC -fno-warn-redundant-constraints #-} module Propellor.Info ( osDebian, diff --git a/src/Propellor/PropAccum.hs b/src/Propellor/PropAccum.hs index c7ef946a..5d1d3afb 100644 --- a/src/Propellor/PropAccum.hs +++ b/src/Propellor/PropAccum.hs @@ -4,7 +4,6 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE DataKinds #-} -{-# OPTIONS_GHC -fno-warn-redundant-constraints #-} module Propellor.PropAccum ( host -- cgit v1.2.3