Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the meaning of the Haskell operator "<>"?

Tags:

haskell

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.

like image 980
Greg Howard Avatar asked Aug 08 '16 21:08

Greg Howard


1 Answers

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.

like image 186
Benjamin Hodgson Avatar answered Oct 19 '22 16:10

Benjamin Hodgson