From ea07dc8a881d927ed7ccb202bcc2a421a68322ce Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Wed, 6 May 2026 10:54:37 -0400 Subject: [PATCH 1/5] Doctest :t expected type String vs [Char] --- .../src/Distribution/FieldGrammar/Newtypes.hs | 28 ++++++++++++++++--- .../src/Distribution/Client/Utils/Parsec.hs | 20 +++++++++++-- 2 files changed, 41 insertions(+), 7 deletions(-) diff --git a/Cabal-syntax/src/Distribution/FieldGrammar/Newtypes.hs b/Cabal-syntax/src/Distribution/FieldGrammar/Newtypes.hs index 8123285e2b9..251d9971e6f 100644 --- a/Cabal-syntax/src/Distribution/FieldGrammar/Newtypes.hs +++ b/Cabal-syntax/src/Distribution/FieldGrammar/Newtypes.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} @@ -136,14 +137,15 @@ instance Sep NoCommaFSep where -- type @a@ are parsed and pretty-printed as @b@. newtype List sep b a = List {_getList :: [a]} +{- FOURMOLU_DISABLE -} -- | 'alaList' and 'alaList'' are simply 'List', with additional phantom -- arguments to constrain the resulting type -- -- >>> :t alaList VCat -- alaList VCat :: [a] -> List VCat (Identity a) a -- --- >>> :t alaList' FSep Token --- alaList' FSep Token :: [String] -> List FSep Token String +-- $alaListFSepTokenDoctest +{- FOURMOLU_ENABLE -} alaList :: sep -> [a] -> List sep (Identity a) a alaList _ = List @@ -166,19 +168,20 @@ instance (Newtype a b, Sep sep, Pretty b) => Pretty (List sep b a) where -- @since 3.2.0.0 newtype Set' sep b a = Set' {_getSet :: Set a} +{- FOURMOLU_DISABLE -} -- | 'alaSet' and 'alaSet'' are simply 'Set'' constructor, with additional phantom -- arguments to constrain the resulting type -- -- >>> :t alaSet VCat -- alaSet VCat :: Set a -> Set' VCat (Identity a) a -- --- >>> :t alaSet' FSep Token --- alaSet' FSep Token :: Set String -> Set' FSep Token String +-- $alaSetFSepTokenDoctest -- -- >>> unpack' (alaSet' FSep Token) <$> eitherParsec "foo bar foo" -- Right (fromList ["bar","foo"]) -- -- @since 3.2.0.0 +{- FOURMOLU_ENABLE -} alaSet :: sep -> Set a -> Set' sep (Identity a) a alaSet _ = Set' @@ -454,3 +457,20 @@ parsecTestedWith = do name <- lexemeParsec ver <- parsec <|> pure anyVersion return (name, ver) + +-- TODO: Find out why GHCi stops using the String type alias. +#if MIN_VERSION_base(4,22,0) +-- $alaListFSepTokenDoctest +-- >>> :t alaList' FSep Token +-- alaList' FSep Token :: [[Char]] -> List FSep Token [Char] +-- $alaSetFSepTokenDoctest +-- >>> :t alaSet' FSep Token +-- alaSet' FSep Token :: Set [Char] -> Set' FSep Token [Char] +#else +-- $alaListFSepTokenDoctest +-- >>> :t alaList' FSep Token +-- alaList' FSep Token :: [String] -> List FSep Token String +-- $alaSetFSepTokenDoctest +-- >>> :t alaSet' FSep Token +-- alaSet' FSep Token :: Set String -> Set' FSep Token String +#endif diff --git a/cabal-install/src/Distribution/Client/Utils/Parsec.hs b/cabal-install/src/Distribution/Client/Utils/Parsec.hs index 1c36017c4f9..c3dc5bb758d 100644 --- a/cabal-install/src/Distribution/Client/Utils/Parsec.hs +++ b/cabal-install/src/Distribution/Client/Utils/Parsec.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-} @@ -52,18 +53,18 @@ instance (Newtype a b, Pretty b) => Pretty (Flag' b a) where -- | Like 'List' for usage with a 'FieldGrammar', but for 'NubList'. newtype NubList' sep b a = NubList' {_getNubList :: NubList a} +{- FOURMOLU_DISABLE -} -- | 'alaNubList' and 'alaNubList'' are simply 'NubList'' constructor, with additional phantom -- arguments to constrain the resulting type -- -- >>> :t alaNubList VCat -- alaNubList VCat :: NubList a -> NubList' VCat (Identity a) a -- --- >>> :t alaNubList' FSep Token --- alaNubList' FSep Token --- :: NubList String -> NubList' FSep Token String +-- $alaNubListFSepTokenDoctest -- -- >>> unpack' (alaNubList' FSep Token) <$> eitherParsec "foo bar foo" -- Right ["foo","bar"] +{- FOURMOLU_ENABLE -} alaNubList :: sep -> NubList a -> NubList' sep (Identity a) a alaNubList _ = NubList' @@ -87,3 +88,16 @@ remoteRepoGrammar name = <*> monoidalFieldAla "root-keys" (alaList' FSep Token) remoteRepoRootKeysLens <*> optionalFieldDefAla "key-threshold" KeyThreshold remoteRepoKeyThresholdLens 0 <*> pure False -- we don't parse remoteRepoShouldTryHttps + +-- TODO: Find out why GHCi stops using the String type alias. +#if MIN_VERSION_base(4,22,0) +-- $alaNubListFSepTokenDoctest +-- >>> :t alaNubList' FSep Token +-- alaNubList' FSep Token +-- :: NubList [Char] -> NubList' FSep Token [Char] +#else +-- $alaNubListFSepTokenDoctest +-- >>> :t alaNubList' FSep Token +-- alaNubList' FSep Token +-- :: NubList String -> NubList' FSep Token String +#endif From 51f76d5e5844a9f3c409c7306eea56b19165b854 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Wed, 6 May 2026 11:40:30 -0400 Subject: [PATCH 2/5] Redo haddock sections to play nicely with doctests --- .../src/Distribution/FieldGrammar/Newtypes.hs | 97 ++++++++++--------- .../src/Distribution/Client/Utils/Parsec.hs | 45 +++++---- 2 files changed, 74 insertions(+), 68 deletions(-) diff --git a/Cabal-syntax/src/Distribution/FieldGrammar/Newtypes.hs b/Cabal-syntax/src/Distribution/FieldGrammar/Newtypes.hs index 251d9971e6f..baa17dd8717 100644 --- a/Cabal-syntax/src/Distribution/FieldGrammar/Newtypes.hs +++ b/Cabal-syntax/src/Distribution/FieldGrammar/Newtypes.hs @@ -10,11 +10,30 @@ -- | This module provides @newtype@ wrappers to be used with "Distribution.FieldGrammar". module Distribution.FieldGrammar.Newtypes - ( -- * List - alaList + ( -- * Types + List + , Set' + , NonEmpty' + + -- * List + -- $alaList + -- $alaListFSepTokenDoctest + -- $alaListFSepTokenDoctestBroken + , alaList , alaList' - -- ** Modifiers + -- * Set + -- $alaSet + -- $alaSetFSepTokenDoctest + -- $alaSetFSepTokenDoctestBroken + , alaSet + , alaSet' + + -- * NonEmpty + , alaNonEmpty + , alaNonEmpty' + + -- * Modifiers , CommaVCat (..) , CommaFSep (..) , VCat (..) @@ -22,19 +41,6 @@ module Distribution.FieldGrammar.Newtypes , NoCommaFSep (..) , Sep (..) - -- ** Type - , List - - -- ** Set - , alaSet - , alaSet' - , Set' - - -- ** NonEmpty - , alaNonEmpty - , alaNonEmpty' - , NonEmpty' - -- * Version & License , SpecVersion (..) , TestedWith (..) @@ -137,15 +143,6 @@ instance Sep NoCommaFSep where -- type @a@ are parsed and pretty-printed as @b@. newtype List sep b a = List {_getList :: [a]} -{- FOURMOLU_DISABLE -} --- | 'alaList' and 'alaList'' are simply 'List', with additional phantom --- arguments to constrain the resulting type --- --- >>> :t alaList VCat --- alaList VCat :: [a] -> List VCat (Identity a) a --- --- $alaListFSepTokenDoctest -{- FOURMOLU_ENABLE -} alaList :: sep -> [a] -> List sep (Identity a) a alaList _ = List @@ -161,27 +158,12 @@ instance (Newtype a b, Sep sep, Parsec b) => Parsec (List sep b a) where instance (Newtype a b, Sep sep, Pretty b) => Pretty (List sep b a) where pretty = prettySep (Proxy :: Proxy sep) . map (pretty . (pack :: a -> b)) . unpack --- - -- | Like 'List', but for 'Set'. -- -- @since 3.2.0.0 newtype Set' sep b a = Set' {_getSet :: Set a} -{- FOURMOLU_DISABLE -} --- | 'alaSet' and 'alaSet'' are simply 'Set'' constructor, with additional phantom --- arguments to constrain the resulting type --- --- >>> :t alaSet VCat --- alaSet VCat :: Set a -> Set' VCat (Identity a) a --- --- $alaSetFSepTokenDoctest --- --- >>> unpack' (alaSet' FSep Token) <$> eitherParsec "foo bar foo" --- Right (fromList ["bar","foo"]) --- --- @since 3.2.0.0 -{- FOURMOLU_ENABLE -} +-- | @since 3.2.0.0 alaSet :: sep -> Set a -> Set' sep (Identity a) a alaSet _ = Set' @@ -199,8 +181,6 @@ instance (Newtype a b, Ord a, Sep sep, Parsec b) => Parsec (Set' sep b a) where instance (Newtype a b, Sep sep, Pretty b) => Pretty (Set' sep b a) where pretty = prettySep (Proxy :: Proxy sep) . map (pretty . (pack :: a -> b)) . Set.toList . unpack --- - -- | Like 'List', but for 'NonEmpty'. -- -- @since 3.2.0.0 @@ -458,19 +438,42 @@ parsecTestedWith = do ver <- parsec <|> pure anyVersion return (name, ver) +-- $alaSet +-- 'alaSet' and 'alaSet'' are simply 'Set'' constructor, with additional phantom +-- arguments to constrain the resulting type + +-- $alaSetFSepTokenDoctest +-- >>> :t alaSet VCat +-- alaSet VCat :: Set a -> Set' VCat (Identity a) a +-- +-- >>> unpack' (alaSet' FSep Token) <$> eitherParsec "foo bar foo" +-- Right (fromList ["bar","foo"]) + +-- $alaList +-- 'alaList' and 'alaList'' are simply 'List', with additional phantom arguments +-- to constrain the resulting type + +-- $alaListFSepTokenDoctest +-- >>> :t alaList VCat +-- alaList VCat :: [a] -> List VCat (Identity a) a +-- +-- $alaListFSepTokenDoctest + -- TODO: Find out why GHCi stops using the String type alias. #if MIN_VERSION_base(4,22,0) --- $alaListFSepTokenDoctest +-- $alaListFSepTokenDoctestBroken -- >>> :t alaList' FSep Token -- alaList' FSep Token :: [[Char]] -> List FSep Token [Char] --- $alaSetFSepTokenDoctest + +-- $alaSetFSepTokenDoctestBroken -- >>> :t alaSet' FSep Token -- alaSet' FSep Token :: Set [Char] -> Set' FSep Token [Char] #else --- $alaListFSepTokenDoctest +-- $alaListFSepTokenDoctestBroken -- >>> :t alaList' FSep Token -- alaList' FSep Token :: [String] -> List FSep Token String --- $alaSetFSepTokenDoctest + +-- $alaSetFSepTokenDoctestBroken -- >>> :t alaSet' FSep Token -- alaSet' FSep Token :: Set String -> Set' FSep Token String #endif diff --git a/cabal-install/src/Distribution/Client/Utils/Parsec.hs b/cabal-install/src/Distribution/Client/Utils/Parsec.hs index c3dc5bb758d..520836dc9f0 100644 --- a/cabal-install/src/Distribution/Client/Utils/Parsec.hs +++ b/cabal-install/src/Distribution/Client/Utils/Parsec.hs @@ -5,18 +5,22 @@ {-# LANGUAGE ScopedTypeVariables #-} module Distribution.Client.Utils.Parsec - ( remoteRepoGrammar + ( -- * NubList + NubList' + -- $alaNubList + -- $alaNubListFSepTokenDoctest + -- $alaNubListFSepTokenDoctestBroken + , alaNubList + , alaNubList' - -- ** Flag + -- * Flag , alaFlag , Flag' - -- ** NubList - , alaNubList - , alaNubList' - , NubList' + -- * Remote Repo + , remoteRepoGrammar - -- ** Newtype wrappers + -- * Newtype wrappers , module Distribution.Client.Utils.Newtypes ) where @@ -53,18 +57,6 @@ instance (Newtype a b, Pretty b) => Pretty (Flag' b a) where -- | Like 'List' for usage with a 'FieldGrammar', but for 'NubList'. newtype NubList' sep b a = NubList' {_getNubList :: NubList a} -{- FOURMOLU_DISABLE -} --- | 'alaNubList' and 'alaNubList'' are simply 'NubList'' constructor, with additional phantom --- arguments to constrain the resulting type --- --- >>> :t alaNubList VCat --- alaNubList VCat :: NubList a -> NubList' VCat (Identity a) a --- --- $alaNubListFSepTokenDoctest --- --- >>> unpack' (alaNubList' FSep Token) <$> eitherParsec "foo bar foo" --- Right ["foo","bar"] -{- FOURMOLU_ENABLE -} alaNubList :: sep -> NubList a -> NubList' sep (Identity a) a alaNubList _ = NubList' @@ -89,14 +81,25 @@ remoteRepoGrammar name = <*> optionalFieldDefAla "key-threshold" KeyThreshold remoteRepoKeyThresholdLens 0 <*> pure False -- we don't parse remoteRepoShouldTryHttps +-- $alaNubList +-- 'alaNubList' and 'alaNubList'' are simply 'NubList'' constructor, with additional phantom +-- arguments to constrain the resulting type + +-- $alaNubListFSepTokenDoctest +-- >>> :t alaNubList VCat +-- alaNubList VCat :: NubList a -> NubList' VCat (Identity a) a +-- +-- >>> unpack' (alaNubList' FSep Token) <$> eitherParsec "foo bar foo" +-- Right ["foo","bar"] + -- TODO: Find out why GHCi stops using the String type alias. #if MIN_VERSION_base(4,22,0) --- $alaNubListFSepTokenDoctest +-- $alaNubListFSepTokenDoctestBroken -- >>> :t alaNubList' FSep Token -- alaNubList' FSep Token -- :: NubList [Char] -> NubList' FSep Token [Char] #else --- $alaNubListFSepTokenDoctest +-- $alaNubListFSepTokenDoctestBroken -- >>> :t alaNubList' FSep Token -- alaNubList' FSep Token -- :: NubList String -> NubList' FSep Token String From 9e23ee9a4aaf81c7f52d73453641150283174d75 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Wed, 6 May 2026 11:41:16 -0400 Subject: [PATCH 3/5] Satisfy fourmolu --- .../src/Distribution/FieldGrammar/Newtypes.hs | 14 ++++++-------- .../src/Distribution/Client/Utils/Parsec.hs | 6 +++--- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Cabal-syntax/src/Distribution/FieldGrammar/Newtypes.hs b/Cabal-syntax/src/Distribution/FieldGrammar/Newtypes.hs index baa17dd8717..ddef4b72923 100644 --- a/Cabal-syntax/src/Distribution/FieldGrammar/Newtypes.hs +++ b/Cabal-syntax/src/Distribution/FieldGrammar/Newtypes.hs @@ -16,16 +16,16 @@ module Distribution.FieldGrammar.Newtypes , NonEmpty' -- * List - -- $alaList - -- $alaListFSepTokenDoctest - -- $alaListFSepTokenDoctestBroken + -- $alaList + -- $alaListFSepTokenDoctest + -- $alaListFSepTokenDoctestBroken , alaList , alaList' -- * Set - -- $alaSet - -- $alaSetFSepTokenDoctest - -- $alaSetFSepTokenDoctestBroken + -- $alaSet + -- $alaSetFSepTokenDoctest + -- $alaSetFSepTokenDoctestBroken , alaSet , alaSet' @@ -456,8 +456,6 @@ parsecTestedWith = do -- $alaListFSepTokenDoctest -- >>> :t alaList VCat -- alaList VCat :: [a] -> List VCat (Identity a) a --- --- $alaListFSepTokenDoctest -- TODO: Find out why GHCi stops using the String type alias. #if MIN_VERSION_base(4,22,0) diff --git a/cabal-install/src/Distribution/Client/Utils/Parsec.hs b/cabal-install/src/Distribution/Client/Utils/Parsec.hs index 520836dc9f0..35bd15af278 100644 --- a/cabal-install/src/Distribution/Client/Utils/Parsec.hs +++ b/cabal-install/src/Distribution/Client/Utils/Parsec.hs @@ -7,9 +7,9 @@ module Distribution.Client.Utils.Parsec ( -- * NubList NubList' - -- $alaNubList - -- $alaNubListFSepTokenDoctest - -- $alaNubListFSepTokenDoctestBroken + -- $alaNubList + -- $alaNubListFSepTokenDoctest + -- $alaNubListFSepTokenDoctestBroken , alaNubList , alaNubList' From bc24ef9caf006ab9f75898296a193b543fe63d46 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Wed, 6 May 2026 12:30:52 -0400 Subject: [PATCH 4/5] Consistent full stops & SpecVersion rewrite --- .../src/Distribution/FieldGrammar/Newtypes.hs | 42 ++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/Cabal-syntax/src/Distribution/FieldGrammar/Newtypes.hs b/Cabal-syntax/src/Distribution/FieldGrammar/Newtypes.hs index ddef4b72923..05485b29b24 100644 --- a/Cabal-syntax/src/Distribution/FieldGrammar/Newtypes.hs +++ b/Cabal-syntax/src/Distribution/FieldGrammar/Newtypes.hs @@ -85,10 +85,10 @@ import qualified Data.Set as Set import qualified Distribution.Compat.CharParsing as P import qualified Distribution.SPDX as SPDX --- | Vertical list with commas. Displayed with 'vcat' +-- | Vertical list with commas. Displayed with 'vcat'. data CommaVCat = CommaVCat --- | Paragraph fill list with commas. Displayed with 'fsep' +-- | Paragraph fill list with commas. Displayed with 'fsep'. data CommaFSep = CommaFSep -- | Vertical list with optional commas. Displayed with 'vcat'. @@ -186,8 +186,8 @@ instance (Newtype a b, Sep sep, Pretty b) => Pretty (Set' sep b a) where -- @since 3.2.0.0 newtype NonEmpty' sep b a = NonEmpty' {_getNonEmpty :: NonEmpty a} --- | 'alaNonEmpty' and 'alaNonEmpty'' are simply 'NonEmpty'' constructor, with additional phantom --- arguments to constrain the resulting type +-- | 'alaNonEmpty' and 'alaNonEmpty'' are simply 'NonEmpty'' constructor, with +-- additional phantom arguments to constrain the resulting type. -- -- >>> :t alaNonEmpty VCat -- alaNonEmpty VCat :: NonEmpty a -> NonEmpty' VCat (Identity a) a @@ -217,7 +217,7 @@ instance (Newtype a b, Sep sep, Pretty b) => Pretty (NonEmpty' sep b a) where -- Identifiers ------------------------------------------------------------------------------- --- | Haskell string or @[^ ,]+@ +-- | Haskell string or @[^ ,]+@. newtype Token = Token {getToken :: String} instance Newtype String Token @@ -228,7 +228,7 @@ instance Parsec Token where instance Pretty Token where pretty = showToken . unpack --- | Haskell string or @[^ ]+@ +-- | Haskell string or @[^ ]+@. newtype Token' = Token' {getToken' :: String} instance Newtype String Token' @@ -281,9 +281,10 @@ instance Parsec (SymbolicPathNT from to) where instance Pretty (SymbolicPathNT from to) where pretty = showFilePath . getSymbolicPath . getSymbolicPathNT --- | Newtype for 'RelativePath', with a different 'Parsec' instance --- to disallow empty paths but allow non-relative paths (which get rejected --- later with a different error message, see 'Distribution.PackageDescription.Check.Paths.checkPath') +-- | Newtype for 'RelativePath', with a different 'Parsec' instance to disallow +-- empty paths but allow non-relative paths (which get rejected later with a +-- different error message, see +-- 'Distribution.PackageDescription.Check.Paths.checkPath'). newtype RelativePathNT from to = RelativePathNT {getRelativePathNT :: RelativePath from to} instance Newtype (RelativePath from to) (RelativePathNT from to) @@ -304,14 +305,17 @@ instance Pretty (RelativePathNT from to) where -- SpecVersion ------------------------------------------------------------------------------- --- | Version range or just version, i.e. @cabal-version@ field. +-- | An exact version of the Cabal specification as a value of the +-- @cabal-version@ field. Earlier Cabal specifications allowed a version range +-- here. For more details, see the +-- [cabal-version](https://cabal.readthedocs.io/en/latest/cabal-package-description-file.html#pkg-field-cabal-version) +-- section of the Cabal User Guide and +-- [issue #4899](https://github.com/haskell/cabal/issues/4899). -- --- There are few things to consider: +-- For @cabal-version: v@: -- --- * Starting with 2.2 the cabal-version field should be the first field in the --- file and only exact version is accepted. Therefore if we get e.g. --- @>= 2.2@, we fail. --- See +-- * the @cabal-version@ field should be the first field in the file, +-- * only an exact version is accepted for @v@. -- -- We have this newtype, as writing Parsec and Pretty instances -- for CabalSpecVersion would cause cycle in modules: @@ -400,7 +404,7 @@ instance Pretty SpecVersion where -- SpecLicense ------------------------------------------------------------------------------- --- | SPDX License expression or legacy license +-- | SPDX License expression or legacy license. newtype SpecLicense = SpecLicense {getSpecLicense :: Either SPDX.License License} deriving (Show, Eq) @@ -420,7 +424,7 @@ instance Pretty SpecLicense where -- TestedWith ------------------------------------------------------------------------------- --- | Version range or just version +-- | Version range or just version. newtype TestedWith = TestedWith {getTestedWith :: (CompilerFlavor, VersionRange)} instance Newtype (CompilerFlavor, VersionRange) TestedWith @@ -440,7 +444,7 @@ parsecTestedWith = do -- $alaSet -- 'alaSet' and 'alaSet'' are simply 'Set'' constructor, with additional phantom --- arguments to constrain the resulting type +-- arguments to constrain the resulting type. -- $alaSetFSepTokenDoctest -- >>> :t alaSet VCat @@ -451,7 +455,7 @@ parsecTestedWith = do -- $alaList -- 'alaList' and 'alaList'' are simply 'List', with additional phantom arguments --- to constrain the resulting type +-- to constrain the resulting type. -- $alaListFSepTokenDoctest -- >>> :t alaList VCat From 30aec762f0af26da67d9440b901a5d0e4c578550 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Wed, 6 May 2026 12:36:02 -0400 Subject: [PATCH 5/5] Consistent full stops & markup fixes for alaFlag --- .../src/Distribution/Client/Utils/Parsec.hs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Utils/Parsec.hs b/cabal-install/src/Distribution/Client/Utils/Parsec.hs index 35bd15af278..b01934e4cd0 100644 --- a/cabal-install/src/Distribution/Client/Utils/Parsec.hs +++ b/cabal-install/src/Distribution/Client/Utils/Parsec.hs @@ -36,13 +36,14 @@ import Distribution.Simple.Flag import Distribution.Utils.NubList (NubList (..)) import qualified Distribution.Utils.NubList as NubList --- | Like 'List' for usage with a 'FieldGrammar', but for 'Flag'. --- This enables to parse type aliases such as 'FilePath' that do not have 'Parsec' instances +-- | Like 'List' for usage with a 'FieldGrammar', but for a 'Flag'. +-- This enables parsing type aliases such as 'FilePath' that do not have 'Parsec' instances -- by using newtype variants such as 'FilePathNT'. --- For example, if you need to parse a 'Flag FilePath', you can use 'alaFlag' FilePathNT'. +-- For example, if you need to parse a 'Flag' 'FilePath', you can use 'alaFlag' 'FilePathNT'. newtype Flag' b a = Flag' {_getFlag :: Flag a} --- | 'Flag'' constructor, with additional phantom argument to constrain the resulting type +-- | 'Flag'' constructor, with additional phantom argument to constrain the +-- resulting type. alaFlag :: (a -> b) -> Flag a -> Flag' b a alaFlag _ = Flag' @@ -82,8 +83,8 @@ remoteRepoGrammar name = <*> pure False -- we don't parse remoteRepoShouldTryHttps -- $alaNubList --- 'alaNubList' and 'alaNubList'' are simply 'NubList'' constructor, with additional phantom --- arguments to constrain the resulting type +-- 'alaNubList' and 'alaNubList'' are simply 'NubList'' constructor, with +-- additional phantom arguments to constrain the resulting type. -- $alaNubListFSepTokenDoctest -- >>> :t alaNubList VCat