summaryrefslogtreecommitdiff
path: root/src/Propellor/Types/Empty.hs
diff options
context:
space:
mode:
authorJoey Hess2014-12-07 17:09:55 -0400
committerJoey Hess2014-12-07 17:09:55 -0400
commit42a0c832483296fb111279fc3512a3dfd44f2089 (patch)
tree328c20c8a34e908806d240ec2dd5a02437c8df6b /src/Propellor/Types/Empty.hs
parent5a932c382d4cbe65957eb0d3ebe4a9319d8dfd14 (diff)
Display a warning when ensureProperty is used on a property which has Info and is so prevented from propigating it.
Would much rather a type-based fixed, but this is all I have for now.
Diffstat (limited to 'src/Propellor/Types/Empty.hs')
-rw-r--r--src/Propellor/Types/Empty.hs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/Propellor/Types/Empty.hs b/src/Propellor/Types/Empty.hs
new file mode 100644
index 00000000..dcd2f4a0
--- /dev/null
+++ b/src/Propellor/Types/Empty.hs
@@ -0,0 +1,16 @@
+module Propellor.Types.Empty where
+
+import qualified Data.Map as M
+import qualified Data.Set as S
+
+class Empty t where
+ isEmpty :: t -> Bool
+
+instance Empty [a] where
+ isEmpty = null
+
+instance Empty (M.Map k v) where
+ isEmpty = M.null
+
+instance Empty (S.Set v) where
+ isEmpty = S.null