module TextShow.Data.Version (showbVersion) where
import Data.List (intersperse)
import Data.Monoid.Compat ((<>))
import Data.Text.Lazy.Builder (Builder, fromString, singleton)
import Data.Version (Version(..))
import Prelude ()
import Prelude.Compat
import TextShow.Classes (TextShow(..))
import TextShow.Data.Char ()
import TextShow.Data.Integral ()
import TextShow.Data.List ()
import TextShow.TH.Internal (deriveTextShow)
showbVersion :: Version -> Builder
showbVersion (Version branch tags)
= mconcat (intersperse (singleton '.') $ map showb branch) <>
mconcat (map ((singleton '-' <>) . fromString) tags)
$(deriveTextShow ''Version)