This commit is contained in:
+4
-6
@@ -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 = _
|
||||
|
||||
|
||||
Reference in New Issue
Block a user