Remove (direct) dependency on containers

This removes the (+megaparsec-compat dependent)
direct dependency on containers.

This doesn't reduce the dependency footprint.
This commit is contained in:
Owen Shepherd 2024-01-06 13:02:28 +01:00
parent d3ffbb7f37
commit 0e9442c7a2
No known key found for this signature in database
GPG Key ID: 426D621DB5732F0A
3 changed files with 6 additions and 11 deletions

View File

@ -82,8 +82,7 @@ library
, bytestring >=0.9 && <1
if flag(megaparsec-compat)
build-depends:
containers ==0.6.*
, megaparsec >=9.0.0
megaparsec >=9.0.0
if flag(parsec-compat)
build-depends:
parsec >=3.1.14
@ -128,8 +127,7 @@ test-suite diagnose-megaparsec-tests
, bytestring >=0.9 && <1
if flag(megaparsec-compat)
build-depends:
containers ==0.6.*
, megaparsec >=9.0.0
megaparsec >=9.0.0
if flag(parsec-compat)
build-depends:
parsec >=3.1.14
@ -169,8 +167,7 @@ test-suite diagnose-parsec-tests
, bytestring >=0.9 && <1
if flag(megaparsec-compat)
build-depends:
containers ==0.6.*
, megaparsec >=9.0.0
megaparsec >=9.0.0
if flag(parsec-compat)
build-depends:
parsec >=3.1.14
@ -208,8 +205,7 @@ test-suite diagnose-rendering-tests
, bytestring >=0.9 && <1
if flag(megaparsec-compat)
build-depends:
containers ==0.6.*
, megaparsec >=9.0.0
megaparsec >=9.0.0
if flag(parsec-compat)
build-depends:
parsec >=3.1.14

View File

@ -66,7 +66,6 @@ when:
- condition: flag(megaparsec-compat)
dependencies:
- megaparsec >= 9.0.0
- containers == 0.6.*
- condition: flag(parsec-compat)
dependencies:
- parsec >= 3.1.14

View File

@ -24,8 +24,8 @@ module Error.Diagnose.Compat.Megaparsec
where
import Data.Bifunctor (second)
import Data.Foldable (toList)
import Data.Maybe (fromMaybe)
import qualified Data.Set as Set (toList)
import Data.String (IsString (..))
import Error.Diagnose
import Error.Diagnose.Compat.Hints (HasHints (..))
@ -71,7 +71,7 @@ diagnosticFromBundle isError code msg (fromMaybe [] -> trivialHints) MP.ParseErr
errorHints :: MP.ParseError s e -> [Note msg]
errorHints MP.TrivialError {} = trivialHints
errorHints (MP.FancyError _ errs) =
Set.toList errs >>= \case
toList errs >>= \case
MP.ErrorCustom e -> hints e
_ -> mempty