diff options
author | Péter Diviánszky <divipp@gmail.com> | 2016-02-04 15:40:02 +0100 |
---|---|---|
committer | Péter Diviánszky <divipp@gmail.com> | 2016-02-04 15:40:02 +0100 |
commit | 91b08d7eb8b3ba2e26862e389e1a58d6c7290a91 (patch) | |
tree | 879dd9551b6c7c60c2095ab650e5cd623f109331 /lc | |
parent | 78e4c9e23e6c53a53490a91cf4bdcf63e5d67cac (diff) |
more complete Component instances
Diffstat (limited to 'lc')
-rw-r--r-- | lc/Builtins.lc | 46 | ||||
-rw-r--r-- | lc/Internals.lc | 1 |
2 files changed, 25 insertions, 22 deletions
diff --git a/lc/Builtins.lc b/lc/Builtins.lc index 1406277d..834b53eb 100644 --- a/lc/Builtins.lc +++ b/lc/Builtins.lc | |||
@@ -8,12 +8,13 @@ import Internals | |||
8 | 8 | ||
9 | id x = x | 9 | id x = x |
10 | 10 | ||
11 | --------------------------------------- | 11 | -- todo: move to Internals |
12 | |||
13 | data List a = Nil | Cons a (List a) | 12 | data List a = Nil | Cons a (List a) |
14 | 13 | ||
15 | infixr 5 : | 14 | infixr 5 : |
16 | 15 | ||
16 | --------------------------------------- | ||
17 | |||
17 | class AttributeTuple a | 18 | class AttributeTuple a |
18 | instance AttributeTuple a -- TODO | 19 | instance AttributeTuple a -- TODO |
19 | class ValidOutput a | 20 | class ValidOutput a |
@@ -100,33 +101,34 @@ instance Signed Float | |||
100 | class Component a where | 101 | class Component a where |
101 | zeroComp :: a | 102 | zeroComp :: a |
102 | oneComp :: a | 103 | oneComp :: a |
103 | -- PrimZero, PrimOne :: {- (Component a) => -- TODO -} a | ||
104 | 104 | ||
105 | instance Component Bool where | ||
106 | zeroComp = False | ||
107 | oneComp = True | ||
108 | instance Component Int where | 105 | instance Component Int where |
109 | zeroComp = 0 :: Int -- todo | 106 | zeroComp = 0 |
110 | oneComp = 1 :: Int -- todo | 107 | oneComp = 1 |
111 | |||
112 | instance Component Word where | 108 | instance Component Word where |
113 | zeroComp = 0 :: Word | 109 | zeroComp = 0 |
114 | oneComp = 1 :: Word | 110 | oneComp = 1 |
115 | |||
116 | instance Component Float where | 111 | instance Component Float where |
117 | zeroComp = 0.0 -- todo: 0 | 112 | zeroComp = 0 |
118 | oneComp = 1.0 -- todo: 1 | 113 | oneComp = 1 |
119 | instance Component (VecS Float 2) where | 114 | instance Component (VecS Float 2) where |
120 | zeroComp = V2 0.0 0.0 | 115 | zeroComp = V2 0 0 |
121 | oneComp = V2 1.0 1.0 | 116 | oneComp = V2 1 1 |
122 | instance Component (VecS Float 3) where | 117 | instance Component (VecS Float 3) where |
123 | zeroComp = V3 0.0 0.0 0.0 | 118 | zeroComp = V3 0 0 0 |
124 | oneComp = V3 1.0 1.0 1.0 | 119 | oneComp = V3 1 1 1 |
125 | instance Component (VecS Float 4) where | 120 | instance Component (VecS Float 4) where |
126 | zeroComp = V4 0.0 0.0 0.0 0.0 | 121 | zeroComp = V4 0 0 0 0 |
127 | oneComp = V4 1.0 1.0 1.0 1.0 | 122 | oneComp = V4 1 1 1 1 |
128 | instance Component (VecS Bool 2) {-where-} | 123 | instance Component Bool where |
129 | instance Component (VecS Bool 3) {-where-} | 124 | zeroComp = False |
125 | oneComp = True | ||
126 | instance Component (VecS Bool 2) where | ||
127 | zeroComp = V2 False False | ||
128 | oneComp = V2 True True | ||
129 | instance Component (VecS Bool 3) where | ||
130 | zeroComp = V3 False False False | ||
131 | oneComp = V3 True True True | ||
130 | instance Component (VecS Bool 4) where | 132 | instance Component (VecS Bool 4) where |
131 | zeroComp = V4 False False False False | 133 | zeroComp = V4 False False False False |
132 | oneComp = V4 True True True True | 134 | oneComp = V4 True True True True |
diff --git a/lc/Internals.lc b/lc/Internals.lc index b7d55b51..780835cc 100644 --- a/lc/Internals.lc +++ b/lc/Internals.lc | |||
@@ -127,3 +127,4 @@ instance Eq Nat where | |||
127 | Succ a == Succ b = a == b | 127 | Succ a == Succ b = a == b |
128 | _ == _ = False | 128 | _ == _ = False |
129 | 129 | ||
130 | |||