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 = "" toShortText (Commit hash) = T.take 7 hash toText :: CommitHash -> T.Text toText WorkingTree = "" toText (Commit hash) = hash