未知的haskell运算符; `<>`

时间:2016-07-11 12:49:38

标签: haskell interpolation monads string-interpolation

此代码似乎使用<>作为插值运算符。 https://github.com/hlian/linklater/blob/master/examples/app/JointPhotographicExpertsGroupTonga.hs

我找不到此运营商的文档或来源。任何想法它做什么/从哪里来。

2 个答案:

答案 0 :(得分:3)

Traditionally, <> is primarily a function defined in Data.Monoid.

(<>) :: Monoid a => a -> a -> a
(<>) = mappend

However, the semigroups package has long used it as a method of the Semigroup class in Data.Semigroup. As of GHC 8, Data.Semigroup has moved into the base package. There is currently a plan in place for making Semigroup a superclass of Monoid. Once this is complete, the <> function will be entirely replaced by the <> method.

答案 1 :(得分:2)

使用hayoo搜索Hackage包中的定义。

在这种情况下,它似乎是mappend中定义的Data.Monoid运算符。