大家好
我不明白为什么在导入Data.Char库后尝试导入模块时会出现此类错误?实际上,当我删除模块Test时一切正常
import Data.Char
module Test where
sayHello = putStrLn "Hello, world withoutCorona!"
lenVec3 x y z = sqrt ( x ^ 2 + y ^ 2 + z ^ 2 )
sign x = (if x > 0 then 1 else 0) + (if x < 0 then -1 else 0) + 0
twoDigits2Int x y = if isDigit x && isDigit y then digitToInt x * 10 + digitToInt y else 100
提前感谢
Haskell程序是一组模块。一个模块的语法结构为:
module-> module modid [exports] where正文 | 身体 身体-> {不客气; topdecls} | {impdecls} | {topdecls} modid-> conid impdecls-> impdecl 1 ; …;impdecl n (n> = 1) topdecls-> topdecl 1 ; …;topdecl n (n> = 1)
该import
声明是importdecls
在这个语法,从而部分body
。一个模块可以存在不具有module modid …
一部分,但如果我们定义一个模块标识符,那么这先于所述body
。
因此,您将这样的模块编写为:
module Test where
import Data.Char
-- …
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句