Sort elements before converting to string
Just in case...
This commit is contained in:
parent
8d882cf861
commit
e9b4edc6e0
1 changed files with 2 additions and 1 deletions
|
|
@ -26,6 +26,7 @@ module Cards
|
|||
|
||||
import Control.Applicative
|
||||
import Control.Monad
|
||||
import Data.Function
|
||||
import Data.List
|
||||
import qualified Data.Map.Strict as Map
|
||||
import Data.Time
|
||||
|
|
@ -223,7 +224,7 @@ nomToInteger = (truncate :: Double -> Integer) . realToFrac
|
|||
-- This string can then be written to a text file for storage.
|
||||
elementsToString :: Elements -> String
|
||||
elementsToString (Elements e) =
|
||||
let elms = map snd $ Map.toList e
|
||||
let elms = map snd $ sortBy (compare `on` fst) $ Map.toList e
|
||||
in unlines $ intersperse "" $ map (\x -> elementToString x) elms
|
||||
|
||||
elementToString :: Element -> String
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue