[Haskell-cafe] What other prelude to cleanly convert text-files into json
travis.cardwell at extellisys.com
Sun Mar 1 00:42:10 UTC 2015
On 2015年02月28日 20:23, Bram Neijt wrote:
> It quickly became a collection of "import qualified" and "T.unpack,
> T.pack" calls that made the whole thing look ugly .
>  Source can be read here: https://gist.github.com/bneijt/9bdb4b1759790a8463c9
File paths are of type `System.FilePath.Posix.FilePath`, a type alias for
`String`. Note that this convention is also followed in `ByteString` and
`Text` libraries; they do not use `ByteString` or `Text` types for the
In this code, file paths are packed only to have to unpack them again
(twice!), which likely offsets any performance improvements of using the
`Text` version of `isSuffixOf`.
Here is a version using the same style but without packing file paths:
I included a few other changes, which are commented in the code.
By the way, I do not think that qualified imports are bad. I like them
because they provide an explicit reference to the source module of a function.
More information about the Haskell-Cafe