Skip to content

Commit 44c2cca

Browse files
committed
Fix and simplify CPP for DecidablyEmpty instances
1 parent ef51a75 commit 44c2cca

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/Data/Monoid/DecidablyEmpty.hs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ instance DecidablyEmpty [a] where
4848
isEmpty = null
4949
instance Semigroup a => DecidablyEmpty (Maybe a) where
5050
isEmpty = isNothing
51-
#if MIN_VERSION_base(4,11,0)
52-
deriving instance DecidablyEmpty a => DecidablyEmpty (Down a)
53-
#endif
5451
deriving instance (Num a, DecidablyEmpty a) => DecidablyEmpty (Product a)
5552
deriving instance (DecidablyEmpty a, Num a) => DecidablyEmpty (Sum a)
5653
deriving instance DecidablyEmpty a => DecidablyEmpty (Dual a)
@@ -61,17 +58,19 @@ deriving instance Semigroup a => DecidablyEmpty (Option a)
6158
deriving instance DecidablyEmpty m => DecidablyEmpty (WrappedMonoid m)
6259
instance (Ord a, Bounded a) => DecidablyEmpty (Max a)
6360
instance (Ord a, Bounded a) => DecidablyEmpty (Min a)
64-
instance DecidablyEmpty (U1 p)
6561
instance DecidablyEmpty (Proxy s)
62+
deriving instance DecidablyEmpty a => DecidablyEmpty (Const a b)
63+
#if MIN_VERSION_base(4,11,0)
64+
deriving instance DecidablyEmpty a => DecidablyEmpty (Down a)
65+
#endif
6666
#if MIN_VERSION_base(4,12,0)
67+
deriving instance DecidablyEmpty p => DecidablyEmpty (Par1 p)
68+
instance DecidablyEmpty (U1 p)
6769
deriving instance DecidablyEmpty (f p) => DecidablyEmpty (Rec1 f p)
68-
#endif
69-
deriving instance DecidablyEmpty a => DecidablyEmpty (Const a b)
70+
deriving instance DecidablyEmpty (f p) => DecidablyEmpty (M1 i c f p)
7071
deriving instance DecidablyEmpty c => DecidablyEmpty (K1 i c p)
7172
instance (DecidablyEmpty (f p), DecidablyEmpty (g p)) => DecidablyEmpty ((f :*: g) p) where
7273
isEmpty (x :*: y) = isEmpty x && isEmpty y
73-
#if MIN_VERSION_base(4,12,0)
74-
deriving instance DecidablyEmpty (f p) => DecidablyEmpty (M1 i c f p)
7574
deriving instance DecidablyEmpty (f (g p)) => DecidablyEmpty ((f :.: g) p)
7675
#endif
7776

0 commit comments

Comments
 (0)