Make pure strict in position
This is inconsistent with the behavior of (>>=) and is consequently a violation
of the monad laws. Thanks for @dfeuer for noticing this. Fixes #126.
commit83c28e37bd42dd6c3fac0c2a7818b3ec64e0cefe
authorBen Gamari <ben@smart-cactus.org>
dateWed 21 Dec 2016, 22:13 (10 years ago)
parent27593bb
Data/Attoparsec/Internal/Types.hs+1−1
@@ -180,7 +180,7 @@ apP d e = do
180180{-# INLINE apP #-}
181181
182182instance Applicative (Parser i) where
183− pure v = Parser $ \t pos more _lose succ -> succ t pos more v
183+ pure v = Parser $ \t !pos more _lose succ -> succ t pos more v
184184 {-# INLINE pure #-}
185185 (<*>) = apP
186186 {-# INLINE (<*>) #-}