This commit is contained in:
2026-05-07 01:47:43 -06:00
parent fd41c0c4d6
commit 55a2f45cee
3 changed files with 62 additions and 10 deletions
+4 -6
View File
@@ -53,6 +53,9 @@ blah' = go [] where
go acc [] k = k (reverse acc)
go acc (f:fs) k = f \a -> go (a:acc) fs k
telescope :: Traversable t => t ((a -> r) -> r) -> (t a -> r) -> r
telescope = runCont . traverse cont
-- 뻘짓이어라
blah :: forall t a r. Foldable t => t ((a -> r) -> r) -> (List a -> r) -> r
blah xs k =
@@ -67,14 +70,9 @@ toANF'
toANF' (Lam.ExpVal v) k = k v
toANF' (Lam.ExpApply f xs) k =
blah (toANF' <$> (f:|xs)) \(f':xs') -> do
telescope (toANF' <$> (f:|xs)) \(f':|xs') -> do
r <- gensym
ExpLetApply r f' xs' <$> k (ValVar r)
where
allToANF' es k = traverse (\e -> toANF' e k) es
-- blah = traverse g (f :| xs)
-- g :: Lam.Exp -> Eff es Val
-- g = ContT . toANF'
toANF' e k = _