mirror of
https://github.com/facebook/duckling.git
synced 2024-09-11 21:27:13 +03:00
Numeral: Silence point-free lint errors in Numeral/Helpers.hs
Summary: While looking at bugfixes for some ES and IT numeral parsing, I was looking at the Helpers.hs module and figured I'd silence some lint errors. There are still some name-masking lint issues, but all others have been fixed. Reviewed By: chessai Differential Revision: D27854164 fbshipit-source-id: 5be8d924b033a55608c455074df1c80c8c0019be
This commit is contained in:
parent
e7f320e0c9
commit
586522b649
@ -74,8 +74,8 @@ parseDouble s
|
||||
decimalsToDouble :: Double -> Double
|
||||
decimalsToDouble x =
|
||||
let xs = filter (\y -> x - y < 0)
|
||||
. take 10
|
||||
. iterate (*10) $ 1 in
|
||||
$ take 10
|
||||
$ iterate (*10) 1 in
|
||||
case xs of
|
||||
[] -> 0
|
||||
(multiplier : _) -> x / multiplier
|
||||
@ -136,21 +136,21 @@ oneOf vs = Predicate $ \x ->
|
||||
|
||||
withMultipliable :: Token -> Maybe Token
|
||||
withMultipliable (Token Numeral x@NumeralData{}) =
|
||||
Just . Token Numeral $ x {multipliable = True}
|
||||
Just $ Token Numeral $ x {multipliable = True}
|
||||
withMultipliable _ = Nothing
|
||||
|
||||
withGrain :: Int -> Token -> Maybe Token
|
||||
withGrain g (Token Numeral x@NumeralData{}) =
|
||||
Just . Token Numeral $ x {grain = Just g}
|
||||
Just $ Token Numeral $ x {grain = Just g}
|
||||
withGrain _ _ = Nothing
|
||||
|
||||
notOkForAnyTime :: Token -> Maybe Token
|
||||
notOkForAnyTime (Token Numeral x) =
|
||||
Just . Token Numeral $ x {okForAnyTime = False}
|
||||
Just $ Token Numeral $ x {okForAnyTime = False}
|
||||
notOkForAnyTime _ = Nothing
|
||||
|
||||
double :: Double -> Maybe Token
|
||||
double x = Just . Token Numeral $ NumeralData
|
||||
double x = Just $ Token Numeral $ NumeralData
|
||||
{ value = x
|
||||
, grain = Nothing
|
||||
, multipliable = False
|
||||
|
Loading…
Reference in New Issue
Block a user