为什么我不能导入模块?

费多


大家好

我不明白为什么在导入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] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

为什么我不能导入上层模块或函数?

为什么python不能导入我创建的模块?

为什么我不能在PyCharm中导入两个模块?

为什么我不能在同一个模块中导入包?

为什么我不能导入pkg“ builtin”?

为什么我不能导入sun包?

为什么我不能导入张量流

为什么我不能导入sun包?

为什么我不能导入 ciphersweet StringProvider

为什么我不能导入ABC但正确导入了ABCMeta?

为什么不能在sys.path中导入模块?

为什么不能在Deno REPL内导入模块?

为什么不能在标准JavaScript中导入模块?

为什么我的Azure PowerShell任务脚本可以使用查找模块找到模块,而不能使用导入模块找到模块?

为什么我的PowerShell模块不能正确导出成员,为什么不能导出嵌套模块?

为什么我不能将@WithMockUser导入我的测试

已经设置了 PYTHONPATH,但是为什么它不能在 Python 中导入我的自定义模块?

为什么我不能多次导入一个变量?

为什么我不能导入点子列表中的库?

为什么我不能正确导入facebook SDK?

为什么我不能从mplfinance导入Candlestick_ohlc

为什么我不能在Python中导入包?

为什么我不能从 Pydantic 导入 BaseModel?

为什么我不能将语义导入反应组件

为什么我不能在Anaconda上导入pygame?

为什么我不能从文件中导入 React 组件?

为什么我不能导入“ androidx.core.app.NotificationChannelCompat”?

为什么导入模块会破坏我的doctest(Python 2.7)

为什么多处理Julia会中断我的模块导入?