yav / pretty-show

Tools for working with derived Show instances in Haskell.
MIT License
57 stars 15 forks source link

Parser is non-deterministic #21

Closed int-index closed 8 years ago

int-index commented 8 years ago

parseValue is not a pure function!

Prelude Text.Show.Pretty> parseValue "(10:-0, 16(10:-0, 11:-0):-0)"
Just (Tuple [InfixCons (Integer "10") [(":-",Integer "0")],InfixCons (Con "" [Integer "16",Tuple [InfixCons (Integer "10") [(":-",Integer "0")],InfixCons (Integer "11") [(":-",Integer "0")]]]) [(":-",Integer "0")]])
Prelude Text.Show.Pretty> parseValue "(10:-0, 16(10:-0, 11:-0):-0)"
Just (Tuple [InfixCons (Integer "10") [(":-",Con "0" [])],InfixCons (Con "" [Integer "16",Tuple [InfixCons (Integer "10") [(":-",Integer "0")],InfixCons (Integer "11") [(":-",Integer "0")]]]) [(":-",Integer "0")]])
Prelude Text.Show.Pretty> parseValue "(10:-0, 16(10:-0, 11:-0):-0)"
Nothing
yav commented 8 years ago

Hi, I've encountered this also---it is due to a rather nasty bug in GHC, which I reported and fortunately has been fixed (see #12433 on the GHC trac), so should not be a problem with the next version of GHC. In the mean time, avoid using -dynamic / GHCi.