Manually reformat chains of single constraints

Changing `(A x) => (B y) => x -> y` to `(A x, B y) => x -> y`.
This commit is contained in:
Greg Pfeil 2024-07-18 18:26:01 -06:00
parent b8f1ed988a
commit f7633ce7c7
No known key found for this signature in database
GPG Key ID: 1193ACD196ED61F2
2 changed files with 6 additions and 17 deletions

View File

@ -167,8 +167,7 @@ reduce cs0 = dbg "reduce" cs0 (go False [])
-- contradictory constraint.
addConstraint ::
forall v loc.
(Ord loc) =>
(Var v) =>
(Ord loc, Var v) =>
GeneratedConstraint v loc ->
Solve v loc (Either (KindError v loc) ())
addConstraint constraint = do
@ -200,8 +199,7 @@ addConstraint constraint = do
-- satisfied.
addConstraint' ::
forall v loc.
(Ord loc) =>
(Var v) =>
(Ord loc, Var v) =>
UnsolvedConstraint v loc ->
Solve v loc (Either (ConstraintConflict v loc) [UnsolvedConstraint v loc])
addConstraint' = \case
@ -444,7 +442,7 @@ data CycleCheck
-- Debug output helpers
--------------------------------------------------------------------------------
prettyConstraintD' :: (Show loc) => (Var v) => PrettyPrintEnv -> UnsolvedConstraint v loc -> P.Pretty P.ColorText
prettyConstraintD' :: (Show loc, Var v) => PrettyPrintEnv -> UnsolvedConstraint v loc -> P.Pretty P.ColorText
prettyConstraintD' ppe =
P.wrap . \case
Unsolved.IsType v p -> prettyUVar ppe v <> " ~ Type" <> prettyProv p
@ -455,7 +453,7 @@ prettyConstraintD' ppe =
prettyProv x =
"[" <> P.string (show x) <> "]"
prettyConstraints :: (Show loc) => (Var v) => PrettyPrintEnv -> [UnsolvedConstraint v loc] -> P.Pretty P.ColorText
prettyConstraints :: (Show loc, Var v) => PrettyPrintEnv -> [UnsolvedConstraint v loc] -> P.Pretty P.ColorText
prettyConstraints ppe = P.sep "\n" . map (prettyConstraintD' ppe)
prettyUVar :: (Var v) => PrettyPrintEnv -> UVar v loc -> P.Pretty P.ColorText

View File

@ -117,11 +117,7 @@ getLength = unVarInt <$> deserialize
-- Checks for negatives, in case you put an Integer, which does not
-- behave properly for negative numbers.
putPositive ::
(MonadPut m) =>
(Bits n) =>
(Bits (Unsigned n)) =>
(Integral n) =>
(Integral (Unsigned n)) =>
(MonadPut m, Bits n, Bits (Unsigned n), Integral n, Integral (Unsigned n)) =>
n ->
m ()
putPositive n
@ -130,12 +126,7 @@ putPositive n
-- Reads as an Integer, then checks that the result will fit in the
-- result type.
getPositive ::
forall m n.
(Bounded n) =>
(Integral n) =>
(MonadGet m) =>
m n
getPositive :: forall m n. (Bounded n, Integral n, MonadGet m) => m n
getPositive = validate . unVarInt =<< deserialize
where
mx0 :: n