Tim Newsham wrote: [snip] > I would have expected this to fix my problems: > > binEof :: Get () > binEof = do > more <- not <$> isEmpty > when more $ error "expected EOF" > > decodeFully :: Binary b => B.ByteString -> b > decodeFully = runGet (get << binEof) > where a << b = a >>= (\x -> b >> return x)
Remember that the Get monad is lazy; the result of binEof is never used, so the action is not performed. decodeFully :: Binary b => B.ByteString -> b decodeFully = runGet (get << binEof) where a << b = a >>= (\x -> b >>= \y -> y `seq` return x) works, for example, and also where a << b = a >>= (\x -> b >>= \y -> return (y `seq` x)) and where (<<) = liftM2 (flip seq) HTH, Bertram _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe