From b9d9333e030ac59ea11d435b7e2e4758daff4b4a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 18 Jan 2019 02:19:06 -0400 Subject: fix withOS type level bug withOS had a type level bug that allowed ensureProperty to be used inside it with a Property that does not match the type of the withOS itself. Propellor.Property.Cron.runPropellor is a Property DebianLike; it was incorrectly a Property UnixLike before and that wrong type was hidden by the withOS bug. This commit was sponsored by Jack Hill on Patreon. --- src/Propellor/Property.hs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/Propellor/Property.hs') diff --git a/src/Propellor/Property.hs b/src/Propellor/Property.hs index 8c0a5859..cb2f01a8 100644 --- a/src/Propellor/Property.hs +++ b/src/Propellor/Property.hs @@ -330,15 +330,9 @@ pickOS a b = c `addChildren` [toChildProperty a, toChildProperty b] withOS :: (SingI metatypes) => Desc - -> (OuterMetaTypesWitness '[] -> Maybe System -> Propellor Result) + -> (OuterMetaTypesWitness metatypes -> 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 :: OuterMetaTypesWitness ('[]) - dummyoutermetatypes = OuterMetaTypesWitness sing +withOS desc a = property' desc $ \w -> a w =<< getOS -- | A property that always fails with an unsupported OS error. unsupportedOS :: Property UnixLike -- cgit v1.2.3