git.iko.soy/typeable/attoparsec
on master help sign in
Separate input and state types more accurately

--HG-- extra : histedit_source : 39ce8ec0659103191fd79555c9274a91ef7bf2ed

commitb500eee9ef6515a83361c5651915312e0e6200d1 authorBryan O'Sullivan <bos@serpentine.com> dateMon 19 May 2014, 20:33 (12 years ago) parentf835828
2 files changed+7−7
Data/Attoparsec/Internal.hs+1−1 Data/Attoparsec/Internal/Types.hs+6−6
Data/Attoparsec/Internal.hs+1−1
@@ -24,7 +24,7 @@ import Prelude hiding (succ)
2424-- If both 'IResult's are 'Partial', the result will be 'Nothing', as
2525-- they are incomplete and hence their equality cannot be known.
2626-- (This is why there is no 'Eq' instance for 'IResult'.)
27−compareResults :: (Eq t, Eq r) => IResult i t r -> IResult i t r -> Maybe Bool
27+compareResults :: (Eq i, Eq r) => IResult i t r -> IResult i t r -> Maybe Bool
2828compareResults (Fail t0 ctxs0 msg0) (Fail t1 ctxs1 msg1) =
2929 Just (t0 == t1 && ctxs0 == ctxs1 && msg0 == msg1)
3030compareResults (Done t0 r0) (Done t1 r1) =
Data/Attoparsec/Internal/Types.hs+6−6
@@ -38,8 +38,8 @@ newtype Pos = Pos { fromPos :: Int }
3838-- This type is an instance of 'Functor', where 'fmap' transforms the
3939-- value in a 'Done' result.
4040data IResult i t r =
41− Fail t [String] String
42− -- ^ The parse failed. The 't' parameter is the input that had
41+ Fail i [String] String
42+ -- ^ The parse failed. The 'i' parameter is the input that had
4343 -- not yet been consumed when the failure occurred. The
4444 -- @[@'String'@]@ is a list of contexts in which the error
4545 -- occurred. The 'String' is the message describing the error, if
@@ -48,17 +48,17 @@ data IResult i t r =
4848 -- ^ Supply this continuation with more input so that the parser
4949 -- can resume. To indicate that no more input is available, use
5050 -- an empty string.
51− | Done t r
52− -- ^ The parse succeeded. The 't' parameter is the input that had
51+ | Done i r
52+ -- ^ The parse succeeded. The 'i' parameter is the input that had
5353 -- not yet been consumed (if any) when the parse succeeded.
5454
55−instance (Show t, Show r) => Show (IResult i t r) where
55+instance (Show i, Show r) => Show (IResult i t r) where
5656 show (Fail t stk msg) =
5757 unwords [ "Fail", show t, show stk, show msg]
5858 show (Partial _) = "Partial _"
5959 show (Done t r) = unwords ["Done", show t, show r]
6060
61−instance (NFData t, NFData r) => NFData (IResult i t r) where
61+instance (NFData i, NFData r) => NFData (IResult i t r) where
6262 rnf (Fail t stk msg) = rnf t `seq` rnf stk `seq` rnf msg
6363 rnf (Partial _) = ()
6464 rnf (Done t r) = rnf t `seq` rnf r