-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Description
Similar to #28, the float parser comitts when it encounters an 'e', making it impossible to have a parser that reads either a float or some text:
floatOrText =
oneOf
[ float |> map (\n -> "Number: " ++ String.fromFloat n)
, chompUntilEndOr "\n" |> getChompedString
]
run floatOrText "not starting with e" --> Ok "not starting with e"
run floatOrText "1e10" --> Ok "Number: 10000000000"
run floatOrText "e should be text" --> Err: ExpectingFloat(Try it on Ellie: https://ellie-app.com/8yp6MxtzSsna1)
matsumonkie, AlienKevin and bburdette
Metadata
Metadata
Assignees
Labels
No labels