How do I write the qualified name of a symbol in Haskell?

…衆ロ難τιáo~ 提交于 2019-12-04 22:30:59

try

three = (T.<*>)

It's weird to define an infix operator as an integer. Let's consider \\ (the set difference operator):

import qualified Data.List as L

foo = [1..5] L.\\ [1..3] -- evaluates to [4,5]
diff = (L.\\)

As you can see above, L.\\ is a qualified infix operator; and it still works as an infix operator. To use it as a value, you put parentheses around the whole thing.

Remember that we import symbols wrapped parens. E.g.

import T ((<*>))

so importing qualified is the same:

import qualified T as Q

main = print (Q.<*>)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!