Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import Text.Parsec
  2. import Text.Parsec.String
  3.  
  4. domain :: Parser String
  5. domain = do
  6.   string "https" <|> string "http"
  7.   string "://"
  8.   many1 (noneOf "/")
  9.  
  10. λ> parse domain "" "https://www.google.com/"
  11. Right "www.google.com"
  12.  
  13. λ> parse domain "" "http://www.google.com/"
  14. Left (line 1, column 1):
  15. unexpected ":"
  16. expecting "https"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement