如何处理内部文本模块的编译错误?
How to approach compilation errors with internal Text modules?
我有这个问题:
Couldn't match expected type ‘case-insensitive-1.2.0.5:Data.CaseInsensitive.Internal.CI
Text’
with actual type ‘Text’
In the first argument of ‘named’, namely ‘n’
因为:
Prelude Text.XML.Lens> :t named
named
:: Applicative f =>
case-insensitive-1.2.0.5:Data.CaseInsensitive.Internal.CI
Data.Text.Internal.Text
-> (Element -> f Element) -> Element -> f Element
我的代码导入 Data.Text
并依赖于 OverloadedStrings
。我应该采取什么步骤来解决此类问题?什么是短期修复和长期修复?
感谢评论者,因为我能够找出我遇到这个问题的原因。
简短回答:密切注意类型并确保您理解它们(阅读您在错误消息中看到的任何模块的文档)。
长答案:
请注意,该类型包含空格,GHC
可能会将它们分解为多行。 CI.Text
的意思不同于 CI Text
。
‘case-insensitive-1.2.0.5:Data.CaseInsensitive.Internal.CI
Text’
Text
这里不是 re-exported 内部 Text
的类型同义词(库中的常见做法)。 CI
是一个类型构造函数,您无法导入它(出于某种原因 - 您必须停下来阅读您接触的任何内容的文档)。你会明白为什么你可以像 mk
那样导入 CI
type 和 smart-constructors
。
我有这个问题:
Couldn't match expected type ‘case-insensitive-1.2.0.5:Data.CaseInsensitive.Internal.CI
Text’
with actual type ‘Text’
In the first argument of ‘named’, namely ‘n’
因为:
Prelude Text.XML.Lens> :t named
named
:: Applicative f =>
case-insensitive-1.2.0.5:Data.CaseInsensitive.Internal.CI
Data.Text.Internal.Text
-> (Element -> f Element) -> Element -> f Element
我的代码导入 Data.Text
并依赖于 OverloadedStrings
。我应该采取什么步骤来解决此类问题?什么是短期修复和长期修复?
感谢评论者,因为我能够找出我遇到这个问题的原因。
简短回答:密切注意类型并确保您理解它们(阅读您在错误消息中看到的任何模块的文档)。
长答案:
请注意,该类型包含空格,GHC
可能会将它们分解为多行。 CI.Text
的意思不同于 CI Text
。
‘case-insensitive-1.2.0.5:Data.CaseInsensitive.Internal.CI
Text’
Text
这里不是 re-exported 内部 Text
的类型同义词(库中的常见做法)。 CI
是一个类型构造函数,您无法导入它(出于某种原因 - 您必须停下来阅读您接触的任何内容的文档)。你会明白为什么你可以像 mk
那样导入 CI
type 和 smart-constructors
。