Hello, I just installed propellor 2.13.0 and now I get this error message.
It was sort of expected due to the chnages in the API. I would like your advice about this problem. Indeed I combine Property and RevertableProperty.
so what should be the best way to fix this issue.
src/Propellor/Property/Sbuild.hs:57:51:
Couldn't match type ‘Property (CInfo HasInfo NoInfo)’
with ‘RevertableProperty HasInfo’
Expected type: RevertableProperty HasInfo
Actual type: CombinedType
(RevertableProperty HasInfo) (Property NoInfo)
In the expression: (setup <!> cleanup) `requires` installed
In an equation for ‘schroot’:
schroot sn chroot@(Chroot.Chroot chrootdir _ _)
= (setup <!> cleanup) `requires` installed
where
setup
= conf `requires` (provision `onChange` targz)
where
provision
= toProp (Chroot.provisioned chroot) `before` umount
where
...
targz = createTarball chrootdir tarball
....
cleanup
= File.notPresent (schrootChrootD </> sn)
`requires` File.notPresent tarball
`requires` toProp (revert (Chroot.provisioned chroot))
tarball = chrootdir <.> "tar.gz"
thanks
Combining a Property HasInfo with a RevertableProperty HasInfo should work fine, and I have not been able to reproduce this type error with some simple combinations of such properties.
Can you share the code that produces the type error?
It seems that this is the combinaison of a Revertable HasInfo with a Property NoInfo
I will sen you the file
Ok, what's going on is that the combination of a RevertableProperty and a Property with requires has changed from being a RevertableProperty before to a Property now. (Because it can't all be reverted.)
Since your code has
schroot :: RevertableProperty HasInfo
ghc complains that the type it infers doesn't match. Changing that toProperty HasInfo
will clear up the type error.Unfortunate that the error message is complicated in this case by the use of CInfo and CombinedType. If you notice that
CInfo HasInfo NoInfo = HasInfo
and thatCombinedType (RevertableProperty HasInfo) (Property NoInfo) = Property HasInfo
, a better error message would be:ok, But I rellay want a Revertable Property.
should I just make a revertable property of the installed Property in order to have
RevertableProperty HasInfo
required
(installed <!> doNothing)It depends. If it makes sense for your property to remove the software when it's reverted, then make
installed
revertable like that.Maybe that doesn't make sense though, you only want to make sure it's installed before using it, but you don't necessarily want to remove it just because this one property that uses it gets reverted. You can express that this way:
I do think it was a good change, in propellor 2.13.0, to make "revertable
requires
nonrevertable" not be a RevertableProperty. Now when we want a RevertableProperty, we have to think about whether it makes sense to revert the whole thing or not; before this change we just got back a so-called RevertableProperty that was not actually fully revertable, and probably didn't think about it enough.