{-# LANGUAGE CPP, GeneralizedNewtypeDeriving #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module BishBosh.Type.Length(
X,
Y,
Row,
Column
) where
#if defined(USE_NARROW_NUMBERS) || defined(USE_NEWTYPE_WRAPPERS)
# ifdef USE_NARROW_NUMBERS
import qualified Data.Int
# endif
# ifdef USE_NEWTYPE_WRAPPERS
import qualified Control.Arrow
import qualified Control.DeepSeq
import qualified Data.Array.IArray
# endif
import qualified Text.XML.HXT.Arrow.Pickle as HXT
#endif
type Base =
#ifdef USE_NARROW_NUMBERS
Data.Int.Int8
instance HXT.XmlPickler Data.Int.Int8 where
xpickle = HXT.xpPrim
#else
Int
#endif
#ifdef USE_NEWTYPE_WRAPPERS
newtype X = MkX Base deriving (Control.DeepSeq.NFData, Data.Array.IArray.Ix, Enum, Eq, Integral, Num, Ord, Real)
instance Read X where
readsPrec precision = map (Control.Arrow.first MkX) . readsPrec precision
instance Show X where
showsPrec precision (MkX x) = showsPrec precision x
#else
type X = Base
#endif
#ifdef USE_NEWTYPE_WRAPPERS
newtype Y = MkY Base deriving (Control.DeepSeq.NFData, Enum, Eq, Integral, Num, Ord, Real)
instance Read Y where
readsPrec precision = map (Control.Arrow.first MkY) . readsPrec precision
instance Show Y where
showsPrec precision (MkY y) = showsPrec precision y
#else
type Y = Base
#endif
#ifdef USE_NEWTYPE_WRAPPERS
newtype Row = MkRow Base deriving (Control.DeepSeq.NFData, Enum, Eq, HXT.XmlPickler, Integral, Num, Ord, Real)
instance Show Row where
showsPrec precision (MkRow row) = showsPrec precision row
#else
type Row = Base
#endif
#ifdef USE_NEWTYPE_WRAPPERS
newtype Column = MkColumn Base deriving (Control.DeepSeq.NFData, Enum, Eq, HXT.XmlPickler, Integral, Num, Ord, Real)
instance Show Column where
showsPrec precision (MkColumn column) = showsPrec precision column
#else
type Column = Base
#endif