mirror of
https://github.com/urbit/shrub.git
synced 2025-01-02 17:43:32 +03:00
Merge branch 'pp/proto' of github.com:urbit/urbit into pp/proto
This commit is contained in:
commit
844e568959
@ -53,7 +53,11 @@ ledt v e f = Let e (abstract1 v f)
|
|||||||
fix :: Eq a => a -> Exp a -> Exp a
|
fix :: Eq a => a -> Exp a -> Exp a
|
||||||
fix v e = Fix (abstract1 v e)
|
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
|
data CExp a
|
||||||
= CVar a
|
= CVar a
|
||||||
|
@ -32,22 +32,20 @@ data Pat
|
|||||||
= Exact Noun
|
= Exact Noun
|
||||||
| Wild
|
| Wild
|
||||||
|
|
||||||
{-
|
|
||||||
|
|
||||||
desugar :: Eq a => Hoon a -> Exp a
|
desugar :: Eq a => Hoon a -> Exp a
|
||||||
desugar = go
|
desugar = go
|
||||||
where
|
where
|
||||||
go = \case
|
go = \case
|
||||||
HVar v -> Var v
|
HVar v -> Var v
|
||||||
HCons h j -> Cel (go h) (go j)
|
HCons h j -> Cel (go h) (go j)
|
||||||
BarCen v cs -> Lam $ Scope $ go $ WutHep (Var (B ()))
|
BarCen cs -> undefined --Lam $ Scope $ go $ WutHep (Var (B ()))
|
||||||
BarWut cs ->
|
-- CenBar cs -> Fix $ Scope
|
||||||
CenBar cs -> Fix $ Scope
|
WutHep h cs -> undefined
|
||||||
|
|
||||||
branch :: (Hoon b -> Exp a) -> Exp a -> Cases b -> Exp a
|
branch :: (Hoon b -> Exp a) -> Exp a -> Cases b -> Exp a
|
||||||
branch go e = foldr f Zap
|
branch go e = foldr f Zap
|
||||||
where
|
where
|
||||||
f c acc = case c of
|
f c acc = case c of
|
||||||
(Exact n, h) -> Ift (Eql e
|
(Exact n, h) -> Ift (Eql e (con n)) (go h) acc
|
||||||
|
(Wild, h) -> go h
|
||||||
|
|
||||||
-}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user