headroom-0.4.0.0: License Header Manager
Copyright(c) 2019-2021 Vaclav Svejcar
LicenseBSD-3-Clause
Maintainervaclav.svejcar@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Headroom.Meta.Version

Description

This module contains data types and functions for working with Haskell PVP versions (https://pvp.haskell.org/faq/) in type safe way.

Synopsis

Documentation

data Version Source #

Type safe representation of PVP version.

Constructors

Version 

Fields

Instances

Instances details
Eq Version Source # 
Instance details

Defined in Headroom.Meta.Version

Methods

(==) :: Version -> Version -> Bool #

(/=) :: Version -> Version -> Bool #

Ord Version Source # 
Instance details

Defined in Headroom.Meta.Version

Show Version Source # 
Instance details

Defined in Headroom.Meta.Version

FromJSON Version Source # 
Instance details

Defined in Headroom.Meta.Version

parseVersion Source #

Arguments

:: Text

input text to parse version from

-> Maybe Version

parsed Version

Parses Version from given text.

>>> parseVersion "0.3.2.0"
Just (Version {vMajor1 = 0, vMajor2 = 3, vMinor = 2, vPatch = 0})

printVersion Source #

Arguments

:: Version

Version to print

-> Text

textual representation

Prints Version in major1.major2.minor.patch format.

>>> printVersion (Version 0 3 2 0)
"0.3.2.0"

printVersionP :: Version -> Text Source #

Similar to printVersion, but adds the v prefix in front of the version number.

>>> printVersionP (Version 0 3 2 0)
"v0.3.2.0"

pvp :: QuasiQuoter Source #

QuasiQuoter for defining Version values checked at compile time.

>>> [pvp|1.2.3.4|]
Version {vMajor1 = 1, vMajor2 = 2, vMinor = 3, vPatch = 4}