0

The example from optparse-applicative package uses void angle brackets (<>):

sample :: Parser Sample
sample = Sample
  <$> strOption
      ( long "hello"
     <> metavar "TARGET"
     <> help "Target for the greeting" )
  <*> switch
      ( long "quiet"
     <> help "Whether to be quiet" )

I know what <*> and <$> relate to applicative functors, but what does triangle brackets <> mean and were are they defined? (Hoogle doesn't help).

E. Nerush
  • 69
  • 7
  • 2
    It seems like this question gets asked at least once a week. try http://hayoo.fh-wedel.de/?query=%3C%3E – user2297560 Oct 05 '16 at 14:30
  • 2
    It's an infix synonym for [`mappend`](https://www.haskell.org/hoogle/?hoogle=mappend) – user2847643 Oct 05 '16 at 14:42
  • 1
    If you have a compiling source file, you can load it in GHCi and then use `:i (<>)` to discover where that function is coming from. – chi Oct 05 '16 at 14:48
  • Try [the other Hoogle](http://hoogle.haskell.org/?hoogle=(%3C%3E)). – Daniel Wagner Oct 05 '16 at 15:44
  • It might be worth pointing out that there is no special (semantic) significance to the name `<>` itself, it's just the name for an operator defined in the standard library. In Haskell, you can give operators pretty arbitrary names. If you wanted to, for some reason, you could make an operator called `!$%^<`. – David Young Oct 05 '16 at 21:44
  • Thanks you all for replies, especially @chi and @Daniel! – E. Nerush Oct 06 '16 at 10:03

0 Answers0