Closed massysett closed 8 years ago
Would it be possible to change the type of satisfy to something like
satisfy
satisfy :: (t -> Maybe a) -> Prod r e t a
This would make it easier to have a type like
module Token (Token, mkToken, unToken) where newtype Token = Token { unToken :: Char } mkToken :: Char -> Maybe Token mkToken x | x >= 'a' || x <= 'z' = Just (Token x) | otherwise = Nothing
and have satisfy work as expected. (You can do this now, but with partial function nastiness.) Currently this is what Parsec's tokenPrim looks like.
tokenPrim
Hey! Thanks for your input. There's now a new terminal operator that does this on master. Coming soon to a release near you.
terminal
Would it be possible to change the type of
satisfy
to something likeThis would make it easier to have a type like
and have
satisfy
work as expected. (You can do this now, but with partial function nastiness.) Currently this is what Parsec'stokenPrim
looks like.