我可以使用以下脚本启动Excel.但是在ghci(7.4.1)中,当我运行它时会出现分段错误.
我不知道从哪里开始搜索.如果删除该行,我没有此错误
workSheets <- workBook # propertyGet_0 "Worksheets"
Run Code Online (Sandbox Code Playgroud)
这是代码.可能是我忘记了什么.我在这里阅读了com.hs的源代码,但它没有给我任何线索.
import System.Win32.Com
import System.Win32.Com.Automation
--
-- createObjectExcel
-- coming from Automation.hs and com.hs
--
iidIDispatch_unsafe = mkIID "{00020400-0000-0000-C000-000000000046}"
createObjExl :: IO (IDispatch ())
createObjExl = do
clsidExcel <- clsidFromProgID "Excel.Application"
pExl <- coCreateInstance clsidExcel Nothing LocalProcess iidIDispatch_unsafe
return pExl
fichierTest2 = "E:/Programmation/haskell/Com/qos1.xls"
main = coRun $ do
pExl <- createObjExl
workBooks <- pExl # propertyGet_0 "Workbooks"
workBook <- workBooks # propertyGet_1 "Open" fichierTest2
workSheets <- workBook # propertyGet_0 "Worksheets" …Run Code Online (Sandbox Code Playgroud) 我读了很好的24天的hackage.我想尝试一下包 配置器
我该如何检索数据列表
herlist = [1, "foo", true] ?
Run Code Online (Sandbox Code Playgroud) 我不明白为什么这段代码只循环一次然后退出?在Ghci我只能回答第一个循环,然后似乎变量cont设置为false,我没有提示回答.
结果是:
*Main> testLoop1 td10
test
Do you want to continue? (y/N)
y
we continue
test
Do you want to continue? (y/N)
We stop
Run Code Online (Sandbox Code Playgroud)
码:
type TDeckSTIO = StateT TableDecks IO
continue = do
putStrLn "Do you want to continue? (y/N)"
c <- getChar
return $ c == 'y'
loop1 :: TDeckSTIO ()
loop1 = do
liftIO $ putStrLn "test"
cont<- liftIO continue
if cont
then do
liftIO $ putStrLn "we continue"
liftIO $ testLoop1 td
else liftIO $ putStrLn …Run Code Online (Sandbox Code Playgroud) 我编写了一个函数来查找asciibox的下一列的位置,
例如:
+-----++---++---+
| a || b || c |
+-----++---++---+
Run Code Online (Sandbox Code Playgroud)
框b应从列"伪代码"{length(方框a)}开始,方框c应从伪代码{长方框a +长度方框b}开始
所以我写了这个功能
f:: [Int]->[Int]->[Int]
f (x:xs) [] = f xs [x]
f [] ys = ys
f (x:xs) ys = f xs (ys++[x+ last ys])
Run Code Online (Sandbox Code Playgroud)
这给了我想要的东西
f [23,24,25] []
ghci> [23,47,72]
Run Code Online (Sandbox Code Playgroud)
我想知道其他算法是否可行.有"折叠"或"展开"或者"迭代"的解决方案吗?
谢谢