Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove CabalParsing class, specialize to ParsecParser #10081

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cabal-described/src/Distribution/Described.hs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import Test.Tasty (TestTree, testGroup)
import Test.Tasty.QuickCheck (testProperty)

import Distribution.Compat.Semigroup (Semigroup (..))
import Distribution.Parsec (Parsec, eitherParsec)
import Distribution.Parsec (CabalParsec, eitherParsec)
import Distribution.Pretty (Pretty, prettyShow)

import qualified Distribution.Utils.CharSet as CS
Expand Down Expand Up @@ -105,7 +105,7 @@ import Distribution.Version (Version, VersionRange)
import Language.Haskell.Extension (Extension, Language, knownLanguages)

-- | Class describing the pretty/parsec format of a.
class (Pretty a, Parsec a) => Described a where
class (Pretty a, CabalParsec a) => Described a where
-- | A pretty document of "regex" describing the field format
describe :: proxy a -> GrammarRegex void

Expand Down
2 changes: 0 additions & 2 deletions Cabal-syntax/Cabal-syntax.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,13 @@ library
Distribution.Backpack
Distribution.CabalSpecVersion
Distribution.Compat.Binary
Distribution.Compat.CharParsing
Distribution.Compat.DList
Distribution.Compat.Exception
Distribution.Compat.Graph
Distribution.Compat.Lens
Distribution.Compat.MonadFail
Distribution.Compat.Newtype
Distribution.Compat.NonEmptySet
Distribution.Compat.Parsing
Distribution.Compat.Prelude
Distribution.Compat.Semigroup
Distribution.Compat.Typeable
Expand Down
10 changes: 5 additions & 5 deletions Cabal-syntax/src/Distribution/Backpack.hs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import Distribution.Pretty
import Text.PrettyPrint (hcat)
import Prelude ()

import qualified Distribution.Compat.CharParsing as P
import qualified Distribution.Parsec as P
import qualified Text.PrettyPrint as Disp

import Distribution.ModuleName
Expand Down Expand Up @@ -116,7 +116,7 @@ instance Pretty OpenUnitId where
--
-- >>> eitherParsec "foo[Str=text-1.2.3:Data.Text.Text]" :: Either String OpenUnitId
-- Right (IndefFullUnitId (ComponentId "foo") (fromList [(ModuleName "Str",OpenModule (DefiniteUnitId (DefUnitId {unDefUnitId = UnitId "text-1.2.3"})) (ModuleName "Data.Text.Text"))]))
instance Parsec OpenUnitId where
instance CabalParsec OpenUnitId where
parsec = P.try parseOpenUnitId <|> fmap DefiniteUnitId parsec
where
parseOpenUnitId = do
Expand Down Expand Up @@ -184,7 +184,7 @@ instance Pretty OpenModule where
--
-- >>> eitherParsec "Includes2-0.1.0.0-inplace-mysql:Database.MySQL" :: Either String OpenModule
-- Right (OpenModule (DefiniteUnitId (DefUnitId {unDefUnitId = UnitId "Includes2-0.1.0.0-inplace-mysql"})) (ModuleName "Database.MySQL"))
instance Parsec OpenModule where
instance CabalParsec OpenModule where
parsec = parsecModuleVar <|> parsecOpenModule
where
parsecOpenModule = do
Expand Down Expand Up @@ -228,7 +228,7 @@ dispOpenModuleSubstEntry (k, v) = pretty k <<>> Disp.char '=' <<>> pretty v
-- | Inverse to 'dispModSubst'.
--
-- @since 2.2
parsecOpenModuleSubst :: CabalParsing m => m OpenModuleSubst
parsecOpenModuleSubst :: ParsecParser OpenModuleSubst
parsecOpenModuleSubst =
fmap Map.fromList
. flip P.sepBy (P.char ',')
Expand All @@ -237,7 +237,7 @@ parsecOpenModuleSubst =
-- | Inverse to 'dispModSubstEntry'.
--
-- @since 2.2
parsecOpenModuleSubstEntry :: CabalParsing m => m (ModuleName, OpenModule)
parsecOpenModuleSubstEntry :: ParsecParser (ModuleName, OpenModule)
parsecOpenModuleSubstEntry =
do
k <- parsec
Expand Down
Loading
Loading