Make the Parser Monad's return strict
authorIan Lynagh <igloo@earth.li>
Thu, 24 Jan 2008 15:58:27 +0000 (15:58 +0000)
committerIan Lynagh <igloo@earth.li>
Thu, 24 Jan 2008 15:58:27 +0000 (15:58 +0000)
compiler/parser/Lexer.x

index 2aa8f4f..8d2a9a5 100644 (file)
@@ -1410,7 +1410,7 @@ instance Monad P where
   fail = failP
 
 returnP :: a -> P a
-returnP a = P $ \s -> POk s a
+returnP a = a `seq` (P $ \s -> POk s a)
 
 thenP :: P a -> (a -> P b) -> P b
 (P m) `thenP` k = P $ \ s ->