Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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