partway through desugar

This commit is contained in:
pilfer-pandex 2019-10-01 15:09:23 -07:00
parent 6f8a60e5fa
commit 926ef695c8
2 changed files with 11 additions and 9 deletions

View File

@ -53,7 +53,11 @@ ledt v e f = Let e (abstract1 v f)
fix :: Eq a => a -> Exp a -> Exp a
fix v e = Fix (abstract1 v e)
-- | The expression that returns the given noun as a constant.
con :: Noun -> Exp a
con = \case
A a -> Atm a
C n m -> Cel (con n) (con m)
data CExp a
= CVar a

View File

@ -32,22 +32,20 @@ data Pat
= Exact Noun
| Wild
{-
desugar :: Eq a => Hoon a -> Exp a
desugar = go
where
go = \case
HVar v -> Var v
HCons h j -> Cel (go h) (go j)
BarCen v cs -> Lam $ Scope $ go $ WutHep (Var (B ()))
BarWut cs ->
CenBar cs -> Fix $ Scope
BarCen cs -> undefined --Lam $ Scope $ go $ WutHep (Var (B ()))
-- CenBar cs -> Fix $ Scope
WutHep h cs -> undefined
branch :: (Hoon b -> Exp a) -> Exp a -> Cases b -> Exp a
branch go e = foldr f Zap
where
f c acc = case c of
(Exact n, h) -> Ift (Eql e
f c acc = case c of
(Exact n, h) -> Ift (Eql e (con n)) (go h) acc
(Wild, h) -> go h
-}