Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

haskell

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.

like image 240
user3805839 Avatar asked Dec 08 '22 19:12

user3805839


2 Answers

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.

like image 68
duplode Avatar answered Jan 03 '23 03:01

duplode


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

like image 37
amalloy Avatar answered Jan 03 '23 03:01

amalloy