From 6ac1574ad186921e3f26681bc61228ff37443463 Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Fri, 14 Feb 2020 12:15:56 +0200 Subject: [PATCH] Add doctests for Parsec PkgconfigVersion Related to https://github.com/haskell/cabal/issues/6539 --- Cabal/Distribution/Types/PkgconfigVersion.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Cabal/Distribution/Types/PkgconfigVersion.hs b/Cabal/Distribution/Types/PkgconfigVersion.hs index ec5145becfb..e79fefb9e5f 100644 --- a/Cabal/Distribution/Types/PkgconfigVersion.hs +++ b/Cabal/Distribution/Types/PkgconfigVersion.hs @@ -40,6 +40,14 @@ instance NFData PkgconfigVersion where rnf = genericRnf instance Pretty PkgconfigVersion where pretty (PkgconfigVersion bs) = PP.text (BS8.unpack bs) +-- | +-- +-- >>> simpleParsec "1.0.2n" :: Maybe PkgconfigVersion +-- Just (PkgconfigVersion "1.0.2n") +-- +-- >>> simpleParsec "0.3.5+ds" :: Maybe PkgconfigVersion +-- Nothing +-- instance Parsec PkgconfigVersion where parsec = PkgconfigVersion . BS8.pack <$> P.munch1 predicate where predicate c = isAsciiAlphaNum c || c == '.' || c == '-'