通过api将表达式发送到ghci进行评估和打印结果的最简单的例子是什么?我无法找到一个可行的完整示例。是的,我已经尝试了https://wiki.haskell.org/GHC/As_a_library,但我一直收到的错误并没有告诉我多少:setSessionDynFlags
。无论我在哪里尝试使用任何参数setContext
,或setXYZ
,我总是会遇到错误。我目前有(没有import GHC
import GHC.Paths ( libdir )
import GhcMonad
import Debugger
import DynFlags
import Outputable
import Language.Haskell.HsColour
import Language.Haskell.HsColour.Colourise
colour :: String -> String
colour = hscolour TTY defaultColourPrefs True True "" False
ghci :: IO ()
ghci = runGhc (Just libdir) $ do
r <- runStmt "[1, 2, 3]" RunToCompletion
case r of
RunOk ns -> do
mapM_ ( \n -> do
mty <- lookupName n
case mty of
Just (AnId id) -> do
t <- obtainTermFromId maxBound True id
fl <- getSessionDynFlags
liftIO $ putStrLn $ colour $ show $ withPprStyleDoc fl defaultUserStyle $ ppr t
return ()
otherwise -> return ()
) ns
otherwise -> return ()
main :: IO ()
main = ghci
):
SELECT (COUNT(*)-(COUNT(*)%3)) FROM tbl_name INTO @lim;
SELECT @rownum := 0;
SELECT t.*, @rownum := @rownum + 1 AS rowno FROM tbl_name t WHERE rowno <= @lim;
答案 0 :(得分:1)
所以当我在 tv1.setText(ccObj1.getIssuer() + "\n"
+ccObj1.getName()+"\n"
+ccObj1.getCardnum()+"\n"
+ccObj1.getExpire()+"\n"
+Double.toString(ccObj1.getBal())+"\n"
+Double.toString(ccObj1.getLimit()+"\n");
表达式的开头添加此初始化时,我的问题就解决了:{/ 1}}
SELECT * FROM myTab WHERE TO_CHAR(startDate,'dd.mm.yyyy') LIKE '%01.2015'