相关疑难解决方法(0)

Haskell编译器错误:不在范围内

我试图通过编写一个简单的文件副本util来学习haskell:

main = do
         putStr "Source: "
         srcPath <- getLine
         putStr "Destination: "
         destPath <- getLine
         putStrLn ("Copying from " ++ srcPath ++ " to " ++ destPath ++ "...")
         contents <- readFile srcPath
         writeFile destPath contents
         putStrLn "Finished"
Run Code Online (Sandbox Code Playgroud)

这让我感到高兴

GHCi, version 6.10.4: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done. 
[1 of 1] Compiling Main             ( D:\Test.hs, interpreted )

D:\Test.hs:8:22: Not in …
Run Code Online (Sandbox Code Playgroud)

haskell

3
推荐指数
1
解决办法
2万
查看次数

不可见的压痕错误导致GHCi中的负载故障

我遇到了棘手的缩进造成的问题,这里的代码看起来 是VI:

  1 import Data.List
  2 myQuickSort [] = []
  3 myQuickSort (x:xs) = myQuickSort smaller ++ [x] ++ myQuickSort bigger
  4     where   smaller = filter ( < x ) xs
  5             bigger  = filter ( >=x ) xs
Run Code Online (Sandbox Code Playgroud)

但是在./cat 3.hs之后,看起来,

root@pierr-desktop:/opt/playGround/haskell# cat 3.hs 
import Data.List
myQuickSort [] = []
myQuickSort (x:xs) = myQuickSort smaller ++ [x] ++ myQuickSort bigger
    where   smaller = filter ( < x ) xs
                    bigger  = filter ( >=x ) xs
Run Code Online (Sandbox Code Playgroud)

然后将其加载到ghci中

GHCi, version …
Run Code Online (Sandbox Code Playgroud)

syntax haskell

0
推荐指数
1
解决办法
358
查看次数

标签 统计

haskell ×2

syntax ×1