summaryrefslogtreecommitdiff
path: root/src/Propellor/Types/Info.hs
diff options
context:
space:
mode:
authorJoey Hess2016-03-24 16:55:31 -0400
committerJoey Hess2016-03-24 16:55:31 -0400
commit04c973a4ef966e4f3da8d8bda8b3eb489cd4fbf8 (patch)
treeca04608becfa2e7ca92c86f25e19edf7fda94444 /src/Propellor/Types/Info.hs
parentf5e7596cb9183158644fdd2df9996871dc0a8efa (diff)
refactor
Diffstat (limited to 'src/Propellor/Types/Info.hs')
-rw-r--r--src/Propellor/Types/Info.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Propellor/Types/Info.hs b/src/Propellor/Types/Info.hs
index 53fa9e77..bc1543e2 100644
--- a/src/Propellor/Types/Info.hs
+++ b/src/Propellor/Types/Info.hs
@@ -4,6 +4,7 @@ module Propellor.Types.Info (
Info,
IsInfo(..),
addInfo,
+ toInfo,
getInfo,
mapInfo,
propagatableInfo,
@@ -46,6 +47,9 @@ class (Typeable v, Monoid v, Show v) => IsInfo v where
addInfo :: IsInfo v => Info -> v -> Info
addInfo (Info l) v = Info (InfoEntry v:l)
+toInfo :: IsInfo v => v -> Info
+toInfo = addInfo mempty
+
-- The list is reversed here because addInfo builds it up in reverse order.
getInfo :: IsInfo v => Info -> v
getInfo (Info l) = mconcat (mapMaybe extractInfoEntry (reverse l))