@@ -1,4 +1,4 @@
1−{-# LANGUAGE BangPatterns, FlexibleInstances, GeneralizedNewtypeDeriving, OverloadedStrings,
1+{-# LANGUAGE BangPatterns, GeneralizedNewtypeDeriving, OverloadedStrings,
22 Rank2Types, RecordWildCards, TypeFamilies #-}
33-- |
44-- Module : Data.Attoparsec.Internal.Types
@@ -65,10 +65,14 @@ data IResult i r =
6565 | Done i r
6666 -- ^ The parse succeeded. The @i@ parameter is the input that had
6767 -- not yet been consumed (if any) when the parse succeeded.
68− deriving (Show)
69−
70−instance Show (i -> IResult i r) where
71− show _ = "_"
68+
69+instance (Show i, Show r) => Show (IResult i r) where
70+ showsPrec d ir = showParen (d > 10) $
71+ case ir of
72+ (Fail t stk msg) -> showString "Fail" . f t . f stk . f msg
73+ (Partial _) -> showString "Partial _"
74+ (Done t r) -> showString "Done" . f t . f r
75+ where f s = showString " " . showsPrec 11 s
7276
7377instance (NFData i, NFData r) => NFData (IResult i r) where
7478 rnf (Fail t stk msg) = rnf t `seq` rnf stk `seq` rnf msg