implicit-hie
implicit-hie copied to clipboard
A field needs not end with a new line
This PR changes the behavior of field so that it can parse a field that does not end with a new line, addressing #54.
In the latest version, it seems to me that field is used only in extractPkgs. So, I have only tested extractPkgs in REPL.
It works as expected for my example used in #54.
$ cabal repl
ghci> parseOnly extractPkgs (Data.Text.pack "packages: proj/*.cabal\n")
Right ["proj/*.cabal"]
ghci> parseOnly extractPkgs (Data.Text.pack "packages: proj/*.cabal")
Right ["proj/*.cabal"]
I also confirmed the following behavior is kept unchanged for this commit.
$ cabal repl
ghci> import Data.Text.IO as T
ghci> T.readFile "./test/cabal.project" >>= \s -> pure $ parseOnly extractPkgs s
Right ["optics/*.cabal","optics-core/*.cabal","optics-extra/*.cabal","optics-sop/*.cabal","optics-th/*.cabal","optics-vl/*.cabal","indexed-profunctors/*.cabal","template-haskell-optics/*.cabal","metametapost/*.cabal"]
I haven't checked how this change affects 0.1.2.7, which I understand is what is called 0.1.4.0 and uses the field function in places other than extractPkgs.
Thanks!