From 860d1dd77e1789a91ed61bdceab667d94c9bd345 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 25 Mar 2016 17:36:52 -0400 Subject: cleanup warnings --- src/Propellor/EnsureProperty.hs | 24 ++++++++++++------------ src/Propellor/Property.hs | 14 +++++++------- src/Propellor/Property/Apt.hs | 14 +++++++------- src/Propellor/Types/MetaTypes.hs | 4 ++-- 4 files changed, 28 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/Propellor/EnsureProperty.hs b/src/Propellor/EnsureProperty.hs index c4b5fde1..c19dc025 100644 --- a/src/Propellor/EnsureProperty.hs +++ b/src/Propellor/EnsureProperty.hs @@ -7,7 +7,7 @@ module Propellor.EnsureProperty ( ensureProperty , property' - , OuterMetaTypes(..) + , OuterMetaTypesWitness(..) ) where import Propellor.Types @@ -17,14 +17,14 @@ import Propellor.Exception -- | For when code running in the Propellor monad needs to ensure a -- Property. -- --- Use `property'` to get the `OuterMetaTypes`. For example: +-- Use `property'` to get the `OuterMetaTypesWithness`. For example: -- -- > foo = Property Debian --- > foo = property' $ \o -> do --- > ensureProperty o (aptInstall "foo") +-- > foo = property' $ \w -> do +-- > ensureProperty w (aptInstall "foo") -- -- The type checker will prevent using ensureProperty with a property --- that does not support the target OSes needed by the OuterMetaTypes. +-- that does not support the target OSes needed by the OuterMetaTypesWitness. -- In the example above, aptInstall must support Debian, since foo -- is supposed to support Debian. -- @@ -36,7 +36,7 @@ ensureProperty ( Cannot_ensureProperty_WithInfo inner ~ 'True , (Targets inner `NotSuperset` Targets outer) ~ 'CanCombine ) - => OuterMetaTypes outer + => OuterMetaTypesWitness outer -> Property (MetaTypes inner) -> Propellor Result ensureProperty _ = catchPropellor . getSatisfy @@ -48,19 +48,19 @@ type instance Cannot_ensureProperty_WithInfo (t ': ts) = Not (t `EqT` 'WithInfo) && Cannot_ensureProperty_WithInfo ts -- | Constructs a property, like `property`, but provides its --- `OuterMetaTypes`. +-- `OuterMetaTypesWitness`. property' :: SingI metatypes => Desc - -> (OuterMetaTypes metatypes -> Propellor Result) + -> (OuterMetaTypesWitness metatypes -> Propellor Result) -> Property (MetaTypes metatypes) property' d a = - let p = Property sing d (a (outerMetaTypes p)) mempty mempty + let p = Property sing d (a (outerMetaTypesWitness p)) mempty mempty in p -- | Used to provide the metatypes of a Property to calls to -- 'ensureProperty` within it. -newtype OuterMetaTypes metatypes = OuterMetaTypes (MetaTypes metatypes) +newtype OuterMetaTypesWitness metatypes = OuterMetaTypesWitness (MetaTypes metatypes) -outerMetaTypes :: Property (MetaTypes l) -> OuterMetaTypes l -outerMetaTypes (Property metatypes _ _ _ _) = OuterMetaTypes metatypes +outerMetaTypesWitness :: Property (MetaTypes l) -> OuterMetaTypesWitness l +outerMetaTypesWitness (Property metatypes _ _ _ _) = OuterMetaTypesWitness metatypes diff --git a/src/Propellor/Property.hs b/src/Propellor/Property.hs index 2ddec439..9fa29888 100644 --- a/src/Propellor/Property.hs +++ b/src/Propellor/Property.hs @@ -22,7 +22,7 @@ module Propellor.Property ( , Propellor , property , property' - , OuterMetaTypes + , OuterMetaTypesWitness , ensureProperty , withOS , unsupportedOS @@ -270,9 +270,9 @@ pickOS a@(Property ta ioa) b@(Property tb iob) = Property sing io -- of the host's operating system. -- -- > myproperty :: Property Debian --- > myproperty = withOS "foo installed" $ \o os -> case os of --- > (Just (System (Debian (Stable release)) arch)) -> ensureProperty o ... --- > (Just (System (Debian suite) arch)) -> ensureProperty o ... +-- > myproperty = withOS "foo installed" $ \w o -> case o of +-- > (Just (System (Debian (Stable release)) arch)) -> ensureProperty w ... +-- > (Just (System (Debian suite) arch)) -> ensureProperty w ... -- > _ -> unsupportedOS -- -- Note that the operating system specifics may not be declared for all hosts, @@ -280,15 +280,15 @@ pickOS a@(Property ta ioa) b@(Property tb iob) = Property sing io withOS :: (SingI metatypes) => Desc - -> (OuterMetaTypes '[] -> Maybe System -> Propellor Result) + -> (OuterMetaTypesWitness '[] -> Maybe System -> Propellor Result) -> Property (MetaTypes metatypes) withOS desc a = property desc $ a dummyoutermetatypes =<< getOS where -- Using this dummy value allows ensureProperty to be used -- even though the inner property probably doesn't target everything -- that the outer withOS property targets. - dummyoutermetatypes :: OuterMetaTypes ('[]) - dummyoutermetatypes = OuterMetaTypes sing + dummyoutermetatypes :: OuterMetaTypesWitness ('[]) + dummyoutermetatypes = OuterMetaTypesWitness sing -- | Throws an error, for use in `withOS` when a property is lacking -- support for an OS. diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index 9c3b05c4..c8ad92e4 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -81,9 +81,9 @@ securityUpdates suite -- Since the CDN is sometimes unreliable, also adds backup lines using -- kernel.org. stdSourcesList :: Property Debian -stdSourcesList = withOS "standard sources.list" $ \o os -> case os of +stdSourcesList = withOS "standard sources.list" $ \w o -> case o of (Just (System (Debian suite) _)) -> - ensureProperty o $ stdSourcesListFor suite + ensureProperty w $ stdSourcesListFor suite _ -> unsupportedOS stdSourcesListFor :: DebianSuite -> Property Debian @@ -158,10 +158,10 @@ installed' params ps = robustly $ check (isInstallable ps) go go = runApt (params ++ ["install"] ++ ps) installedBackport :: [Package] -> Property DebianLike -installedBackport ps = withOS desc $ \o os -> case os of +installedBackport ps = withOS desc $ \w o -> case o of (Just (System (Debian suite) _)) -> case backportSuite suite of Nothing -> unsupportedOS - Just bs -> ensureProperty o $ + Just bs -> ensureProperty w $ runApt (["install", "-t", bs, "-y"] ++ ps) `changesFile` dpkgStatus _ -> unsupportedOS @@ -247,11 +247,11 @@ unattendedUpgrades = enable disable | otherwise = "false" configure :: Property DebianLike - configure = withOS "unattended upgrades configured" $ \o os -> - case os of + configure = withOS "unattended upgrades configured" $ \w o -> + case o of -- the package defaults to only upgrading stable (Just (System (Debian suite) _)) - | not (isStable suite) -> ensureProperty o $ + | not (isStable suite) -> ensureProperty w $ "/etc/apt/apt.conf.d/50unattended-upgrades" `File.containsLine` ("Unattended-Upgrade::Origins-Pattern { \"o=Debian,a="++showSuite suite++"\"; };") diff --git a/src/Propellor/Types/MetaTypes.hs b/src/Propellor/Types/MetaTypes.hs index 6545c924..6033ec27 100644 --- a/src/Propellor/Types/MetaTypes.hs +++ b/src/Propellor/Types/MetaTypes.hs @@ -116,8 +116,8 @@ type family CheckCombinable (list1 :: [a]) (list2 :: [a]) :: CheckCombine -- one target, so can only happen if there's already been a type error. -- This special case lets the type checker show only the original type -- error, and not an extra error due to a later CheckCombinable constraint. -type instance CheckCombinable '[] list2 = CanCombine -type instance CheckCombinable list1 '[] = CanCombine +type instance CheckCombinable '[] list2 = 'CanCombine +type instance CheckCombinable list1 '[] = 'CanCombine type instance CheckCombinable (l1 ': list1) (l2 ': list2) = CheckCombinable' (Combine (l1 ': list1) (l2 ': list2)) type family CheckCombinable' (combinedlist :: [a]) :: CheckCombine -- cgit v1.2.3