purescript-contrib/purescript-parsing

Data.CodePoint.Unicode Predicates

mkohlhaas opened this issue · 2 comments

Hi James,

Awesome library. Awesome presentation on PureConf!

Is there any reason why the predicates from Data.CodePoint.Unicode are not exposed in Text.Parsing.Parser.String.Basic ?

I was especially looking for a lower parser as there is an upper parser.

Thanks!

Hi @mkohlhaas , thanks!

Yeah it would make sense for there to be a lower parser in that module. I would accept a PR for that. In the meantime you can define it yourself in your program:

lower :: forall m. Monad m => ParserT String m Char
lower = satisfy (isLower <<< codePointFromChar) <?> "lowercase letter"

Because it’s so easy for users to define their own unicode-predicate-based parsers, I don’t feel that it’s urgent to provide parsers beyond a small basic set of unicode-predicate-based parsers.