Remove some unnecessary uses of "try"

This commit is contained in:
John Wiegley 2018-04-10 23:40:32 -07:00
parent cab50333a1
commit 8068c7b43e

View file

@ -30,7 +30,7 @@ nixExprLoc :: Parser NExprLoc
nixExprLoc = makeExprParser nixTerm $ map (map snd) (nixOperators nixSelector)
antiStart :: Parser Text
antiStart = try (symbol "${") <?> show ("${" :: String)
antiStart = symbol "${" <?> show ("${" :: String)
nixAntiquoted :: Parser a -> Parser (Antiquoted a NExprLoc)
nixAntiquoted p =
@ -112,8 +112,8 @@ nixFloat :: Parser NExprLoc
nixFloat = annotateLocation1 (try (mkFloatF . realToFrac <$> float) <?> "float")
nixBool :: Parser NExprLoc
nixBool = annotateLocation1 (try (bool "true" True <|>
bool "false" False) <?> "bool") where
nixBool = annotateLocation1 (bool "true" True <|>
bool "false" False) <?> "bool" where
bool str b = mkBoolF b <$ reserved str
nixNull :: Parser NExprLoc
@ -299,7 +299,7 @@ keyName = dynamicKey <|> staticKey where
nixSet :: Parser NExprLoc
nixSet = annotateLocation1 ((isRec <*> braces nixBinders) <?> "set") where
isRec = (try (reserved "rec" $> NRecSet) <?> "recursive set")
isRec = (reserved "rec" $> NRecSet <?> "recursive set")
<|> pure NSet
parseNixFile :: MonadIO m => FilePath -> m (Result NExpr)