From f9e8024c2554adae948234ed0ce9db0401b5476a 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 81bb8c4e274..3c62c6a869c 100644 --- a/Cabal/Distribution/Types/PkgconfigVersion.hs +++ b/Cabal/Distribution/Types/PkgconfigVersion.hs @@ -39,6 +39,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 == '-'