Idris2/samples/StringParser.idr

18 lines
414 B
Idris
Raw Normal View History

2020-07-04 15:45:29 +03:00
module Main
import Data.String.Parser
import Control.Monad.Identity
-- Buld this program with '-p contrib'
partial
main : IO ()
main = do
res <- parseT (string "hi") "hideous"
case res of
Left err => putStrLn "NOOOOOOO!"
Right () => putStrLn "YEEEES!"
digs <- parseT (satisfy isDigit) "8878993"
case digs of
Left err => putStrLn "NOOOOOOO!"
Right ds => printLn ds