From 89fac12e48547e2dad5413a750469df05e258806 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 2 Jul 2019 12:13:44 -0400 Subject: better explain Property I had thought it could happen when passing the wrong type to a Property constructor, but happily that is not the case. For example & osDebian Unstable False Still produces a good error: • Couldn't match expected type ‘Architecture’ with actual type ‘Bool’ So Property only happens when too many or too few parameters are passed, eg: & osDebian Unstable X86_64 False & osDebian Unstable Before commit 14f6ae30809d8bbdb10b91cc59757e865a365df8, the former of those resulted in: • Couldn't match expected type ‘[Char] -> p0’ with actual type ‘Property (HasInfo + Debian)’ • The function ‘osDebian’ is applied to three arguments, but its type ‘DebianSuite -> Architecture -> Property (HasInfo + Debian)’ has only two Unfortunately, it's now just Property . This is the only reversion I've identified from commit 14f6ae30809d8bbdb10b91cc59757e865a365df8. My ghc bug https://gitlab.haskell.org/ghc/ghc/issues/16894 isn't quite explaining this problem yet, and I need to find a minimal case of it. As to the latter with too few parameters, it used to result in a massive ugly useless error. Now it is also Property , which is an improvement. --- src/Propellor/Types/MetaTypes.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Propellor/Types/MetaTypes.hs b/src/Propellor/Types/MetaTypes.hs index 23c8e9d8..a7037a6a 100644 --- a/src/Propellor/Types/MetaTypes.hs +++ b/src/Propellor/Types/MetaTypes.hs @@ -185,7 +185,7 @@ type family UnknownType :: ErrorMessage where UnknownType = 'Text "" type family UnknownTypeNote :: Maybe ErrorMessage where - UnknownTypeNote = 'Just ('Text "(Property is often due to a partially applied Property constructor, or due to passing the wrong type to a Property constructor.)") + UnknownTypeNote = 'Just ('Text "(Property is often caused by a Property constructor being passed the wrong number of parameters.)") type family CannotCombineMessage (a :: ErrorMessage) (b :: ErrorMessage) (note :: Maybe ErrorMessage) :: ErrorMessage where CannotCombineMessage a b ('Just note) = -- cgit v1.2.3