1
1
mirror of https://github.com/github/semantic.git synced 2025-01-02 20:41:38 +03:00

Define a Monoid instance for Assignment.

This commit is contained in:
Rob Rix 2017-09-01 09:58:54 -04:00
parent ddb5518878
commit d06927f604

View File

@ -333,6 +333,10 @@ makeState = State 0 (Info.Pos 1 1) []
-- Instances
instance (Enum grammar, Eq (ast (AST ast grammar)), Ix grammar) => Monoid (Assignment ast grammar a) where
mempty = empty
mappend = (<|>)
instance (Enum grammar, Eq (ast (AST ast grammar)), Ix grammar) => Alternative (Assignment ast grammar) where
empty :: HasCallStack => Assignment ast grammar a
empty = tracing (Alt []) `Then` return