Skip to content

Commit

Permalink
Remove CabalParsing class, specialize to ParsecParser
Browse files Browse the repository at this point in the history
Remove the `CharParsing` and `Parsing` classes, specialize all parsing logic to
`Parsec`. Rename the `Distribution.Parsec.Parsec` class to `CabalParsec` to
avoid ambiguity with `Text.Parsec.Parsec`.
  • Loading branch information
FinleyMcIlwaine committed Jun 16, 2024
1 parent 3169b87 commit 2564616
Show file tree
Hide file tree
Showing 194 changed files with 417,434 additions and 1,155 deletions.
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

0 comments on commit 2564616

Please sign in to comment.