-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathergparse.hs
27 lines (20 loc) · 901 Bytes
/
ergparse.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import qualified Data.ByteString.Lazy.Char8 as BC
import Data.Word
import Data.Aeson.Encode.Pretty
import qualified DataTypes.TableEntry as Te
import qualified DataTypes.Workout as W
import qualified Utils
getTableEntries :: [Char] -> IO [Te.TableEntry]
getTableEntries filename = Utils.getLogDataAccessBinaries filename >>=
Utils.inIO Utils.allButLast >>=
Utils.inIO (map Te.parseTableEntry)
getWorkouts :: [Te.TableEntry] -> [Word8] -> [W.Workout]
getWorkouts tes ds = map (\te -> W.getFrames te ds) tes
main = do
entries <- getTableEntries "LogDataAccessTbl.bin"
workoutData <- Utils.getLogDataAccessData "LogDataStorage.bin"
mapM W.toLocalTime (getWorkouts entries workoutData) >>=
Utils.inIO Utils.listJSONToObj >>=
Utils.inIO encodePretty >>=
Utils.inIO BC.unpack >>=
putStrLn