module Multilinear.Index.Infinite (
Index(..)
) where
import Control.DeepSeq
import GHC.Generics
import qualified Multilinear.Index as TIndex
data Index =
Covariant {
indexName' :: String
} |
Contravariant {
indexName' :: String
} |
Indifferent {
indexName' :: String
}
deriving (Eq, Generic)
instance Show Index where
show (Covariant n) = "[" ++ n ++ "]"
show (Contravariant n) = "<" ++ n ++ ">"
show (Indifferent n) = "(" ++ n ++ ")"
instance TIndex.Index Index where
indexName = indexName'
isCovariant (Covariant _) = True
isCovariant _ = False
isContravariant (Contravariant _) = True
isContravariant _ = False
isIndifferent (Indifferent _) = True
isIndifferent _ = False
equivI (Covariant _) (Covariant _) = True
equivI (Contravariant _) (Contravariant _) = True
equivI (Indifferent _) (Indifferent _) = True
equivI _ _ = False
toTIndex (Covariant name) = TIndex.Covariant Nothing name
toTIndex (Contravariant name) = TIndex.Contravariant Nothing name
toTIndex (Indifferent name) = TIndex.Indifferent Nothing name
instance NFData Index