diff options
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) = () | 
