@@ -2606,11 +2606,13 @@ removeRedundantConstraintsTests = let
2606
2606
, " foo x = x == 1"
2607
2607
]
2608
2608
2609
- typeSignatureSpaces :: T. Text
2610
- typeSignatureSpaces = T. unlines $ header <>
2611
- [ " foo :: (Num a, Eq a, Monoid a) => a -> Bool"
2612
- , " foo x = x == 1"
2613
- ]
2609
+ typeSignatureSpaces :: Maybe T. Text -> T. Text
2610
+ typeSignatureSpaces mConstraint =
2611
+ let constraint = maybe " (Num a, Eq a)" (\ c -> " (Num a, Eq a, " <> c <> " )" ) mConstraint
2612
+ in T. unlines $ header <>
2613
+ [ " foo :: " <> constraint <> " => a -> Bool"
2614
+ , " foo x = x == 1"
2615
+ ]
2614
2616
2615
2617
redundantConstraintsForall :: Maybe T. Text -> T. Text
2616
2618
redundantConstraintsForall mConstraint =
@@ -2714,9 +2716,10 @@ removeRedundantConstraintsTests = let
2714
2716
" Remove redundant constraint `Eq a` from the context of the type signature for `foo`"
2715
2717
(redundantConstraintsForall $ Just " Eq a" )
2716
2718
(redundantConstraintsForall Nothing )
2717
- , checkPeculiarFormatting
2718
- " should do nothing when constraints contain an arbitrary number of spaces"
2719
- typeSignatureSpaces
2719
+ , check
2720
+ " Remove redundant constraints `(Monoid a, Show a)` from the context of the type signature for `foo`"
2721
+ (typeSignatureSpaces $ Just " Monoid a, Show a" )
2722
+ (typeSignatureSpaces Nothing )
2720
2723
, checkPeculiarFormatting
2721
2724
" should do nothing when constraints contain line feeds"
2722
2725
typeSignatureMultipleLines
0 commit comments