Reputation: 333
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.
Upvotes: 20
Views: 13175
Reputation: 44614
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.
Upvotes: 31