Permalink
Browse files

Expose a function for running a Parser

  • Loading branch information...
1 parent 6d6e9df commit 21efee14bf0f4cfe46f5fb76d4d1f39c5f972c44 @tibbe tibbe committed Nov 20, 2012
Showing with 7 additions and 7 deletions.
  1. +1 −1 Data/Csv.hs
  2. +5 −5 Data/Csv/Conversion.hs
  3. +1 −1 Data/Csv/Incremental.hs
View
@@ -50,7 +50,7 @@ module Data.Csv
-- $indexbased
, FromRecord(..)
, Parser
- -- TODO: Expose 'parse' and 'parseEither'.
+ , runParser
, (.!)
, ToRecord(..)
, record
@@ -17,7 +17,7 @@ module Data.Csv.Conversion
-- * Parser
, Parser
- , parseEither
+ , runParser
-- * Accessors
, (.!)
@@ -669,15 +669,15 @@ apP d e = do
return (b a)
{-# INLINE apP #-}
--- | Run a 'Parser', returning either @'Left' msg@ or @'Right'
+-- | Run a 'Parser', returning either @'Left' errMsg@ or @'Right'
-- result@. Forces the value in the 'Left' or 'Right' constructors to
-- weak head normal form.
-parseEither :: Parser a -> Either String a
-parseEither p = runParser p left right
+runParser :: Parser a -> Either String a
+runParser p = runParser p left right
where
left !errMsg = Left errMsg
right !x = Right x
-{-# INLINE parseEither #-}
+{-# INLINE runParser #-}
#ifdef GENERICS
@@ -293,7 +293,7 @@ decodeWithP p !opts = go Incomplete [] . parser
| otherwise = convert r : acc
parser = A.parse (record (decDelimiter opts) <* (endOfLine <|> endOfInput))
- convert = parseEither . p
+ convert = runParser . p
{-# INLINE decodeWithP #-}
blankLine :: V.Vector B.ByteString -> Bool

0 comments on commit 21efee1

Please sign in to comment.