From 99ac5d4486f1d1bb4cd6d4c430a4bdb3f1053612 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Sun, 6 Aug 2017 11:51:50 -0400 Subject: [PATCH] Define notFollowedBy. --- src/Data/Syntax/Assignment.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Data/Syntax/Assignment.hs b/src/Data/Syntax/Assignment.hs index ecdb96fe8..d56cf2fe3 100644 --- a/src/Data/Syntax/Assignment.hs +++ b/src/Data/Syntax/Assignment.hs @@ -370,7 +370,7 @@ instance Ix grammar => Alternative (Assignment ast grammar) where many :: HasCallStack => Assignment ast grammar a -> Assignment ast grammar [a] many a = Many a `Then` return -instance Ix grammar => Parsing (Assignment ast grammar) where +instance (Ix grammar, Show grammar) => Parsing (Assignment ast grammar) where try = id () = const @@ -380,7 +380,7 @@ instance Ix grammar => Parsing (Assignment ast grammar) where eof :: HasCallStack => Assignment ast grammar () eof = withFrozenCallStack $ End `Then` return - notFollowedBy = const (pure ()) + notFollowedBy a = a *> unexpected (show a) <|> pure () instance MonadError (Error grammar) (Assignment ast grammar) where throwError :: HasCallStack => Error grammar -> Assignment ast grammar a