aboutsummaryrefslogtreecommitdiffstats
path: root/app/History/CommitHash.hs
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2023-12-07 03:58:21 +0100
committerLibravatar Alexander Foremny <aforemny@posteo.de>2023-12-07 04:01:23 +0100
commitc1ff403387064ff0027b9e762cc6f6a8fa20c8d9 (patch)
tree62b9a4cfccfc4fce42055ef94b9de41d1dfcc0a7 /app/History/CommitHash.hs
parent3c6e62b75293b6625509ade3c278fc2d4d147c30 (diff)
chore: move remaining `History.*` modules outside of `History`
Diffstat (limited to 'app/History/CommitHash.hs')
-rw-r--r--app/History/CommitHash.hs37
1 files changed, 0 insertions, 37 deletions
diff --git a/app/History/CommitHash.hs b/app/History/CommitHash.hs
deleted file mode 100644
index 1075b2f..0000000
--- a/app/History/CommitHash.hs
+++ /dev/null
@@ -1,37 +0,0 @@
-module History.CommitHash
- ( CommitHash (..),
- toShortText,
- toText,
- )
-where
-
-import Data.Binary (Binary)
-import Data.Maybe (fromMaybe)
-import Data.Text qualified as T
-import GHC.Generics (Generic)
-import Render qualified as P
-
-data CommitHash
- = WorkingTree
- | Commit T.Text
- deriving (Eq, Show, Binary, Generic)
-
-toShortText :: CommitHash -> Maybe T.Text
-toShortText = fmap (T.take 7) . toText
-
-toText :: CommitHash -> Maybe T.Text
-toText WorkingTree = Nothing
-toText (Commit hash) = Just hash
-
-instance P.Render CommitHash where
- render = P.render . P.Detailed
-
-instance P.Render (P.Detailed CommitHash) where
- render (P.Detailed commitHash) =
- P.styled [P.color P.Yellow] $
- P.render (fromMaybe "<dirty>" (toText commitHash))
-
-instance P.Render (P.Summarized CommitHash) where
- render (P.Summarized commitHash) =
- P.styled [P.color P.Yellow] $
- P.render (fromMaybe "<dirty>" (toShortText commitHash))