什么是:< Haskell的运营商?

时间:2015-09-13 01:31:08

标签: haskell

This blog post使用:<运算符。它做了什么?

1 个答案:

答案 0 :(得分:7)

在博客文章中,它由Cofree类型的数据声明定义:

data Cofree f a = a :< f (Cofree f a)

这使:<成为中缀数据构造函数,您可以使用它来构建或模式匹配Cofree值。

Hackage上free包的Control.Comonad.Cofree模块中也提供了该定义。

:<包的Data.Sequence模块中,另一个经常使用的containers定义,作为ViewL类型的构造函数使用模式匹配序列的左端。

相关问题