user3805839
user3805839

Reputation: 43

Options.Applicative, (<>) and the Monoid type class

I am learning about Haskell. I am importing the Options.Applicative module, like so:

import Options.Applicative ((<>), Parser)
import qualified Options.Applicative as P

However, this returns

Module ‘Options.Applicative’ does not export ‘(<>)’

What is wrong with this? This documentation suggests this should be possible.

Upvotes: 4

Views: 152

Answers (2)

duplode
duplode

Reputation: 34378

You need to import (<>) from either Data.Monoid or Data.Semigroup, as Options.Applicative doesn't actually re-export it. A quick way to verify that is checking the "<" page in the documentation index, which would include (<>) if it was re-exported.

P.S.: While the readme currently on Hackage is slightly misleading indeed, the missing import was already added upstream at GitHub, and so it will be fixed when the next version of the package is released.

Upvotes: 7

amalloy
amalloy

Reputation: 91857

(<>) is in Data.Monoid, not Options.Applicative. It's an infix synonym for mappend.

Upvotes: 7

Related Questions