From b91c2ae9e53ccc7637f6ca34382bd0c85ad6b11c Mon Sep 17 00:00:00 2001
From: Hans-Peter Deifel <hpd@hpdeifel.de>
Date: Wed, 25 Jul 2018 09:20:32 +0200
Subject: [PATCH] Speed up Lexer.signed

`L.signed L.decimal` now has minimal overhead over L.decimal on it's
own. We did sacrifice the possibility to write a (redundant) `+` sign
or white space between the minus and the number.
---
 src/MA/Parser/Lexer.hs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/MA/Parser/Lexer.hs b/src/MA/Parser/Lexer.hs
index 68ed11d..88553a7 100644
--- a/src/MA/Parser/Lexer.hs
+++ b/src/MA/Parser/Lexer.hs
@@ -94,5 +94,5 @@ float = lexeme L.float
 {-# INLINE float #-}
 
 signed :: (MonadParser m, Num a) => m a -> m a
-signed = L.signed spaceConsumer
+signed p = option id (char '-' *> return negate) <*> p
 {-# INLINE signed #-}
-- 
GitLab