It's because you're doing this many alphaNum <|> many space
. many
accepts 0 as an acceptable amount of characters, it always succeeds. This is the same behavior as *
in regexs.
So in a <|>
it's never going to fail and call the right side. So you're saying "try as many alphaNum
as possible then take a "
.
What you want is
many (alphaNum <|> space)
In other words, "as many alphaNum
s or space
s as possible".