From b068adc98faaa13a31fab0acadf60a636c5af66f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 1 Apr 2019 12:45:56 -0400 Subject: comment --- ...ent_1_9de1b00ba845174d2e8df191578cde3c._comment | 67 ++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 doc/forum/need_help_to_write_a_property_of_a_generic_kind/comment_1_9de1b00ba845174d2e8df191578cde3c._comment (limited to 'doc/forum') diff --git a/doc/forum/need_help_to_write_a_property_of_a_generic_kind/comment_1_9de1b00ba845174d2e8df191578cde3c._comment b/doc/forum/need_help_to_write_a_property_of_a_generic_kind/comment_1_9de1b00ba845174d2e8df191578cde3c._comment new file mode 100644 index 00000000..283d6864 --- /dev/null +++ b/doc/forum/need_help_to_write_a_property_of_a_generic_kind/comment_1_9de1b00ba845174d2e8df191578cde3c._comment @@ -0,0 +1,67 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 1""" + date="2019-04-01T15:54:33Z" + content=""" +Building that, the first error message is this: + + Expected type: RevertableProperty (HasInfo + DebianLike) UnixLike + Actual type: RevertableProperty + (CombinedType + (Property + (Propellor.Types.MetaTypes.MetaTypes + '['Propellor.Types.MetaTypes.WithInfo, + 'Propellor.Types.MetaTypes.Targeting 'OSDebian, + 'Propellor.Types.MetaTypes.Targeting 'OSBuntish, + 'Propellor.Types.MetaTypes.Targeting 'OSArchLinux, + 'Propellor.Types.MetaTypes.Targeting 'OSFreeBSD])) + (Property UnixLike)) + UnixLike + +It's really complaining +that it expected HasInfo + DebianLike and got HasInfo + UnixLike; ie your +property seems to also support ArchLinux and FreeBSD. (Whether it really +does, I don't know.) + +There seem to be several similar errors in the supported OS's, which don't +help with focusing on the other errors.. + +I have not found a solution to all of those, but part of the problem +is that, inside a where clause a type annotation with a type variable +such as `i` is not understood to refer to the same variable in the +outer type annotation. There's some ghc extension that enables that, +but I can never remember its name. + +After removing those inner type annotations, the remaining type error +was with userGrantedProp.. So I removed its type annotation as well +and let ghc infer its type. (Had to enable LANGUAGE TypeFamilies for it +to be able to.) Here's what ghc thinks it is: + + Top-level binding with no type signature: + userGrantedProp :: (Propellor.Types.Singletons.SingI outer, + Propellor.Types.MetaTypes.NotSuperset + '['Propellor.Types.MetaTypes.Targeting 'OSDebian, + 'Propellor.Types.MetaTypes.Targeting 'OSBuntish, + 'Propellor.Types.MetaTypes.Targeting 'OSArchLinux, + 'Propellor.Types.MetaTypes.Targeting 'OSFreeBSD] + (Propellor.Types.MetaTypes.Targets outer) + ~ 'Propellor.Types.MetaTypes.CanCombine) => + User + -> [Privilege] + -> ((((String -> Propellor Result) -> Propellor Result) + -> Property (Propellor.Types.MetaTypes.MetaTypes outer)) + -> Property setupmetatypes) + -> Desc + -> ([Char] -> String -> [Char] -> [Char]) + -> ([Char] -> String -> [Char] -> String) + -> RevertableProperty setupmetatypes UnixLike + +That's not very human friendly a way to write its type, but it gives some +good direction. Note in particular that the type of withPassword seems to +involve two different types of Property, not the single `Property i` that +your original type uses in both places. + +I have a feeling though that there may be a bug in the code around withPassword +that is leading to this type and that the type error is not really the root +problem. +"""]] -- cgit v1.2.3