language-bash icon indicating copy to clipboard operation
language-bash copied to clipboard

Expose ByteString version of 'parse'

Open hasufell opened this issue 6 years ago • 2 comments

https://hackage.haskell.org/package/language-bash-0.9.0/docs/Language-Bash-Parse.html#v:parse is only String. That is really unfortunate. String is both a weird (not even UTF-8) format and is unefficient. I generally don't use it at all.

Nothing else from the module is exposed, so it's hard to build my own version without forking the library.

hasufell avatar Jan 14 '20 22:01 hasufell

Should the interface use Text instead of ByteString? In other words, is it safe to assume all bash scripts are Unicode and not arbitrary binary data?

knrafto avatar Jan 15 '20 16:01 knrafto

In other words, is it safe to assume all bash scripts are Unicode and not arbitrary binary data?

I don't think arbirary binary data is allowed. But some binary data works just fine as strings for example. I would provide both ByteString and Text version and drop String entirely.

I noticed some things in the AST end up as Char. I'm not sure how well that would work when parsing as ByteString.

hasufell avatar Jan 15 '20 17:01 hasufell