From 14f6ae30809d8bbdb10b91cc59757e865a365df8 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 1 Jul 2019 15:49:20 -0400 Subject: custom type error messages * Avoid displaying an excessive amount of type error messages when many properties have been combined in a props list. * Added custom type error messages when Properties don't combine due to conflicting metatypes. * Added custom type error messages for ensureProperty and tightenTargets. * ensureProperty: The constraints have been simplified to EnsurePropertyAllowed. (API change) * ensureProperty: The contraints have been simplified to TightenTargetsAllowed. (API change) * CheckCombinable generates a Bool. (API change) This commit was sponsored by Jake Vosloo on Patreon. --- src/Propellor/Property/Atomic.hs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/Propellor/Property') diff --git a/src/Propellor/Property/Atomic.hs b/src/Propellor/Property/Atomic.hs index 8519048b..2c7433f6 100644 --- a/src/Propellor/Property/Atomic.hs +++ b/src/Propellor/Property/Atomic.hs @@ -46,10 +46,8 @@ type CheckAtomicResourcePair a = AtomicResourcePair a -> Propellor (AtomicResour -- inactiveAtomicResource, and if it was successful, -- atomically activating that resource. atomicUpdate - -- Constriaints inherited from ensureProperty. - :: ( Cannot_ensureProperty_WithInfo t ~ 'True - , (Targets t `NotSuperset` Targets t) ~ 'CanCombine - ) + -- Constriaint inherited from ensureProperty. + :: (EnsurePropertyAllowed t t ~ 'True) => SingI t => AtomicResourcePair a -> CheckAtomicResourcePair a @@ -92,10 +90,8 @@ atomicUpdate rbase rcheck rswap mkp = property' d $ \w -> do -- children: a symlink with the name of the directory itself, and two copies -- of the directory, with names suffixed with ".1" and ".2" atomicDirUpdate - -- Constriaints inherited from ensureProperty. - :: ( Cannot_ensureProperty_WithInfo t ~ 'True - , (Targets t `NotSuperset` Targets t) ~ 'CanCombine - ) + -- Constriaint inherited from ensureProperty. + :: (EnsurePropertyAllowed t t ~ 'True) => SingI t => FilePath -> (FilePath -> Property (MetaTypes t)) -- cgit v1.2.3