phadej / cabal-extras

A tool suite to aid Haskell development using `cabal-install`
81 stars 18 forks source link

cabal-docspec: Fails to detect examples with non-standard unicode characters present #131

Open amesgen opened 1 year ago

amesgen commented 1 year ago

E.g. this example is not detected:

-- >>> length "猫"
-- 1

This is due to haskell-lexer not supporting this:

 Λ L.lexerPass0 "-- >>> length \"猫\"\n"
[(Commentstart,(Pos {char = 0, line = 1, column = 1},"--")),(ErrorToken,(Pos {char = 2, line = 1, column = 3}," >>> length \"")),(TheRest,(Pos {char = 15, line = 1, column = 16},"\29483\"\n"))]

This could be fixed in haskell-lexer (but maybe this actually is accurate behavior for Haskell 98?), but as stubbornPass0 already works around another haskell-lexer deficiency, it might be acceptable to do so again in this case? See #132 for that.

Minimal reproducible example

https://github.com/amesgen/stuff/tree/cabal-docspec-unicode

 $ git clone https://github.com/amesgen/stuff --single-branch --branch cabal-docspec-unicode
 $ cd stuf && cabal build
 $ cabal-docspec
Total:         0; Tried:    0; Skipped:    0; Success:    0; Errors:    0; Failures    0
Examples:      0; Tried:    0; Skipped:    0; Success:    0; Errors:    0; Failures    0