Skip to content

Commit 53cd6d9

Browse files
authored
Fix @Rev:<n> extra-deps specification not working (input-output-hk#90)
This mistake was introduced in e04dbd4. Where previously the (+++) operator from https://hackage.haskell.org/package/Cabal-2.4.1.0/docs/Distribution-Compat-ReadP.html#v:-43--43--43- was used to give no precedence to left or right, now the <|> operator is used instead, which fails if the left fails and won't try the right (non-backtracking). To fix this, a try is used, which explicitly makes the code backtrack if the left was unsuccessful. A better fix would be possible by reading until ':', then change behavior depending on whether "sha256" or "rev" was read
1 parent 856f3d5 commit 53cd6d9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/Stack2nix/Stack.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ revSuffix :: ParsecParser CabalRev
163163
revSuffix = string "@rev:" *> (CabalRev . read <$> some (satisfy (`elem` ['0'..'9'])))
164164

165165
suffix :: ParsecParser (Maybe (Either Sha256 CabalRev))
166-
suffix = option Nothing (Just <$> ((Left <$> sha256Suffix) <|> (Right <$> revSuffix)))
166+
suffix = option Nothing (Just <$> (try (Left <$> sha256Suffix) <|> (Right <$> revSuffix)))
167167

168168
pkgIndex :: ParsecParser Dependency
169169
pkgIndex = PkgIndex <$> parsec <*> suffix <* eof

0 commit comments

Comments
 (0)