]> gitweb.michael.orlitzky.com - spline3.git/blob - src/Cardinal.hs
Begin overhauling the program to handle other tetrahedra. Main is
[spline3.git] / src / Cardinal.hs
1 module Cardinal
2 where
3
4 data Cardinal = F
5 | B
6 | L
7 | R
8 | D
9 | T
10 | FL
11 | FR
12 | FD
13 | FT
14 | BL
15 | BR
16 | BD
17 | BT
18 | LD
19 | LT
20 | RD
21 | RT
22 | FLD
23 | FLT
24 | FRD
25 | FRT
26 | BLD
27 | BLT
28 | BRD
29 | BRT
30 | I
31 | Scalar Double
32 | Sum Cardinal Cardinal
33 | Difference Cardinal Cardinal
34 | Product Cardinal Cardinal
35 | Quotient Cardinal Cardinal
36 deriving (Show, Eq)
37
38 instance Num Cardinal where
39 x + y = Sum x y
40 x - y = Difference x y
41 x * y = Product x y
42 negate x = Product (Scalar (-1)) x
43 abs x = x
44 signum x = x
45 fromInteger x = Scalar (fromIntegral x)
46
47 instance Fractional Cardinal where
48 x / y = Quotient x y
49 recip x = Quotient (Scalar 1) x
50 fromRational x = Scalar (fromRational x)