Skip to content
Browse files

Added parseString

  • Loading branch information...
1 parent 231c584 commit 3e07196f7f89d5cebf9da71e516c95844c6984bf @ekmett committed Jan 14, 2013
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/Text/Trifecta/Parser.hs
View
4 src/Text/Trifecta/Parser.hs
@@ -37,6 +37,7 @@ module Text.Trifecta.Parser
-- * Parsing
, parseFromFile
, parseFromFileEx
+ , parseString
, parseByteString
, parseTest
) where
@@ -350,6 +351,9 @@ parseFromFileEx p fn = parseByteString p (Directed (UTF8.fromString fn) 0 0 0 0)
parseByteString :: Show a => Parser a -> Delta -> UTF8.ByteString -> Result a
parseByteString p d inp = starve $ feed inp $ stepParser (release d *> p) mempty mempty
+parseString :: Show a => Parser a -> Delta -> String -> Result a
+parseString p d inp = starve $ feed inp $ stepParser (release d *> p) mempty mempty
+
parseTest :: Show a => Parser a -> String -> IO ()
parseTest p s = case parseByteString p mempty (UTF8.fromString s) of
Failure xs -> displayLn xs

0 comments on commit 3e07196

Please sign in to comment.
Something went wrong with that request. Please try again.