summaryrefslogtreecommitdiff
path: root/lc
diff options
context:
space:
mode:
authorPéter Diviánszky <divipp@gmail.com>2016-02-07 08:28:27 +0100
committerPéter Diviánszky <divipp@gmail.com>2016-02-07 21:36:23 +0100
commit88cedb5412b3f2b921debb40866d53224341fe75 (patch)
treee88e41e11772e279f6d445b085be63daf081a78a /lc
parent6e291f28363cc873b809e020eef8a929c8244508 (diff)
refactoring
Diffstat (limited to 'lc')
-rw-r--r--lc/Internals.lc23
-rw-r--r--lc/Prelude.lc2
2 files changed, 15 insertions, 10 deletions
diff --git a/lc/Internals.lc b/lc/Internals.lc
index 15d1a38e..72386f16 100644
--- a/lc/Internals.lc
+++ b/lc/Internals.lc
@@ -13,6 +13,14 @@ data Unit = TT
13data String 13data String
14data Empty (a :: String) 14data Empty (a :: String)
15 15
16unsafeCoerce :: forall a b . a -> b
17
18-- equality constraints
19type family EqCT (t :: Type) (a :: t) (b :: t)
20{-
21coe :: forall (a :: Type) (b :: Type) -> EqCT Type a b -> a -> b
22coe a b TT x = unsafeCoerce @a @b x
23-}
16-- TODO: generate? 24-- TODO: generate?
17data Tuple0 = Tuple0 25data Tuple0 = Tuple0
18data Tuple1 a = Tuple1 a 26data Tuple1 a = Tuple1 a
@@ -39,16 +47,15 @@ type family T2 a b
39 47
40match'Type :: forall (m :: Type -> Type) -> m Type -> forall (t :: Type) -> m t -> m t 48match'Type :: forall (m :: Type -> Type) -> m Type -> forall (t :: Type) -> m t -> m t
41 49
42--testmt :: forall (t :: Type) -> t -> t 50testmt :: forall (t :: Type) -> t -> t
43--testmt 'Type = \'Tuple0 -> 'Tuple0 51testmt 'Type = \'Tuple0 -> 'Tuple0
44 52--testmt t x = (match'Type (\q -> (q -> q)) (\x -> match'Tuple0 (\q -> & 'Type) 'Tuple0 x undefined) t undefined) x
45-- equality constraints 53--testmt t x = (match'Type (\q -> (q -> q)) (\x -> match'Tuple0 (\q -> 'Type) 'Tuple0 x undefined) t undefined) x
46type family EqCT (t :: Type) (a :: t) (b :: t)
47 54
48--type instance EqCT Type Type Type = Unit--(a, b) (JoinTupleType a' b') = T2 (EqCT Type a a') (EqCT Type b b') 55--type instance EqCT Type = \'Type 'Type -> 'Unit
49--type instance EqCT Type (a, b) (JoinTupleType a' b') = T2 (EqCT Type a a') (EqCT Type b b') 56--type instance EqCT Type = \'(a, b) '(JoinTupleType a' b') -> '(T2 (EqCT Type a a') (EqCT Type b b'))
50 57
51type EqCTt = EqCT Type 58type EqCTt = EqCT _
52 59
53-- builtin conjuction of constraint witnesses 60-- builtin conjuction of constraint witnesses
54t2C :: Unit -> Unit -> Unit 61t2C :: Unit -> Unit -> Unit
diff --git a/lc/Prelude.lc b/lc/Prelude.lc
index 167d5d05..b82cd903 100644
--- a/lc/Prelude.lc
+++ b/lc/Prelude.lc
@@ -125,8 +125,6 @@ type instance Split z (RecordC xs) (RecordC ys) | defined xs &&& defined ys = T2
125record :: [(String, Type)] -> Type 125record :: [(String, Type)] -> Type
126--record xs = RecordCons ({- TODO: sortBy fst-} xs) 126--record xs = RecordCons ({- TODO: sortBy fst-} xs)
127-} 127-}
128-- builtin
129unsafeCoerce :: forall a b . a -> b
130 128
131isKeyC _ _ [] = 'Empty "" 129isKeyC _ _ [] = 'Empty ""
132isKeyC s t ((s', t'): ss) = if s == s' then t ~ t' else isKeyC s t ss 130isKeyC s t ((s', t'): ss) = if s == s' then t ~ t' else isKeyC s t ss