Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Text.Parsec
- import Text.Parsec.String
- domain :: Parser String
- domain = do
- string "https" <|> string "http"
- string "://"
- many1 (noneOf "/")
- λ> parse domain "" "https://www.google.com/"
- Right "www.google.com"
- λ> parse domain "" "http://www.google.com/"
- Left (line 1, column 1):
- unexpected ":"
- expecting "https"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement