lib: clarify rawnumberp doc
[ci skip]
This commit is contained in:
		
							parent
							
								
									e4a26aa0cf
								
							
						
					
					
						commit
						49c8c093ac
					
				| @ -665,13 +665,21 @@ fromRawNumber suggestedStyle negated raw = (quantity, precision, mdecimalpoint, | |||||||
|         AmountStyle{asprecision = 0} -> const False |         AmountStyle{asprecision = 0} -> const False | ||||||
|         _ -> const True |         _ -> const True | ||||||
| 
 | 
 | ||||||
| -- | Parse the parts of a number, optionally with digit group separators | -- | Pre-parse a number into parts for further interpretation. | ||||||
| -- and/or decimal point, which may be comma or period. Returns:  | -- Numbers may optionally have a period/comma decimal point  | ||||||
| -- - the first separator char (. or ,) if any | -- and/or comma/period/space digit group separators, but we don't | ||||||
| -- - the zero or more digit sequences which were separated by this char | -- decide which is which here, just return the parts: | ||||||
| -- - the other, final separator char and digit sequence following it, if any   | --  | ||||||
| -- Eg: | -- - the first separator char (period or comma or space) seen, if any | ||||||
| -- 1,234,567.89 -> ( Just ',', ["1","234","567"], Just ('.', "89") ) | --  | ||||||
|  | -- - the digit group(s), possibly several separated by the above char, occuring before.. | ||||||
|  | --  | ||||||
|  | -- - the second and last separator char, and following digit group, if any. | ||||||
|  | --  | ||||||
|  | -- >>> 1,234,567.89 | ||||||
|  | -- ( Just ',', ["1","234","567"], Just ('.', "89") ) | ||||||
|  | -- >>> 1 000 | ||||||
|  | -- ( Just ' ', ["1","000"], Nothing ) | ||||||
| rawnumberp :: TextParser m ( Maybe Char , [String] , Maybe (Char, String) ) | rawnumberp :: TextParser m ( Maybe Char , [String] , Maybe (Char, String) ) | ||||||
| rawnumberp = do | rawnumberp = do | ||||||
|     let sepChars = ['.', ','] -- all allowed punctuation characters |     let sepChars = ['.', ','] -- all allowed punctuation characters | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user