PARSER: allow normal Integers for posDouble as well

1.0 => valid
1   => valid
このコミットが含まれているのは:
hasufell 2014-10-09 16:53:32 +02:00
コミット 70665e4b29
この署名に対応する既知のキーがデータベースに存在しません
GPGキーID: 220CD1C5BDEED020
1個のファイルの変更6行の追加5行の削除

ファイルの表示

@ -69,11 +69,12 @@ posInt = MkParser f
-- |Creates a Parser that accepts positive integers.
posDouble :: Parser Double
posDouble = read <$>
liftA3 (\x y z -> x ++ [y] ++ z)
(MkParser f)
(char '.')
(MkParser f)
posDouble = read <$> (
(\x y z -> x ++ [y] ++ z) <$>
(MkParser f) <*>
(char '.') <*>
(MkParser f) <|>
(MkParser f))
where
f xs
| null ns = Nothing