diff options
author | Alexander Foremny <aforemny@posteo.de> | 2023-10-17 14:14:48 +0200 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2023-11-07 09:50:51 +0100 |
commit | ea1236f2cf6d3ef4b739b2ca28f47a3bbed42295 (patch) | |
tree | 3b1801ad9654e657ed0c0b202e316dc42244c56d /app/History/CommitHash.hs | |
parent | 4521eb7a4b0d4a4ff8cf9153484d0596c5143170 (diff) |
refactor history
Diffstat (limited to 'app/History/CommitHash.hs')
-rw-r--r-- | app/History/CommitHash.hs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/app/History/CommitHash.hs b/app/History/CommitHash.hs new file mode 100644 index 0000000..3fcbb90 --- /dev/null +++ b/app/History/CommitHash.hs @@ -0,0 +1,23 @@ +module History.CommitHash + ( CommitHash (..), + toShortText, + toText, + ) +where + +import Data.Binary (Binary) +import Data.Text qualified as T +import GHC.Generics (Generic) + +data CommitHash + = WorkingTree + | Commit T.Text + deriving (Show, Binary, Generic) + +toShortText :: CommitHash -> T.Text +toShortText WorkingTree = "<dirty>" +toShortText (Commit hash) = T.take 7 hash + +toText :: CommitHash -> T.Text +toText WorkingTree = "<dirty>" +toText (Commit hash) = hash |