diff options
author | Péter Diviánszky <divipp@gmail.com> | 2016-05-04 16:41:56 +0200 |
---|---|---|
committer | Péter Diviánszky <divipp@gmail.com> | 2016-05-04 16:41:56 +0200 |
commit | d09859323b7213d6b3c3baf485d8389100faf469 (patch) | |
tree | eda20598a3729354cd702e847d648dadfa3acf44 /lc/Internals.lc | |
parent | 6066e1154af07dd27733343199fd51758fed6c52 (diff) |
implement constraint kinds
Diffstat (limited to 'lc/Internals.lc')
-rw-r--r-- | lc/Internals.lc | 32 |
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 | ||
19 | unsafeCoerce :: forall a b . a -> b | 19 | unsafeCoerce :: forall a b . a -> b |
20 | 20 | ||
21 | data Constraint where | ||
22 | CUnit :: Constraint | ||
23 | CEmpty :: String -> Constraint | ||
24 | |||
25 | type family CW (c :: Constraint) -- where | ||
26 | {- | ||
27 | CW 'CUnit = Unit | ||
28 | CW ('CEmpty s) = Empty s | ||
29 | -} | ||
21 | -- equality constraints | 30 | -- equality constraints |
22 | type family EqCT (t :: Type) (a :: t) (b :: t) | 31 | type family EqCT (t :: Type) (a :: t) (b :: t) :: Constraint |
23 | {- | 32 | {- |
24 | coe :: forall (a :: Type) (b :: Type) -> EqCT Type a b -> a -> b | 33 | coe :: forall (a :: Type) (b :: Type) -> EqCT Type a b -> a -> b |
25 | coe a b TT x = unsafeCoerce @a @b x | 34 | coe a b TT x = unsafeCoerce @a @b x |
@@ -31,7 +40,12 @@ coe a b TT x = unsafeCoerce @a @b x | |||
31 | parEval :: forall a -> a -> a -> a | 40 | parEval :: forall a -> a -> a -> a |
32 | 41 | ||
33 | -- conjuction of constraints | 42 | -- conjuction of constraints |
34 | type family T2 a b | 43 | type family T2 (x :: Constraint) (y :: Constraint) :: Constraint |
44 | {- | ||
45 | type instance T2 'CUnit c = c | ||
46 | type instance T2 c 'CUnit = c | ||
47 | type instance T2 ('CEmpty s) ('CEmpty s') = 'CEmpty (s {- ++ s' TODO-}) | ||
48 | -} | ||
35 | 49 | ||
36 | match'Type :: forall (m :: Type -> Type) -> m Type -> forall (t :: Type) -> m t -> m t | 50 | match'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 | ||
140 | hlistConsCase @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 | |||
146 | hlistNilCase c x v = 'HListCase | ||
147 | (\_ _ -> c) | ||
148 | x | ||
149 | (\_ _ -> undefined :: c) | ||
150 | v | ||
151 | -} | 153 | -} |
152 | |||
153 | |||