mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-11 10:35:57 +03:00
fix TermSearchboxParser errors
This commit is contained in:
parent
7b1e574ea6
commit
7b8f83c31e
@ -16,7 +16,7 @@ import qualified Data.Text as Text
|
|||||||
import qualified Unison.Term as E
|
import qualified Unison.Term as E
|
||||||
import qualified Unison.Var as Var
|
import qualified Unison.Var as Var
|
||||||
|
|
||||||
term :: Parser [Term V]
|
term :: Parser () [Term V]
|
||||||
term =
|
term =
|
||||||
msum
|
msum
|
||||||
[ single . E.lit . E.Text . Text.pack <$> quotedString
|
[ single . E.lit . E.Text . Text.pack <$> quotedString
|
||||||
@ -30,22 +30,22 @@ term =
|
|||||||
where
|
where
|
||||||
single x = [x]
|
single x = [x]
|
||||||
|
|
||||||
digits :: Parser String
|
digits :: Parser () String
|
||||||
digits = takeWhile Char.isDigit
|
digits = takeWhile "digits" Char.isDigit
|
||||||
|
|
||||||
digits1 :: Parser String
|
digits1 :: Parser () String
|
||||||
digits1 = (:) <$> one Char.isDigit <*> digits
|
digits1 = (:) <$> one Char.isDigit <*> digits
|
||||||
|
|
||||||
floatingPoint :: Parser Double
|
floatingPoint :: Parser () Double
|
||||||
floatingPoint = do
|
floatingPoint = do
|
||||||
d <- digits1
|
d <- digits1
|
||||||
rest <- optional (void (char '.') *> ((++) <$> pure "0." <*> (fromMaybe "0" <$> optional digits1)))
|
rest <- optional (void (char '.') *> ((++) <$> pure "0." <*> (fromMaybe "0" <$> optional digits1)))
|
||||||
pure $ read d + fromMaybe 0.0 (read <$> rest)
|
pure $ read d + fromMaybe 0.0 (read <$> rest)
|
||||||
|
|
||||||
quotedString :: Parser String
|
quotedString :: Parser () String
|
||||||
quotedString = char '\"' *> takeWhile (\c -> c /= '\"') <* optional (char '\"')
|
quotedString = char '\"' *> takeWhile "quoted string" (\c -> c /= '\"') <* optional (char '\"')
|
||||||
|
|
||||||
intro :: Parser [Term V]
|
intro :: Parser () [Term V]
|
||||||
intro = do
|
intro = do
|
||||||
let sym = (Var.named . Text.pack <$> token (identifier [])) <|> pure (Var.named "_")
|
let sym = (Var.named . Text.pack <$> token (identifier [])) <|> pure (Var.named "_")
|
||||||
let lam v = E.lam v E.blank
|
let lam v = E.lam v E.blank
|
||||||
|
Loading…
Reference in New Issue
Block a user