summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2019-03-23 20:49:53 -0400
committerJoe Crayne <joe@jerkface.net>2019-03-23 20:51:03 -0400
commitd5fd902d4e95c8e78cc658147499883d21218225 (patch)
tree59c645b32975e4c8ac0786183461ddada7f03a71
parent6c3d521988cef72cab99cb800e75134193ac4afb (diff)
Distinguish formal lambda type.
-rw-r--r--monkeypatch.hs80
1 files changed, 43 insertions, 37 deletions
diff --git a/monkeypatch.hs b/monkeypatch.hs
index e58cc2e..0b115e3 100644
--- a/monkeypatch.hs
+++ b/monkeypatch.hs
@@ -176,12 +176,17 @@ infixOp x op y = InfixApp () x (QVarOp () (UnQual () (Symbol () op))) y
176infixFn :: HS.Exp () -> String -> HS.Exp () -> HS.Exp () 176infixFn :: HS.Exp () -> String -> HS.Exp () -> HS.Exp ()
177infixFn x fn y = InfixApp () x (QVarOp () (UnQual () (HS.Ident () fn))) y 177infixFn x fn y = InfixApp () x (QVarOp () (UnQual () (HS.Ident () fn))) y
178 178
179data FormalLambda = FormalLambda { formGo :: String
180 , formExp :: HS.Exp ()
181 }
179 182
183informalize :: FormalLambda -> HS.Exp ()
184informalize (FormalLambda k x) = Lambda () [hspvar k] x
180 185
181applyComputation :: Computation (HS.Exp ()) -> Computation (HS.Exp ()) -> Computation (HS.Exp ()) 186applyComputation :: Computation FormalLambda -> Computation (HS.Exp ()) -> Computation (HS.Exp ())
182applyComputation a@Computation{ comp = (Lambda () [PVar () govar] exp) } b = 187applyComputation a@Computation{ comp = FormalLambda govar exp } b =
183 let matchgo (Var () (UnQual () v)) = v==govar 188 let matchgo (Var () (UnQual () (HS.Ident () v))) = v==govar
184 matchgo _ = False 189 matchgo _ = False
185 in case listify matchgo exp of 190 in case listify matchgo exp of
186 (_:_:_) -> error "TODO: Multiple go-refs; make let binding." 191 (_:_:_) -> error "TODO: Multiple go-refs; make let binding."
187 _ -> Computation 192 _ -> Computation
@@ -191,7 +196,6 @@ applyComputation a@Computation{ comp = (Lambda () [PVar () govar] exp) } b =
191 | otherwise = x 196 | otherwise = x
192 in everywhere (mkT subst) exp 197 in everywhere (mkT subst) exp
193 } 198 }
194applyComputation a b = a
195 199
196varmap :: [String] -> Map String () 200varmap :: [String] -> Map String ()
197varmap vs = Map.fromList $ map (,()) vs 201varmap vs = Map.fromList $ map (,()) vs
@@ -203,11 +207,11 @@ varmap vs = Map.fromList $ map (,()) vs
203-} 207-}
204 208
205 209
206renameIntros :: forall v st. (Typeable st, Data st) => 210renameIntros :: forall v st a. (Typeable st, Data st) =>
207 [Computation (HS.Exp st)] 211 [Computation FormalLambda]
208 -> Computation (HS.Exp st) 212 -> Computation (HS.Exp st)
209 -> Map String v 213 -> Map String v
210 -> ([Computation (HS.Exp st)], Computation (HS.Exp st)) 214 -> ([Computation FormalLambda], Computation (HS.Exp st))
211renameIntros bs cb vs = (bs',cb') 215renameIntros bs cb vs = (bs',cb')
212 where 216 where
213 (rs,bs') = unzip $ map go bs 217 (rs,bs') = unzip $ map go bs
@@ -230,7 +234,7 @@ renameIntros bs cb vs = (bs',cb')
230 | s==x = PVar (la::st) (HS.Ident lb v) 234 | s==x = PVar (la::st) (HS.Ident lb v)
231 subst p = p 235 subst p = p
232 in if x/=v then (,) ((x,v):rs) c { compIntro = Map.insert v () $ Map.delete x (compIntro c) 236 in if x/=v then (,) ((x,v):rs) c { compIntro = Map.insert v () $ Map.delete x (compIntro c)
233 , comp = everywhere (mkT subst) (comp c) 237 , comp = (comp c) { formExp = everywhere (mkT subst) (formExp $ comp c) }
234 } 238 }
235 else (rs,c) 239 else (rs,c)
236 240
@@ -277,7 +281,7 @@ isGlobalRef fe sym = fromMaybe False $ do
277-- expression. 281-- expression.
278grokExpression :: FunctionEnvironment 282grokExpression :: FunctionEnvironment
279 -> CExpression a 283 -> CExpression a
280 -> Maybe ([Computation (HS.Exp ())], Computation (HS.Exp ())) 284 -> Maybe ([Computation FormalLambda], Computation (HS.Exp ()))
281grokExpression fe (CVar cv _) = 285grokExpression fe (CVar cv _) =
282 let v = identToString cv 286 let v = identToString cv
283 in Just $ 287 in Just $
@@ -286,7 +290,7 @@ grokExpression fe (CVar cv _) =
286 s = Computation 290 s = Computation
287 { compFree = Map.singleton v () 291 { compFree = Map.singleton v ()
288 , compIntro = Map.singleton hv () 292 , compIntro = Map.singleton hv ()
289 , comp = Lambda () [hspvar k] 293 , comp = FormalLambda k
290 $ infixOp (App () (hsvar "peek") (hsvar v)) ">>=" 294 $ infixOp (App () (hsvar "peek") (hsvar v)) ">>="
291 $ Lambda () [hspvar hv] (hsvar k) 295 $ Lambda () [hspvar hv] (hsvar k)
292 } 296 }
@@ -333,7 +337,7 @@ grokExpression fe (CUnary CAdrOp (CVar cv0 _) _) = do
333 ss = pure Computation 337 ss = pure Computation
334 { compFree = Map.singleton cv () 338 { compFree = Map.singleton cv ()
335 , compIntro = Map.singleton hv () 339 , compIntro = Map.singleton hv ()
336 , comp = Lambda () [hspvar k] 340 , comp = FormalLambda k
337 $ infixFn (hsvar cv) 341 $ infixFn (hsvar cv)
338 "withPointer" 342 "withPointer"
339 (Lambda () [hspvar hv] (hsvar k)) 343 (Lambda () [hspvar hv] (hsvar k))
@@ -369,11 +373,13 @@ grokExpression fe (CComma exps _) = do
369 gs <- mapM (grokExpression fe) exps 373 gs <- mapM (grokExpression fe) exps
370 let gs2 = map (\(ss,x) -> foldr applyComputation (App () (hsvar "return") <$> x) ss) gs 374 let gs2 = map (\(ss,x) -> foldr applyComputation (App () (hsvar "return") <$> x) ss) gs
371 parn e = Paren () e 375 parn e = Paren () e
372 ps = map (\x -> let k = uniqIdentifier "go" (compFree x) in fmap (\xx -> Lambda () [hspvar k] (infixOp (parn xx) ">>" (hsvar k))) x) (init gs2) 376 ps = map (\x -> let k = uniqIdentifier "go" (compFree x)
377 in fmap (\xx -> FormalLambda k (infixOp (parn xx) ">>" (hsvar k))) x)
378 (init gs2)
373 s = foldr applyComputation (last gs2) ps 379 s = foldr applyComputation (last gs2) ps
374 hv = "u" 380 hv = "u"
375 k = uniqIdentifier "go" (compFree s) 381 k = uniqIdentifier "go" (compFree s)
376 s' = fmap (\x -> Lambda () [hspvar k] (infixOp (parn x) ">>=" (Lambda () [hspvar hv] (hsvar k)))) s 382 s' = fmap (\x -> FormalLambda k (infixOp (parn x) ">>=" (Lambda () [hspvar hv] (hsvar k)))) s
377 -- TODO: It would be cleaner if I could return only a statement and not an expression. 383 -- TODO: It would be cleaner if I could return only a statement and not an expression.
378 return ([s'],Computation (Map.singleton hv ()) Map.empty (hsvar hv)) 384 return ([s'],Computation (Map.singleton hv ()) Map.empty (hsvar hv))
379grokExpression fe (C.CCall (CVar fn _) exps _) = do 385grokExpression fe (C.CCall (CVar fn _) exps _) = do
@@ -386,7 +392,7 @@ grokExpression fe (C.CCall (CVar fn _) exps _) = do
386 s = Computation 392 s = Computation
387 { compFree = frees 393 { compFree = frees
388 , compIntro = Map.singleton hv () 394 , compIntro = Map.singleton hv ()
389 , comp = Lambda () [hspvar k] 395 , comp = FormalLambda k
390 $ infixOp cll ">>=" 396 $ infixOp cll ">>="
391 $ Lambda () [hspvar hv] (hsvar k) 397 $ Lambda () [hspvar hv] (hsvar k)
392 } 398 }
@@ -408,7 +414,7 @@ grokExpression fe (CStatExpr (CCompound idents xs _) _) = do
408 s = Computation 414 s = Computation
409 { compFree = compFree s1 415 { compFree = compFree s1
410 , compIntro = Map.singleton hv () 416 , compIntro = Map.singleton hv ()
411 , comp = Lambda () [hspvar k] 417 , comp = FormalLambda k
412 $ infixOp (comp s1) ">>=" 418 $ infixOp (comp s1) ">>="
413 $ Lambda () [hspvar hv] (hsvar k) 419 $ Lambda () [hspvar hv] (hsvar k)
414 } 420 }
@@ -423,7 +429,7 @@ grokExpression fe (CAssign CAssignOp cvar expr _) = do
423 let k = uniqIdentifier "go" (Map.insert v () $ foldr (\s m -> compFree s `Map.union` compIntro s `Map.union` m) Map.empty ss) 429 let k = uniqIdentifier "go" (Map.insert v () $ foldr (\s m -> compFree s `Map.union` compIntro s `Map.union` m) Map.empty ss)
424 s = x 430 s = x
425 { compIntro = Map.singleton v () 431 { compIntro = Map.singleton v ()
426 , comp = Lambda () [hspvar k] 432 , comp = FormalLambda k
427 $ infixOp (App () (hsvar "return") (comp x)) ">>=" 433 $ infixOp (App () (hsvar "return") (comp x)) ">>="
428 $ Lambda () [hspvar v] (hsvar k) 434 $ Lambda () [hspvar v] (hsvar k)
429 } 435 }
@@ -439,7 +445,7 @@ grokInitialization :: Foldable t1 =>
439 FunctionEnvironment 445 FunctionEnvironment
440 -> t1 (CDeclarationSpecifier t2) 446 -> t1 (CDeclarationSpecifier t2)
441 -> (Maybe (CDeclarator a1), CInitializer a2) 447 -> (Maybe (CDeclarator a1), CInitializer a2)
442 -> Maybe (Computation (HS.Exp ())) 448 -> Maybe (Computation FormalLambda)
443grokInitialization fe _ (Just (CDeclr (Just cv0) _ _ _ _),CInitExpr exp _) = do 449grokInitialization fe _ (Just (CDeclr (Just cv0) _ _ _ _),CInitExpr exp _) = do
444 let v = identToString cv0 450 let v = identToString cv0
445 (xs,x) <- grokExpression fe exp 451 (xs,x) <- grokExpression fe exp
@@ -448,7 +454,7 @@ grokInitialization fe _ (Just (CDeclr (Just cv0) _ _ _ _),CInitExpr exp _) = do
448 fmap (\exp -> infixOp exp ">>=" 454 fmap (\exp -> infixOp exp ">>="
449 $ Lambda () [hspvar v] (hsvar k)) hsexp 455 $ Lambda () [hspvar v] (hsvar k)) hsexp
450 k = uniqIdentifier "go" (compFree ret) 456 k = uniqIdentifier "go" (compFree ret)
451 return $ fmap (\exp -> Lambda () [hspvar k] exp) ret 457 return $ fmap (FormalLambda k) ret
452grokInitialization fe ts (Just (CDeclr (Just cv0) _ _ _ _),CInitList exps _) = do 458grokInitialization fe ts (Just (CDeclr (Just cv0) _ _ _ _),CInitList exps _) = do
453 let v = identToString cv0 459 let v = identToString cv0
454 -- let k = uniqIdentifier "go" (varmap [v]) 460 -- let k = uniqIdentifier "go" (varmap [v])
@@ -471,24 +477,24 @@ grokInitialization fe ts (Just (CDeclr (Just cv0) _ _ _ _),CInitList exps _) = d
471 fieldinit = comp x 477 fieldinit = comp x
472 fieldlbl = identToString m 478 fieldlbl = identToString m
473 return x 479 return x
474 { comp = Lambda () [hspvar k1] 480 { comp = FormalLambda k1
475 $ infixOp 481 $ infixOp
476 (App () (App () (App () (hsvar "set") 482 (App () (App () (App () (hsvar "set")
477 (TypeApp () (TyPromoted () (PromotedString () fieldlbl fieldlbl)))) 483 (TypeApp () (TyPromoted () (PromotedString () fieldlbl fieldlbl))))
478 (hsvar v)) 484 (hsvar v))
479 fieldinit) ">>" (hsvar k1) 485 fieldinit) ">>" (hsvar k1)
480 } 486 }
481 return $ fmap (\exp -> Lambda () [hspvar k2] exp) ret 487 return $ fmap (FormalLambda k2) ret
482 let newstruct = Computation 488 let newstruct = Computation
483 { compFree = Map.empty -- todo 489 { compFree = Map.empty -- todo
484 , compIntro = Map.singleton v () 490 , compIntro = Map.singleton v ()
485 , comp = Lambda () [hspvar k] 491 , comp = FormalLambda k
486 $ infixOp (App () (hsvar "newStruct") (TypeApp () (TyCon () (UnQual () hident)))) ">>=" 492 $ infixOp (App () (hsvar "newStruct") (TypeApp () (TyCon () (UnQual () hident)))) ">>="
487 $ Lambda () [hspvar v] (hsvar k) 493 $ Lambda () [hspvar v] (hsvar k)
488 } 494 }
489 k = uniqIdentifier "go" Map.empty -- (compFree ret) TODO 495 k = uniqIdentifier "go" Map.empty -- (compFree ret) TODO
490 ret = foldr applyComputation (Computation Map.empty Map.empty (hsvar k)) $ newstruct : assigns 496 ret = foldr applyComputation (Computation Map.empty Map.empty (hsvar k)) $ newstruct : assigns
491 return $ fmap (\exp -> Lambda () [hspvar k] exp) ret 497 return $ fmap (FormalLambda k) ret
492 _ -> Nothing 498 _ -> Nothing
493grokInitialization _ _ _ = Nothing 499grokInitialization _ _ _ = Nothing
494 500
@@ -502,14 +508,14 @@ promote fe y@(Lit () (Int () n _)) | (n==0 || n==1) && hasBool (fe Map.! "") =
502 1 -> "True" 508 1 -> "True"
503promote _ y = y 509promote _ y = y
504 510
505grokStatement :: FunctionEnvironment -> CCompoundBlockItem a -> Maybe (Computation (HS.Exp ())) 511grokStatement :: FunctionEnvironment -> CCompoundBlockItem a -> Maybe (Computation FormalLambda)
506grokStatement fe (CBlockStmt (CReturn (Just exp) _)) = do 512grokStatement fe (CBlockStmt (CReturn (Just exp) _)) = do
507 (xs,x) <- grokExpression fe exp 513 (xs,x) <- grokExpression fe exp
508 let k = uniqIdentifier "go" (compFree x `Map.union` compIntro x) 514 let k = uniqIdentifier "go" (compFree x `Map.union` compIntro x)
509 x' = fmap (\y -> App () (hsvar "return") $ promote (fnArgs fe) y) x 515 x' = fmap (\y -> App () (hsvar "return") $ promote (fnArgs fe) y) x
510 return $ fmap (\y -> Lambda () [hspvar k] y) $ foldr applyComputation x' xs 516 return $ fmap (\y -> FormalLambda k y) $ foldr applyComputation x' xs
511grokStatement fe (CBlockStmt (CReturn Nothing _)) = 517grokStatement fe (CBlockStmt (CReturn Nothing _)) =
512 Just $ Computation Map.empty Map.empty $ Lambda () [hspvar "go"] retUnit 518 Just $ Computation Map.empty Map.empty $ FormalLambda "go" retUnit
513grokStatement fe (CBlockStmt (CIf exp thn els _)) = do 519grokStatement fe (CBlockStmt (CIf exp thn els _)) = do
514 (xs,x) <- grokExpression fe exp 520 (xs,x) <- grokExpression fe exp
515 let mkif0 = If () (comp x) 521 let mkif0 = If () (comp x)
@@ -530,7 +536,7 @@ grokStatement fe (CBlockStmt (CIf exp thn els _)) = do
530 ss <- sequence $ map (grokStatement fe) stmts 536 ss <- sequence $ map (grokStatement fe) stmts
531 let s = foldr applyComputation (Computation Map.empty Map.empty (hsvar k)) ss 537 let s = foldr applyComputation (Computation Map.empty Map.empty (hsvar k)) ss
532 k = uniqIdentifier "go" (Map.union (compFree x) (compFree s)) 538 k = uniqIdentifier "go" (Map.union (compFree x) (compFree s))
533 return $ fmap (Lambda () [hspvar k]) $ flip (foldr applyComputation) xs Computation 539 return $ fmap (FormalLambda k) $ flip (foldr applyComputation) xs Computation
534 { compFree = compFree x `Map.union` compFree s 540 { compFree = compFree x `Map.union` compFree s
535 , compIntro = compIntro s 541 , compIntro = compIntro s
536 , comp = mkif (comp s) (hsvar k) 542 , comp = mkif (comp s) (hsvar k)
@@ -542,7 +548,7 @@ grokStatement fe (CBlockStmt (CExpr (Just (C.CCall (CVar (C.Ident "__assert_fail
542 _ -> Nothing 548 _ -> Nothing
543 let k = uniqIdentifier "go" (compFree x `Map.union` compIntro x) 549 let k = uniqIdentifier "go" (compFree x `Map.union` compIntro x)
544 x' = fmap (\y -> App () (hsvar "error") y) x 550 x' = fmap (\y -> App () (hsvar "error") y) x
545 return $ fmap (\y -> Lambda () [hspvar k] y) x' 551 return $ fmap (FormalLambda k) x'
546grokStatement fe (CBlockStmt (CExpr (Just 552grokStatement fe (CBlockStmt (CExpr (Just
547 (CAssign CAssignOp 553 (CAssign CAssignOp
548 (CMember cvar fld isptr _) expr _)) _)) = do 554 (CMember cvar fld isptr _) expr _)) _)) = do
@@ -558,7 +564,7 @@ grokStatement fe (CBlockStmt (CExpr (Just
558 (hsvar v)) 564 (hsvar v))
559 fieldinit) ">>" (hsvar k1) 565 fieldinit) ">>" (hsvar k1)
560 } 566 }
561 return $ fmap (\y -> Lambda () [hspvar k1] y) $ foldr applyComputation x' xs 567 return $ fmap (FormalLambda k1) $ foldr applyComputation x' xs
562grokStatement fe (CBlockStmt (CExpr (Just 568grokStatement fe (CBlockStmt (CExpr (Just
563 (C.CCall cvarfun exps _)) _)) = do 569 (C.CCall cvarfun exps _)) _)) = do
564 fn <- cvarName cvarfun 570 fn <- cvarName cvarfun
@@ -572,7 +578,7 @@ grokStatement fe (CBlockStmt (CExpr (Just
572 , compIntro = Map.empty 578 , compIntro = Map.empty
573 , comp = infixOp cll ">>" (hsvar k) 579 , comp = infixOp cll ">>" (hsvar k)
574 } 580 }
575 return $ fmap (Lambda () [hspvar k]) x 581 return $ fmap (FormalLambda k) x
576grokStatement fe (CBlockStmt (CExpr (Just 582grokStatement fe (CBlockStmt (CExpr (Just
577 (CAssign CAssignOp cvarnew 583 (CAssign CAssignOp cvarnew
578 (C.CCall cvarfun [] _) _)) _)) = do 584 (C.CCall cvarfun [] _) _)) _)) = do
@@ -582,7 +588,7 @@ grokStatement fe (CBlockStmt (CExpr (Just
582 return Computation 588 return Computation
583 { compFree = Map.singleton fn () 589 { compFree = Map.singleton fn ()
584 , compIntro = Map.singleton v () 590 , compIntro = Map.singleton v ()
585 , comp = Lambda () [hspvar k] 591 , comp = FormalLambda k
586 $ infixOp (hsvar fn) ">>=" 592 $ infixOp (hsvar fn) ">>="
587 $ Lambda () [hspvar v] (hsvar k) 593 $ Lambda () [hspvar v] (hsvar k)
588 } 594 }
@@ -593,7 +599,7 @@ grokStatement fe (CBlockStmt (CExpr (Just (CUnary CPostIncOp (CMember (CVar cv0
593 return Computation 599 return Computation
594 { compFree = varmap [v] 600 { compFree = varmap [v]
595 , compIntro = Map.empty 601 , compIntro = Map.empty
596 , comp = Lambda () [hspvar k1] 602 , comp = FormalLambda k1
597 $ infixOp 603 $ infixOp
598 (App () (App () (App () (hsvar "modify") 604 (App () (App () (App () (hsvar "modify")
599 (TypeApp () (TyPromoted () (PromotedString () fieldlbl fieldlbl)))) 605 (TypeApp () (TyPromoted () (PromotedString () fieldlbl fieldlbl))))
@@ -607,14 +613,14 @@ grokStatement fe (CBlockStmt (CExpr (Just expr) _)) = do
607 (ss,x) <- grokExpression fe expr 613 (ss,x) <- grokExpression fe expr
608 let k = uniqIdentifier "go" $ foldr Map.union Map.empty $ map compFree ss ++ map compIntro ss 614 let k = uniqIdentifier "go" $ foldr Map.union Map.empty $ map compFree ss ++ map compIntro ss
609 g = Computation Map.empty Map.empty (hsvar k) 615 g = Computation Map.empty Map.empty (hsvar k)
610 return $ fmap (Lambda () [hspvar k]) $ foldr applyComputation g ss 616 return $ fmap (FormalLambda k) $ foldr applyComputation g ss
611-} 617-}
612grokStatement fe (CBlockStmt (CExpr mexpr _)) = do 618grokStatement fe (CBlockStmt (CExpr mexpr _)) = do
613 (ss,pre) <- maybe (Just $ (,) [] $ Computation Map.empty Map.empty id) 619 (ss,pre) <- maybe (Just $ (,) [] $ Computation Map.empty Map.empty id)
614 (fmap (second (fmap (\e -> infixFn e "seq"))) . grokExpression fe) mexpr 620 (fmap (second (fmap (\e -> infixFn e "seq"))) . grokExpression fe) mexpr
615 let k = uniqIdentifier "go" (compFree s) 621 let k = uniqIdentifier "go" (compFree s)
616 s = foldr applyComputation (fmap ($ hsvar k) pre) ss 622 s = foldr applyComputation (fmap ($ hsvar k) pre) ss
617 return $ fmap (Lambda () [hspvar k]) s 623 return $ fmap (FormalLambda k) s
618grokStatement fe (CBlockDecl (CDecl (t:ts) (v:vs) _)) = do 624grokStatement fe (CBlockDecl (CDecl (t:ts) (v:vs) _)) = do
619 -- case mapMaybe (\(cdeclr,_,_) -> cdeclr >>= \(CDeclr i _ initial _ _) -> initial) (v:vs) of 625 -- case mapMaybe (\(cdeclr,_,_) -> cdeclr >>= \(CDeclr i _ initial _ _) -> initial) (v:vs) of
620 -- case mapMaybe (\(cdeclr,_,_) -> cdeclr >>= \(CInitList xs _) -> Just xs) (v:vs) of 626 -- case mapMaybe (\(cdeclr,_,_) -> cdeclr >>= \(CInitList xs _) -> Just xs) (v:vs) of
@@ -623,11 +629,11 @@ grokStatement fe (CBlockDecl (CDecl (t:ts) (v:vs) _)) = do
623 return Computation 629 return Computation
624 { compFree = Map.empty 630 { compFree = Map.empty
625 , compIntro = Map.empty 631 , compIntro = Map.empty
626 , comp = Lambda () [hspvar "go"] $ hsvar "go" 632 , comp = FormalLambda "go" $ hsvar "go"
627 } 633 }
628 initials -> do 634 initials -> do
629 gs <- mapM (grokInitialization fe $ t:ts) initials 635 gs <- mapM (grokInitialization fe $ t:ts) initials
630 return $ fmap (\exp -> Lambda () [hspvar "go"] exp) 636 return $ fmap (FormalLambda "go")
631 $ foldr applyComputation (Computation Map.empty Map.empty (hsvar "go")) gs 637 $ foldr applyComputation (Computation Map.empty Map.empty (hsvar "go")) gs
632grokStatement fe _ = Nothing 638grokStatement fe _ = Nothing
633 639
@@ -772,7 +778,7 @@ transpile o fname incs (CTranslUnit edecls _) = do
772 case grokStatement fe d of 778 case grokStatement fe d of
773 779
774 Just hd -> do putStrLn $ "fr: " ++ intercalate " " (Map.keys (compFree hd)) 780 Just hd -> do putStrLn $ "fr: " ++ intercalate " " (Map.keys (compFree hd))
775 putStrLn $ "HS: " ++ HS.prettyPrint (comp hd) 781 putStrLn $ "HS: " ++ HS.prettyPrint (informalize $ comp hd)
776 782
777 Nothing -> putStrLn $ "??: " ++ ppShow (cleanTree d) 783 Nothing -> putStrLn $ "??: " ++ ppShow (cleanTree d)
778 putStrLn "" 784 putStrLn ""