Skip to content

Instantly share code, notes, and snippets.

@phadej
Created October 9, 2020 20:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phadej/51864edda9e25452453990aa65d040b1 to your computer and use it in GitHub Desktop.
Save phadej/51864edda9e25452453990aa65d040b1 to your computer and use it in GitHub Desktop.
diff --git a/Cabal/src/Distribution/FieldGrammar/Newtypes.hs b/Cabal/src/Distribution/FieldGrammar/Newtypes.hs
index 3f37b43eb..35a1e781c 100644
--- a/Cabal/src/Distribution/FieldGrammar/Newtypes.hs
+++ b/Cabal/src/Distribution/FieldGrammar/Newtypes.hs
@@ -250,7 +250,11 @@ newtype FilePathNT = FilePathNT { getFilePathNT :: String }
instance Newtype String FilePathNT
instance Parsec FilePathNT where
- parsec = pack <$> parsecToken
+ parsec = do
+ token <- parsecToken
+ if null token
+ then P.unexpected "empty FilePath"
+ else return (FilePathNT token)
instance Pretty FilePathNT where
pretty = showFilePath . unpack
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment