@@ -2626,11 +2626,13 @@ removeRedundantConstraintsTests = let
2626
2626
, " foo x = x == 1"
2627
2627
]
2628
2628
2629
- typeSignatureSpaces :: T. Text
2630
- typeSignatureSpaces = T. unlines $ header <>
2631
- [ " foo :: (Num a, Eq a, Monoid a) => a -> Bool"
2632
- , " foo x = x == 1"
2633
- ]
2629
+ typeSignatureSpaces :: Maybe T. Text -> T. Text
2630
+ typeSignatureSpaces mConstraint =
2631
+ let constraint = maybe " (Num a, Eq a)" (\ c -> " (Num a, Eq a, " <> c <> " )" ) mConstraint
2632
+ in T. unlines $ header <>
2633
+ [ " foo :: " <> constraint <> " => a -> Bool"
2634
+ , " foo x = x == 1"
2635
+ ]
2634
2636
2635
2637
redundantConstraintsForall :: Maybe T. Text -> T. Text
2636
2638
redundantConstraintsForall mConstraint =
@@ -2734,9 +2736,10 @@ removeRedundantConstraintsTests = let
2734
2736
" Remove redundant constraint `Eq a` from the context of the type signature for `foo`"
2735
2737
(redundantConstraintsForall $ Just " Eq a" )
2736
2738
(redundantConstraintsForall Nothing )
2737
- , checkPeculiarFormatting
2738
- " should do nothing when constraints contain an arbitrary number of spaces"
2739
- typeSignatureSpaces
2739
+ , check
2740
+ " Remove redundant constraints `(Monoid a, Show a)` from the context of the type signature for `foo`"
2741
+ (typeSignatureSpaces $ Just " Monoid a, Show a" )
2742
+ (typeSignatureSpaces Nothing )
2740
2743
, checkPeculiarFormatting
2741
2744
" should do nothing when constraints contain line feeds"
2742
2745
typeSignatureMultipleLines
0 commit comments