summaryrefslogtreecommitdiff
path: root/lc
diff options
context:
space:
mode:
authorPéter Diviánszky <divipp@gmail.com>2016-02-04 15:40:02 +0100
committerPéter Diviánszky <divipp@gmail.com>2016-02-04 15:40:02 +0100
commit91b08d7eb8b3ba2e26862e389e1a58d6c7290a91 (patch)
tree879dd9551b6c7c60c2095ab650e5cd623f109331 /lc
parent78e4c9e23e6c53a53490a91cf4bdcf63e5d67cac (diff)
more complete Component instances
Diffstat (limited to 'lc')
-rw-r--r--lc/Builtins.lc46
-rw-r--r--lc/Internals.lc1
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
9id x = x 9id x = x
10 10
11--------------------------------------- 11-- todo: move to Internals
12
13data List a = Nil | Cons a (List a) 12data List a = Nil | Cons a (List a)
14 13
15infixr 5 : 14infixr 5 :
16 15
16---------------------------------------
17
17class AttributeTuple a 18class AttributeTuple a
18instance AttributeTuple a -- TODO 19instance AttributeTuple a -- TODO
19class ValidOutput a 20class ValidOutput a
@@ -100,33 +101,34 @@ instance Signed Float
100class Component a where 101class Component a where
101 zeroComp :: a 102 zeroComp :: a
102 oneComp :: a 103 oneComp :: a
103-- PrimZero, PrimOne :: {- (Component a) => -- TODO -} a
104 104
105instance Component Bool where
106 zeroComp = False
107 oneComp = True
108instance Component Int where 105instance Component Int where
109 zeroComp = 0 :: Int -- todo 106 zeroComp = 0
110 oneComp = 1 :: Int -- todo 107 oneComp = 1
111
112instance Component Word where 108instance Component Word where
113 zeroComp = 0 :: Word 109 zeroComp = 0
114 oneComp = 1 :: Word 110 oneComp = 1
115
116instance Component Float where 111instance Component Float where
117 zeroComp = 0.0 -- todo: 0 112 zeroComp = 0
118 oneComp = 1.0 -- todo: 1 113 oneComp = 1
119instance Component (VecS Float 2) where 114instance 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
122instance Component (VecS Float 3) where 117instance 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
125instance Component (VecS Float 4) where 120instance 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
128instance Component (VecS Bool 2) {-where-} 123instance Component Bool where
129instance Component (VecS Bool 3) {-where-} 124 zeroComp = False
125 oneComp = True
126instance Component (VecS Bool 2) where
127 zeroComp = V2 False False
128 oneComp = V2 True True
129instance Component (VecS Bool 3) where
130 zeroComp = V3 False False False
131 oneComp = V3 True True True
130instance Component (VecS Bool 4) where 132instance 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