Haskell错误:“缺少伴随的结合”和“不在范围内” [英] Haskell errors: "lacks an accompanying binding" and "not in scope"

查看:677
本文介绍了Haskell错误:“缺少伴随的结合”和“不在范围内”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一段代码:

I have created a piece of code this:

intToDigit :: Char -> Int
ord :: Char -> Int
intToDigit c = ord c - ord 'a'

我收到此错误消息:


ChangeVowels.hs:2:1:
`ord'的类型签名缺少伴随绑定

ChangeVowels.hs:2:1: The type signature for `ord' lacks an accompanying binding

ChangeVowels.hs:4:16:不在作用域:`ord'

ChangeVowels.hs:4:16: Not in scope: `ord'

ChangeVowels.hs: 4:24:不在范围:`ord'

ChangeVowels.hs:4:24: Not in scope: `ord'

我尝试使用 Import data.char 但是这不工作。

I tried it with Import data.char but that doesnt work either.

推荐答案

您需要提供函数 ord

这篇关于Haskell错误:“缺少伴随的结合”和“不在范围内”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆