mirror of
https://github.com/urbit/shrub.git
synced 2024-12-21 09:51:36 +03:00
partway through desugar
This commit is contained in:
parent
6f8a60e5fa
commit
926ef695c8
@ -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
|
||||
|
@ -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
|
||||
|
||||
-}
|
||||
|
Loading…
Reference in New Issue
Block a user