summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2019-03-10 19:42:22 -0400
committerJoe Crayne <joe@jerkface.net>2019-03-10 19:42:22 -0400
commitef0bd9baee906ebf7c3293f0e5ec531bca0b4801 (patch)
tree9347d3cb5f0b5b1ad05f51da37c0a907708ccff7
parente34407b0080fa5c7176522b42783ad3c55a0f722 (diff)
* getsig: Keep original c-names for haskell types.
* Remove trailing closer from comment parser result. * Upper bound for base dependency.
-rw-r--r--monkeypatch.cabal2
-rw-r--r--monkeypatch.hs104
2 files changed, 77 insertions, 29 deletions
diff --git a/monkeypatch.cabal b/monkeypatch.cabal
index 4c66cb7..21146e4 100644
--- a/monkeypatch.cabal
+++ b/monkeypatch.cabal
@@ -54,7 +54,7 @@ executable monkeypatch
54 main-is: monkeypatch.hs 54 main-is: monkeypatch.hs
55 -- other-modules: 55 -- other-modules:
56 -- other-extensions: 56 -- other-extensions:
57 build-depends: base ^>=4.10.1.0 57 build-depends: base >=4.10.1.0 && <=4.12
58 , containers ^>=0.5.10.2 58 , containers ^>=0.5.10.2
59 , language-c 59 , language-c
60 , haskell-src-exts 60 , haskell-src-exts
diff --git a/monkeypatch.hs b/monkeypatch.hs
index 7c9d75d..ac67afa 100644
--- a/monkeypatch.hs
+++ b/monkeypatch.hs
@@ -1,17 +1,18 @@
1{-# LANGUAGE OverloadedStrings #-}
2{-# LANGUAGE BangPatterns #-} 1{-# LANGUAGE BangPatterns #-}
3{-# LANGUAGE DeriveFunctor #-} 2{-# LANGUAGE DeriveFunctor #-}
4{-# LANGUAGE FlexibleContexts #-} 3{-# LANGUAGE FlexibleContexts #-}
5{-# LANGUAGE LambdaCase #-} 4{-# LANGUAGE LambdaCase #-}
6{-# LANGUAGE NondecreasingIndentation #-} 5{-# LANGUAGE NondecreasingIndentation #-}
6{-# LANGUAGE OverloadedStrings #-}
7{-# LANGUAGE QuasiQuotes #-} 7{-# LANGUAGE QuasiQuotes #-}
8{-# LANGUAGE TemplateHaskell #-} 8{-# LANGUAGE TemplateHaskell #-}
9{-# LANGUAGE TupleSections #-}
9module Main where 10module Main where
10 11
11import Control.Arrow (left) 12import Control.Arrow (left,first,second)
12import Data.Generics.Aliases 13import Data.Generics.Aliases
13import Data.Generics.Schemes 14import Data.Generics.Schemes
14-- import Debug.Trace 15import Debug.Trace
15import Control.Monad 16import Control.Monad
16import qualified Data.ByteString.Char8 as B 17import qualified Data.ByteString.Char8 as B
17import Data.Char 18import Data.Char
@@ -45,7 +46,7 @@ import Text.PrettyPrint (Doc, doubleQuotes, empty, text, vcat, ($$),
45 (<+>)) 46 (<+>))
46import Text.Show.Pretty 47import Text.Show.Pretty
47 48
48trace _ = id 49-- trace _ = id
49 50
50-- | Pretty print the given tranlation unit, but replace declarations from header files with @#include@ directives. 51-- | Pretty print the given tranlation unit, but replace declarations from header files with @#include@ directives.
51-- 52--
@@ -247,16 +248,19 @@ hsTransField :: Show b =>
247 [CDeclarationSpecifier b] -- c structure name 248 [CDeclarationSpecifier b] -- c structure name
248 -- -> [(Maybe (CDeclarator b), Maybe (CInitializer b), Maybe (CExpression b))] -- c variable declarations 249 -- -> [(Maybe (CDeclarator b), Maybe (CInitializer b), Maybe (CExpression b))] -- c variable declarations
249 -> [CDeclarator b] -- c variable declarations 250 -> [CDeclarator b] -- c variable declarations
250 -> [(String{-field name-}, HS.Type () {- haskell type -}) ] 251 -> [ ( (String{-field name-}, HS.Type () {- haskell type -})
252 , Maybe String{- c type -})]
251hsTransField ctyps vars 253hsTransField ctyps vars
252 = do 254 = do
253 typname <- hsMkName . either (capitalize . identToString) id <$> (hsTypeSpec =<< ctyps) 255 (mcname,typname) <- second hsMkName . either ((\s -> (Just s,capitalize s)) . identToString)
256 (Nothing,)
257 <$> (hsTypeSpec =<< ctyps)
254 trace ("typname="++show typname) $ return () 258 trace ("typname="++show typname) $ return ()
255 -- (var,Nothing,Nothing) <- vars 259 -- (var,Nothing,Nothing) <- vars
256 var <- vars 260 var <- vars
257 trace ("var="++show var) $ return () 261 trace ("var="++show var) $ return ()
258 -- CDeclr (Just fident) ptrdeclr Nothing [] _ <- maybeToList var 262 -- CDeclr (Just fident) ptrdeclr Nothing [] _ <- maybeToList var
259 let CDeclr mfident ptrdeclr Nothing [] _ = var -- TODO: Look into: Irrefutable pattern failed (ctox/toxcore/DHT.c) 263 let CDeclr mfident ptrdeclr Nothing ignored_attrs _ = var -- TODO: Look into: Irrefutable pattern failed (ctox/toxcore/DHT.c)
260 -- let CDeclr mfident ptrdeclr _ _ _ = var 264 -- let CDeclr mfident ptrdeclr _ _ _ = var
261 trace ("fident="++show mfident) $ return () 265 trace ("fident="++show mfident) $ return ()
262 trace ("ptrdeclr="++show ptrdeclr) $ return () 266 trace ("ptrdeclr="++show ptrdeclr) $ return ()
@@ -265,7 +269,7 @@ hsTransField ctyps vars
265 [] -> b 269 [] -> b
266 (CPtrDeclr [] _:cs) -> HS.TyApp () (HS.TyCon () (hsMkName "Ptr")) (grok cs b) 270 (CPtrDeclr [] _:cs) -> HS.TyApp () (HS.TyCon () (hsMkName "Ptr")) (grok cs b)
267 CFunDeclr (Right (args,flg)) attrs _:p -> 271 CFunDeclr (Right (args,flg)) attrs _:p ->
268 let (as,ts) = unzip $ concatMap (\(CDecl rs as _) -> hsTransField rs $ concatMap fieldInfo as) args 272 let (as,ts) = unzip $ concatMap (\(CDecl rs as _) -> map fst $ hsTransField rs $ concatMap fieldInfo as) args
269 b0 = case p of 273 b0 = case p of
270 CPtrDeclr [] _:cs -> HS.TyApp () (HS.TyCon () (hsMkName "Ptr")) (grok cs b) 274 CPtrDeclr [] _:cs -> HS.TyApp () (HS.TyCon () (hsMkName "Ptr")) (grok cs b)
271 [] -> b 275 [] -> b
@@ -273,7 +277,7 @@ hsTransField ctyps vars
273 _ -> HS.TyCon () (hsMkName $ show $ map (fmap (const ())) ptrdeclr) 277 _ -> HS.TyCon () (hsMkName $ show $ map (fmap (const ())) ptrdeclr)
274 ftyp = grok ptrdeclr btyp 278 ftyp = grok ptrdeclr btyp
275 fieldName = maybe ("_") identToString mfident 279 fieldName = maybe ("_") identToString mfident
276 [ ( fieldName, ftyp ) ] 280 [ ( ( fieldName, ftyp ), mcname ) ]
277{- 281{-
278transField (CDecl [CTypeSpec (CSUType (CStruct CStructTag mctyp Nothing [] _) _)] vars _) 282transField (CDecl [CTypeSpec (CSUType (CStruct CStructTag mctyp Nothing [] _) _)] vars _)
279 | Just typname <- mkName . capitalize . identToString <$> mctyp 283 | Just typname <- mkName . capitalize . identToString <$> mctyp
@@ -302,16 +306,23 @@ hsTransFieldExt :: Show b =>
302hsTransFieldExt :: Show b => 306hsTransFieldExt :: Show b =>
303 [CDeclarationSpecifier b] -> [CDeclarator b] -> [Decl ()] 307 [CDeclarationSpecifier b] -> [CDeclarator b] -> [Decl ()]
304hsTransFieldExt rs as = concatMap (\(fieldName,ftyp)-> [ HS.TypeSig () [ HS.Ident () fieldName ] ftyp ]) 308hsTransFieldExt rs as = concatMap (\(fieldName,ftyp)-> [ HS.TypeSig () [ HS.Ident () fieldName ] ftyp ])
305 $ hsTransField rs as 309 $ map fst $ hsTransField rs as
306 310
307hsTransSig rs as = concatMap (\(fieldName,ftyp)-> [ HS.TypeDecl () (DHead () (HS.Ident () ("Sig_" ++ fieldName))) ftyp ]) 311hsTransSig :: Show b =>
312 [CDeclarationSpecifier b] -> [CDeclarator b] -> [(Decl (),Maybe String)]
313hsTransSig rs as = map (\((fieldName,ftyp),ctyp) -> ( HS.TypeDecl () (DHead () (HS.Ident () ("Sig_" ++ fieldName))) ftyp, ctyp ))
308 $ hsTransField rs as 314 $ hsTransField rs as
309 315
316-- Extract argument types from a haskell function type declaration.
317types :: Decl l -> [HS.Type l]
310types (HS.TypeDecl _ _ typ) = primtypes typ 318types (HS.TypeDecl _ _ typ) = primtypes typ
311 319
320primtypes :: HS.Type l -> [HS.Type l]
312primtypes (HS.TyFun _ a b) = primtypes a ++ primtypes b 321primtypes (HS.TyFun _ a b) = primtypes a ++ primtypes b
313primtypes t = [t] 322primtypes t = [t]
314 323
324-- Haskell type name as string.
325tname :: HS.Type () -> String
315tname (HS.TyCon () (HS.UnQual () (HS.Ident () str))) = str 326tname (HS.TyCon () (HS.UnQual () (HS.Ident () str))) = str
316tname _ = "_unkonwn" 327tname _ = "_unkonwn"
317 328
@@ -324,12 +335,15 @@ pointers decls = do
324 d <- decls 335 d <- decls
325 maybeToList $ getPtrType d 336 maybeToList $ getPtrType d
326 337
338-- If it's a haskell Ptr type, then return the pointed type.
339-- Otherwise, no op.
340unpointer :: HS.Type l -> HS.Type l
327unpointer t = case getPtrType t of 341unpointer t = case getPtrType t of
328 Nothing -> t 342 Nothing -> t
329 Just t' -> t' 343 Just t' -> t'
330 344
331-- sig :: Show t => CExternalDeclaration t -> [HS.Decl ()] 345-- sig :: Show t => CExternalDeclaration t -> [HS.Decl ()]
332sig :: CExternalDeclaration NodeInfo -> [Decl ()] 346sig :: CExternalDeclaration NodeInfo -> [HS.Decl ()]
333sig = sigf hsTransFieldExt 347sig = sigf hsTransFieldExt
334 348
335-- • Couldn't match expected type ‘CDerivedDeclarator a -> (Maybe (CDeclarator a), Maybe (CInitializer a), Maybe (CExpression a))’ 349-- • Couldn't match expected type ‘CDerivedDeclarator a -> (Maybe (CDeclarator a), Maybe (CInitializer a), Maybe (CExpression a))’
@@ -422,13 +436,21 @@ parseOptions ("-v":args) opts = parseOptions args opts
422 } 436 }
423parseOptions as x = error (show as) 437parseOptions as x = error (show as)
424 438
439tnames d = filter (notKnown . fst) $ map (first $ tname . unpointer) $ concatMap (\(t,c) -> map (,c) (types t)) $ sigf hsTransSig d
440
441
442getsig :: (a, SymbolInformation [CExternalDeclaration NodeInfo])
443 -> [([(String,Maybe String)] -- List of haskell/c type names to define
444 , ( a
445 , [Decl ()] -- haskell declaration
446 , CExternalDeclaration NodeInfo))] -- c declaration (with fixups)
425getsig (k,si) = do 447getsig (k,si) = do
426 d0 <- take 1 $ symbolSource si 448 d0 <- take 1 $ symbolSource si
427 let d = case getArgList d0 of 449 let d = case getArgList d0 of
428 oargs:xs -> let args = fst $ makeParameterNames oargs 450 oargs:xs -> let args = fst $ makeParameterNames oargs
429 in changeArgList (const $ args:xs) d0 451 in changeArgList (const $ args:xs) d0
430 _ -> d0 452 _ -> d0
431 ts = filter notKnown $ map tname $ map unpointer $ concatMap types $ sigf hsTransSig d 453 ts = tnames d
432 s = sig d 454 s = sig d
433 [(ts,(k,s,d))] 455 [(ts,(k,s,d))]
434 456
@@ -452,11 +474,17 @@ makeAcceptableImport (HS.TyFun a (TyCon c (UnQual d (HS.Ident e x))) xs)
452 = (HS.TyFun a (TyApp c (TyCon c (UnQual d (HS.Ident e "Ptr"))) (TyCon e (UnQual e (HS.Ident e x)))) (makeAcceptableImport xs)) 474 = (HS.TyFun a (TyApp c (TyCon c (UnQual d (HS.Ident e "Ptr"))) (TyCon e (UnQual e (HS.Ident e x)))) (makeAcceptableImport xs))
453makeAcceptableImport t = t 475makeAcceptableImport t = t
454 476
477enumCases (CDeclExt (CDecl xs _ ni)) = do
478 CTypeSpec (CEnumType (CEnum _ (Just cs))) <- xs
479 return (ni,cs)
480
481
455-- c2haskell :: Foldable t => C2HaskellOptions -> p -> t String -> CTranslationUnit NodeInfo -> IO () 482-- c2haskell :: Foldable t => C2HaskellOptions -> p -> t String -> CTranslationUnit NodeInfo -> IO ()
456c2haskell :: C2HaskellOptions 483c2haskell :: C2HaskellOptions
457 -> p1 -> FilePath -> [String] -> IncludeStack -> CTranslationUnit NodeInfo -> IO () 484 -> p1 -> FilePath -> [String] -> IncludeStack -> CTranslationUnit NodeInfo -> IO ()
458c2haskell opts cs cmodname missings incs (CTranslUnit edecls _) = do 485c2haskell opts cs cmodname missings incs (CTranslUnit edecls _) = do
459 let db = foldr update initTranspile edecls 486 let db = foldr update initTranspile edecls
487 {- exported symbols in this module -}
460 es = Map.filter (\d -> symbolLocal d && not (symbolStatic d)) (syms db) 488 es = Map.filter (\d -> symbolLocal d && not (symbolStatic d)) (syms db)
461 case selectFunction opts of 489 case selectFunction opts of
462 Nothing -> do 490 Nothing -> do
@@ -475,18 +503,28 @@ c2haskell opts cs cmodname missings incs (CTranslUnit edecls _) = do
475 hPutStrLn haskmod $ "import Data.Int" 503 hPutStrLn haskmod $ "import Data.Int"
476 putStrLn $ "-- " ++ show (fmap (fmap (fmap (const ()))) <$> Map.lookup "ip_is_lan" (syms db)) 504 putStrLn $ "-- " ++ show (fmap (fmap (fmap (const ()))) <$> Map.lookup "ip_is_lan" (syms db))
477 let sigs = concatMap getsig (Map.toList es) 505 let sigs = concatMap getsig (Map.toList es)
506 {- referenced haskell type names by missing symbols -}
478 sigs2 = concatMap (\s -> do 507 sigs2 = concatMap (\s -> do
479 x <- maybeToList $ Map.lookup s (syms db) 508 x <- maybeToList $ Map.lookup s (syms db)
480 (y,_) <- getsig (s,x) 509 (y,_) <- getsig (s,x)
481 y) 510 y)
482 missings 511 missings
512 {- referenced haskell type names by all exported symbols -}
483 ts = concatMap fst sigs 513 ts = concatMap fst sigs
484 putStrLn $ "-- IP `elem` db = " ++ show (length . symbolSource <$> Map.lookup "IP" (syms db)) 514 hPutStrLn haskmod ""
485 putStrLn $ "-- IP `elem` sigs2 = " ++ show (elem "IP" sigs2) 515 forM_ (uniq $ ts ++ sigs2) $ \(t,ct) -> do
486 putStrLn $ "-- ip_is_lan `elem` db = " ++ show (length . symbolSource <$> Map.lookup "ip_is_lan" (syms db)) 516 case ct >>= (`Map.lookup` syms db) of
487 putStrLn $ "-- ip_is_lan `elem` sigs2 = " ++ show (elem "ip_is_lan" sigs2) 517 Just si -> do
488 forM_ (uniq $ ts ++ sigs2) $ \t -> do 518 let symfile :: Maybe FilePath
519 symfile = (listToMaybe (symbolSource si) >>= fileOfNode)
520 hPutStrLn haskmod $ "-- " ++ show symfile
521 mapM_ (hPutStrLn haskmod . commented . show . pretty) $ symbolSource si
522 cs <- maybe (return []) readComments symfile
523 mapM_ (hPutStrLn haskmod . commented . ppShow) $ cs
524 mapM_ (hPutStrLn haskmod . commented . ppShow) $ symbolSource si
525 Nothing -> return ()
489 hPutStrLn haskmod $ "data " ++ t 526 hPutStrLn haskmod $ "data " ++ t
527 hPutStrLn haskmod ""
490 forM_ sigs $ \(_,(k,hs,d)) -> do 528 forM_ sigs $ \(_,(k,hs,d)) -> do
491 forM_ hs $ \hdecl -> do 529 forM_ hs $ \hdecl -> do
492 {- 530 {-
@@ -634,11 +672,18 @@ getArgList1 (CDeclr a xs b c d) = xs
634 672
635getArgList2 ((a,b,c):zs) = getArgList3 a 673getArgList2 ((a,b,c):zs) = getArgList3 a
636 674
675getArgList3 (Just (CDeclr a [CPtrDeclr [] _] b c d)) = [] -- struct prototype, no fields.
637getArgList3 (Just (CDeclr a x b c d)) = x 676getArgList3 (Just (CDeclr a x b c d)) = x
638 677
678getArgList_ :: CExternalDeclaration a -> [CDerivedDeclarator a]
679getArgList_ (CFDefExt (CFunDef xs ys zs c d)) = getArgList1 ys
680getArgList_ (CDeclExt (CDecl xs ys pos)) = getArgList2 ys
681
639getArgList :: CExternalDeclaration a -> [CDerivedDeclarator a] 682getArgList :: CExternalDeclaration a -> [CDerivedDeclarator a]
640getArgList (CFDefExt (CFunDef xs ys zs c d)) = getArgList1 ys 683getArgList x = let v=getArgList_ x in trace ("getArgList ("++show (u x)++") = "++show (fmap u v)) v
641getArgList (CDeclExt (CDecl xs ys pos)) = getArgList2 ys 684 where
685 u :: Functor f => f a -> f ()
686 u = fmap (const ())
642 687
643changeReturnValue f (CFDefExt (CFunDef xs ys zs c d)) = (CFDefExt (CFunDef (f xs) ys zs c d)) 688changeReturnValue f (CFDefExt (CFunDef xs ys zs c d)) = (CFDefExt (CFunDef (f xs) ys zs c d))
644changeReturnValue f (CDeclExt (CDecl xs ys pos)) = (CDeclExt (CDecl (f xs) ys pos)) 689changeReturnValue f (CDeclExt (CDecl xs ys pos)) = (CDeclExt (CDecl (f xs) ys pos))
@@ -686,6 +731,8 @@ makeParameterNames (CFunDeclr (Right (ps, flg)) z2 z3) = case ps of
686 mkp num (CDecl rtyp [] n) 731 mkp num (CDecl rtyp [] n)
687 = (CDecl rtyp ((Just (CDeclr (Just $ mkidn num undefNode) [] Nothing [] n),Nothing,Nothing):[]) n) 732 = (CDecl rtyp ((Just (CDeclr (Just $ mkidn num undefNode) [] Nothing [] n),Nothing,Nothing):[]) n)
688 mkp num p = p 733 mkp num p = p
734-- CPtrDeclr [] ()
735makeParameterNames x = error $ "makeParameterNames " ++ show (fmap (const ()) x)
689 736
690expr :: CDeclaration a -> CExpression a 737expr :: CDeclaration a -> CExpression a
691expr (CDecl rtyp ((Just (CDeclr (Just i) typ x ys z),a,b):xs) n) = CVar i n 738expr (CDecl rtyp ((Just (CDeclr (Just i) typ x ys z),a,b):xs) n) = CVar i n
@@ -777,9 +824,9 @@ goMissing haskmod db cfun = do
777 oargs:xs -> let args = fst $ makeParameterNames oargs 824 oargs:xs -> let args = fst $ makeParameterNames oargs
778 in changeArgList (const $ args:xs) d0 825 in changeArgList (const $ args:xs) d0
779 _ -> d0 826 _ -> d0
780 let ts = filter notKnown $ map tname $ pointers $ concatMap types $ sigf hsTransSig d 827 let ts = tnames d
781 -- forM_ ts $ \t -> putStrLn $ "data " ++ t 828 -- forM_ ts $ \(t,_) -> putStrLn $ "data " ++ t
782 forM_ (sigf hsTransSig d) $ \hs -> do 829 forM_ (sigf hsTransSig d) $ \(hs,ctypname) -> do
783 hPutStrLn haskmod . HS.prettyPrint $ makeAcceptableDecl hs 830 hPutStrLn haskmod . HS.prettyPrint $ makeAcceptableDecl hs
784 case hs of 831 case hs of
785 HS.TypeDecl _ (DHead _ (HS.Ident _ signame)) ftyp -> do 832 HS.TypeDecl _ (DHead _ (HS.Ident _ signame)) ftyp -> do
@@ -810,8 +857,7 @@ goMissing haskmod db cfun = do
810 htyp -> hPutStr haskmod $ commented $ "Unsupported haskell type: " ++ HS.prettyPrint htyp 857 htyp -> hPutStr haskmod $ commented $ "Unsupported haskell type: " ++ HS.prettyPrint htyp
811 858
812 859
813readComments :: (Num lin, Num col) => 860readComments :: (Num lin, Num col) => FilePath -> IO [(lin, col, [Char])]
814 FilePath -> IO [(lin, col, [Char])]
815readComments fname = parseComments 1 1 <$> readFile fname 861readComments fname = parseComments 1 1 <$> readFile fname
816 862
817findCloser :: (Num a4, Num a3, Num a2, Num a1, Eq a1) => 863findCloser :: (Num a4, Num a3, Num a2, Num a1, Eq a1) =>
@@ -829,7 +875,9 @@ mkComment lin no str = (lin,no,str)
829parseComments :: (Num col, Num lin) => lin -> col -> [Char] -> [(lin, col, [Char])] 875parseComments :: (Num col, Num lin) => lin -> col -> [Char] -> [(lin, col, [Char])]
830parseComments !lin !col = \case 876parseComments !lin !col = \case
831 ('/':'*':cs) -> let (lcnt,col',bcnt) = findCloser 1 (0,col,0) cs 877 ('/':'*':cs) -> let (lcnt,col',bcnt) = findCloser 1 (0,col,0) cs
832 (xs,cs') = splitAt bcnt cs 878 (xs,cs') = case drop (bcnt-2) cs of
879 '*':'/':_ -> second (drop 2) $ splitAt (bcnt-2) cs
880 _ -> splitAt bcnt cs
833 in mkComment lin col xs : parseComments (lin + lcnt) col' cs' 881 in mkComment lin col xs : parseComments (lin + lcnt) col' cs'
834 ('/':'/':cs) -> let (comment,ds) = break (=='\n') cs 882 ('/':'/':cs) -> let (comment,ds) = break (=='\n') cs
835 in mkComment lin col comment : parseComments (lin + 1) 1 cs 883 in mkComment lin col comment : parseComments (lin + 1) 1 cs
@@ -938,7 +986,7 @@ main = do
938 return (includeStack pre,c) 986 return (includeStack pre,c)
939 -- putStrLn $ "fname = " ++ fname 987 -- putStrLn $ "fname = " ++ fname
940 -- putStrLn $ "includes = " ++ ppShow (fmap fst r) 988 -- putStrLn $ "includes = " ++ ppShow (fmap fst r)
941 cs <- readComments fname 989 -- cs <- readComments fname
942 case () of 990 case () of
943 _ | preprocess hopts -- --cpp 991 _ | preprocess hopts -- --cpp
944 -> do 992 -> do
@@ -953,4 +1001,4 @@ main = do
953 putStrLn $ ppShow $ everywhere (mkT eraseNodeInfo) . snd <$> r 1001 putStrLn $ ppShow $ everywhere (mkT eraseNodeInfo) . snd <$> r
954 _ -> do 1002 _ -> do
955 syms <- linker (cargs ++ reverse fs) fname 1003 syms <- linker (cargs ++ reverse fs) fname
956 either print (uncurry $ c2haskell hopts cs fname syms) r 1004 either print (uncurry $ c2haskell hopts () fname syms) r