【发布时间】:2022-01-26 03:31:56
【问题描述】:
:i fromSql
fromSql ::
convertible-1.1.1.0:Data.Convertible.Base.Convertible SqlValue a =>
SqlValue -> a
-- Defined in ‘Database.HDBC.SqlValue’
如果我运行例如 map fromSql (EXAMPLESQL) 它输出正常。但如果我将其重新定义为 readCol = map fromSql 我会收到错误消息:
readCol = map fromSql
<interactive>:23:1: error:
• Non type-variable argument
in the constraint: convertible-1.1.1.0:Data.Convertible.Base.Convertible
SqlValue b
(Use FlexibleContexts to permit this)
• When checking the inferred type
readCol :: forall b.
convertible-1.1.1.0:Data.Convertible.Base.Convertible SqlValue b =>
[SqlValue] -> [b]
如何解决?
【问题讨论】:
-
按照建议,启用 FlexibleContexts。它是非常可靠和值得信赖的扩展。我认为它肯定会被整合到即将发布的 haskell 报告中。
-
谢谢。我已经相应地设置了解决方案。解决方案在这里stackoverflow.com/questions/21375556/…