switch to readMaybe to handle values with leading number followed by non-number
readish ignores a trailing string after a number, but to support values like "YYYY:MM:DD" which it makes sense to compare lexographically, require the whole string to be parsed as a number in order to enable numeric comparison. Sponsored-by: Max Thoursie on Patreon
This commit is contained in:
parent
6dcb7b8815
commit
2fa7656627
2 changed files with 12 additions and 1 deletions
|
@ -26,6 +26,7 @@ import qualified Data.Text as T
|
|||
import Data.Time.Calendar
|
||||
import Data.Time.Clock
|
||||
import Data.Time.Clock.POSIX
|
||||
import Text.Read
|
||||
|
||||
{- Adds metadata for a file that has just been ingested into the
|
||||
- annex, but has not yet been committed to git.
|
||||
|
@ -117,4 +118,4 @@ parseMetaDataMatcher p = (,)
|
|||
in case (doubleval v, doubleval v') of
|
||||
(Just d, Just d') -> d' `cmp` d
|
||||
_ -> v' `cmp'` v
|
||||
doubleval v = readish v :: Maybe Double
|
||||
doubleval v = readMaybe v :: Maybe Double
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue