如何计算(> 0)的类型?

发布于 2025-02-10 01:19:43 字数 163 浏览 0 评论 0原文

每当我有一个左参数部分应用的操作员部分时,即:

(0 >)

我只是只需以其前缀形式重写操作员,然后进行计算:

(>) 0

我如何计算具有其参数部分应用?

Whenever I have an operator section with its left argument partially applied, i.e:

(0 >)

I just simply rewrite the operator in its prefix form and proceed with calculation:

(>) 0

How can I calculate the type of an operator section that has its right argument partially applied ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

断桥再见 2025-02-17 01:19:43

对于(>),这没关系,因为两个参数都具有相同的类型。删除ORD A =>来自ORD A => a - > a - > bool,您将留下ord A => a - >布尔

一般中,您只需删除与应用参数相对应的类型。例如,给定(??):: int-> char - >布尔

-- with the Int argument supplied, you still need a Char
(x ??) == (\y -> x ?? y) :: Char -> Bool
-- with the Char argument supplied, you still need an Int
(?? y) == (\x -> x ?? y) :: Int -> Bool

For (>), it doesn't matter, because both arguments have the same type. Remove either Ord a => a from Ord a => a -> a -> Bool, and you are left with Ord a => a -> Bool.

In general, you just remove the type corresponding to the applied argument. For example, given (??) :: Int -> Char -> Bool,

-- with the Int argument supplied, you still need a Char
(x ??) == (\y -> x ?? y) :: Char -> Bool
-- with the Char argument supplied, you still need an Int
(?? y) == (\x -> x ?? y) :: Int -> Bool
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文