make the Functor Get instance in Data.Binary strict to be sure that the decoder is strict

This commit is contained in:
krasimir
2009-06-24 12:08:32 +00:00
parent 958d988217
commit 10fec3453a

View File

@@ -108,8 +108,8 @@ data S = S {-# UNPACK #-} !B.ByteString -- current chunk
newtype Get a = Get { unGet :: S -> (a, S) }
instance Functor Get where
fmap f m = Get (\s -> let (a, s') = unGet m s
in (f a, s'))
fmap f m = Get (\s -> case unGet m s of
(a, s') -> (f a, s'))
{-# INLINE fmap #-}
#ifdef APPLICATIVE_IN_BASE