diff options
| author | Tom Smeding <tom@tomsmeding.com> | 2025-05-16 10:42:24 +0200 | 
|---|---|---|
| committer | Tom Smeding <tom@tomsmeding.com> | 2025-05-16 11:21:51 +0200 | 
| commit | 09041ca155485885a2f337f71b04442e991a550d (patch) | |
| tree | 82c05989d2be6d87ca96aa7467f3162bf2d5698b /src/Data/Array/Nested/Mixed | |
| parent | 8890526cac9e6c4d5583d00fce55f32ba613cf31 (diff) | |
default-show-instances flag
Diffstat (limited to 'src/Data/Array/Nested/Mixed')
| -rw-r--r-- | src/Data/Array/Nested/Mixed/Shape.hs | 19 | 
1 files changed, 18 insertions, 1 deletions
| diff --git a/src/Data/Array/Nested/Mixed/Shape.hs b/src/Data/Array/Nested/Mixed/Shape.hs index 5f4775c..d934873 100644 --- a/src/Data/Array/Nested/Mixed/Shape.hs +++ b/src/Data/Array/Nested/Mixed/Shape.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-}  {-# LANGUAGE DataKinds #-}  {-# LANGUAGE DeriveGeneric #-}  {-# LANGUAGE FlexibleInstances #-} @@ -59,8 +60,12 @@ deriving instance (forall n. Eq (f n)) => Eq (ListX sh f)  deriving instance (forall n. Ord (f n)) => Ord (ListX sh f)  infixr 3 ::% +#ifdef OXAR_DEFAULT_SHOW_INSTANCES +deriving instance (forall n. Show (f n)) => Show (ListX sh f) +#else  instance (forall n. Show (f n)) => Show (ListX sh f) where    showsPrec _ = listxShow shows +#endif  instance (forall n. NFData (f n)) => NFData (ListX sh f) where    rnf ZX = () @@ -188,8 +193,12 @@ infixr 3 :.%  type IIxX sh = IxX sh Int +#ifdef OXAR_DEFAULT_SHOW_INSTANCES +deriving instance Show i => Show (IxX sh i) +#else  instance Show i => Show (IxX sh i) where -  showsPrec _ (IxX l) = listxShow (\(Const i) -> shows i) l +  showsPrec _ (IxX l) = listxShow (shows . getConst) l +#endif  instance Functor (IxX sh) where    fmap f (IxX l) = IxX (listxFmap (Const . f . getConst) l) @@ -326,8 +335,12 @@ infixr 3 :$%  type IShX sh = ShX sh Int +#ifdef OXAR_DEFAULT_SHOW_INSTANCES +deriving instance Show i => Show (ShX sh i) +#else  instance Show i => Show (ShX sh i) where    showsPrec _ (ShX l) = listxShow (fromSMayNat shows (shows . fromSNat)) l +#endif  instance Functor (ShX sh) where    fmap f (ShX l) = ShX (listxFmap (fromSMayNat (SUnknown . f) SKnown) l) @@ -483,8 +496,12 @@ infixr 3 :!%  {-# COMPLETE ZKX, (:!%) #-} +#ifdef OXAR_DEFAULT_SHOW_INSTANCES +deriving instance Show (StaticShX sh) +#else  instance Show (StaticShX sh) where    showsPrec _ (StaticShX l) = listxShow (fromSMayNat shows (shows . fromSNat)) l +#endif  instance NFData (StaticShX sh) where    rnf (StaticShX ZX) = () | 
