简体   繁体   中英

What is the meaning of the Haskell operator “<>”?

In Haskell, what is the meaning of the <> operator (as distinct from <*> or <$> ). I am seeing references to it while researching the optparse-applicative package . Neither Google nor LYAH seem to have any information.

It's an alias for mappend , from the Data.Monoid module.

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

mappend smashes two monoidal values together. For example, using the list monoid,

ghci> [1,2,3] <> [4,5,6]
[1,2,3,4,5,6]

When you see a function you don't recognise, you can often find it on API search engines like Hoogle or Hayoo .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM