summaryrefslogtreecommitdiff
path: root/Command/Map.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-05-15 02:49:43 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-05-15 03:38:08 -0400
commitcad0e1c8b7eb21f8dceca8dd9fa3bc1d1aa7eabd (patch)
treeb6be12dc1cc83a35ca7d89a862d85e6d71c38572 /Command/Map.hs
parentefa7f544050c0d5be6bc1b0fc0125278e475c213 (diff)
simplified a bunch of Maybe handling
Diffstat (limited to 'Command/Map.hs')
-rw-r--r--Command/Map.hs16
1 files changed, 5 insertions, 11 deletions
diff --git a/Command/Map.hs b/Command/Map.hs
index 3c94fc75b..7a9121b69 100644
--- a/Command/Map.hs
+++ b/Command/Map.hs
@@ -84,10 +84,7 @@ repoName umap r
| otherwise = M.findWithDefault fallback repouuid umap
where
repouuid = getUncachedUUID r
- fallback =
- case (Git.repoRemoteName r) of
- Just n -> n
- Nothing -> "unknown"
+ fallback = maybe "unknown" id $ Git.repoRemoteName r
{- A unique id for the node for a repo. Uses the annex.uuid if available. -}
nodeId :: Git.Repo -> String
@@ -121,13 +118,10 @@ edge umap fullinfo from to =
{- Only name an edge if the name is different than the name
- that will be used for the destination node, and is
- different from its hostname. (This reduces visual clutter.) -}
- edgename =
- case (Git.repoRemoteName to) of
- Nothing -> Nothing
- Just n ->
- if (n == repoName umap fullto || n == hostname fullto)
- then Nothing
- else Just n
+ edgename = maybe Nothing calcname $ Git.repoRemoteName to
+ calcname n
+ | n == repoName umap fullto || n == hostname fullto = Nothing
+ | otherwise = Just n
unreachable :: String -> String
unreachable = Dot.fillColor "red"