summaryrefslogtreecommitdiff
path: root/lc/Internals.lc
diff options
context:
space:
mode:
authorPéter Diviánszky <divipp@gmail.com>2016-05-04 16:41:56 +0200
committerPéter Diviánszky <divipp@gmail.com>2016-05-04 16:41:56 +0200
commitd09859323b7213d6b3c3baf485d8389100faf469 (patch)
treeeda20598a3729354cd702e847d648dadfa3acf44 /lc/Internals.lc
parent6066e1154af07dd27733343199fd51758fed6c52 (diff)
implement constraint kinds
Diffstat (limited to 'lc/Internals.lc')
-rw-r--r--lc/Internals.lc32
1 files changed, 16 insertions, 16 deletions
diff --git a/lc/Internals.lc b/lc/Internals.lc
index 170f2c39..d8a08a33 100644
--- a/lc/Internals.lc
+++ b/lc/Internals.lc
@@ -18,8 +18,17 @@ data Empty (a :: String)
18 18
19unsafeCoerce :: forall a b . a -> b 19unsafeCoerce :: forall a b . a -> b
20 20
21data Constraint where
22 CUnit :: Constraint
23 CEmpty :: String -> Constraint
24
25type family CW (c :: Constraint) -- where
26{-
27 CW 'CUnit = Unit
28 CW ('CEmpty s) = Empty s
29-}
21-- equality constraints 30-- equality constraints
22type family EqCT (t :: Type) (a :: t) (b :: t) 31type family EqCT (t :: Type) (a :: t) (b :: t) :: Constraint
23{- 32{-
24coe :: forall (a :: Type) (b :: Type) -> EqCT Type a b -> a -> b 33coe :: forall (a :: Type) (b :: Type) -> EqCT Type a b -> a -> b
25coe a b TT x = unsafeCoerce @a @b x 34coe a b TT x = unsafeCoerce @a @b x
@@ -31,7 +40,12 @@ coe a b TT x = unsafeCoerce @a @b x
31parEval :: forall a -> a -> a -> a 40parEval :: forall a -> a -> a -> a
32 41
33-- conjuction of constraints 42-- conjuction of constraints
34type family T2 a b 43type family T2 (x :: Constraint) (y :: Constraint) :: Constraint
44{-
45type instance T2 'CUnit c = c
46type instance T2 c 'CUnit = c
47type instance T2 ('CEmpty s) ('CEmpty s') = 'CEmpty (s {- ++ s' TODO-})
48-}
35 49
36match'Type :: forall (m :: Type -> Type) -> m Type -> forall (t :: Type) -> m t -> m t 50match'Type :: forall (m :: Type -> Type) -> m Type -> forall (t :: Type) -> m t -> m t
37 51
@@ -136,18 +150,4 @@ hlistConsCase
136 -> c 150 -> c
137 151
138{- 152{-
139-- TODO: unsafeCoerce is not really needed here
140hlistConsCase @e @f c fv x = 'HListCase
141 (\_ _ -> c)
142 undefined
143 (\ @t @lt y ys -> fv (unsafeCoerce @t @e y) (unsafeCoerce @(HList lt) @(HList f) ys))
144 x
145
146hlistNilCase c x v = 'HListCase
147 (\_ _ -> c)
148 x
149 (\_ _ -> undefined :: c)
150 v
151-} 153-}
152
153