Fix float parsing
commita094228093f37360e84b5f03a06beaf9026eb276
authorGary Burgess <gary.burgess@gmail.com>
dateTue 11 Feb 2014, 11:49 (13 years ago)
parentf110f31
examples/passing/Math.purs+5−3
@@ -1,7 +1,9 @@
11module Main where
22
33 import Prelude
4− import Math
5−
6− main = Trace.print $ sin 1
4+ import Trace
5+ import Eff
76
7+ main = do
8+ print $ Math.sin 0
9+ print $ Math.sin 0.5
src/Language/PureScript/Parser/Common.hs+2−2
@@ -217,8 +217,8 @@ parseQualified parser = qual
217217-- Parse an integer or floating point value
218218--
219219integerOrFloat :: P.Parsec String u (Either Integer Double)
220−integerOrFloat = (Left <$> P.try (PT.natural tokenParser) <|>
221− Right <$> P.try (PT.float tokenParser)) P.<?> "number"
220+integerOrFloat = (Right <$> P.try (PT.float tokenParser) <|>
221+ Left <$> P.try (PT.natural tokenParser)) P.<?> "number"
222222
223223-- |
224224-- Parse an identifier or parenthesized operator