-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
A useful edition to this package would be the addition of a PartialMonoid
typeclass that extends PartialSemigroup
with identity:
class PartialSemigroup α ⇒ PartialMonoid α where
-- | Identity of '<>?'.
pempty ∷ α
pempty = fromJust $ pmconcat []
-- | Reduce a list with '<>?'.
pmconcat ∷ [α] → Maybe α
pmconcat = foldM (<>?) pempty
{-# MINIMAL (pempty) | pmconcat #-}
I'm working on a package for working with Minimalist Grammars in Haskell, and I have found that both PartialSemigroup
and a PartialMonoid
class (taken as above from my code) simplify constructing parsers greatly.
I would be willing to take on this issue.
Metadata
Metadata
Assignees
Labels
No labels