version-natural-0.1.0.0: src/Data/Version/Natural.hs
{-# LANGUAGE OverloadedStrings #-}
module Data.Version.Natural
( Version(MkVersion, fromVersion)
, toText
) where
import Data.Kind (Type)
import Data.Text (Text)
import qualified Data.Text as T (intercalate, pack)
import GHC.Generics (Generic)
import Numeric.Natural (Natural)
type Version :: Type
newtype Version = MkVersion { fromVersion :: [Natural] }
deriving stock (Eq, Generic, Ord, Show)
toText :: Version -> Text
toText = T.intercalate "." . map (T.pack . show) . fromVersion