gpt4 book ai didi

haskell - 为什么我无法导入模块?

转载 作者:行者123 更新时间:2023-12-02 10:47:36 25 4
gpt4 key购买 nike


大家好

我不明白为什么在导入 Data.Char 库后尝试导入模块时会出现此类错误?实际上,当我删除模块测试时,一切正常

enter image description here

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

提前致谢

最佳答案

导入在模块之后进行,而不是之前。 模块名称,其中应该是第一件事,前面可能只包含语言扩展和编译器标志:

module Test where
import Data.Char

关于haskell - 为什么我无法导入模块?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61130348/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com