| B
| L
| R
- | T
| D
+ | T
+ | FL
+ | FR
+ | FD
+ | FT
+ | BL
+ | BR
+ | BD
+ | BT
+ | LD
+ | LT
+ | RD
+ | RT
+ | FLD
+ | FLT
+ | FRD
+ | FRT
+ | BLD
+ | BLT
+ | BRD
+ | BRT
+ | I
+ | Scalar Double
| Sum Cardinal Cardinal
| Difference Cardinal Cardinal
| Product Cardinal Cardinal
- | ScalarProduct Double Cardinal
+ | Quotient Cardinal Cardinal
deriving (Show, Eq)
instance Num Cardinal where
x + y = Sum x y
x - y = Difference x y
- x * y = Sum x y
- negate x = ScalarProduct (-1) x
+ x * y = Product x y
+ negate x = Product (Scalar (-1)) x
abs x = x
signum x = x
- fromInteger _ = F -- Whatever.
+ fromInteger x = Scalar (fromIntegral x)
+
+instance Fractional Cardinal where
+ x / y = Quotient x y
+ recip x = Quotient (Scalar 1) x
+ fromRational x = Scalar (fromRational x)