diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-01-28 13:55:46 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-01-28 13:56:38 -0400 |
commit | 037d86e046a9b5693c81dd8b84bb4d114b47e3ac (patch) | |
tree | b678740958da5b69fd6c5b402574fc908a43e71a /Types/Difference.hs | |
parent | ba3825441c6bd91c8e7bac08893ece8e866c5485 (diff) |
refactor
Diffstat (limited to 'Types/Difference.hs')
-rw-r--r-- | Types/Difference.hs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Types/Difference.hs b/Types/Difference.hs index f92a307363..e4562a0d68 100644 --- a/Types/Difference.hs +++ b/Types/Difference.hs @@ -8,12 +8,14 @@ module Types.Difference ( Difference(..), Differences(..), + readDifferences, getDifferences, differenceConfigKey, differenceConfigVal, hasDifference, ) where +import Utility.PartialPrelude import qualified Git import qualified Git.Config @@ -55,9 +57,13 @@ instance Monoid Differences where mappend (Differences l1) (Differences l2) = Differences (canon (l1 ++ l2)) mappend _ _ = UnknownDifferences +-- Canonical form, allowing comparison. canon :: [Difference] -> [Difference] canon = nub . sort +readDifferences :: String -> Differences +readDifferences = maybe UnknownDifferences Differences . readish + getDifferences :: Git.Repo -> Differences getDifferences r = Differences $ catMaybes $ map getmaybe [minBound .. maxBound] |