grammar = mdo
r <- rule $ (pure 1 <|> ((+1) <$> r))
pure r
produces just 1, not [1,2,3...]
I don't think it's possible to have this work and
grammar = mdo
r <- rule $ (pure 1 <|> r)
pure r
not produce an infinite list of results
I think this is a sensible choice because it currently can't deal with infinite results, but it should be documented somewhere. Theoretically it should be possible to return an infinite lazy list.