remove comments and debug output
This commit is contained in:
parent
6099753702
commit
7cfe6b4892
23
lib/Track.hs
23
lib/Track.hs
@ -10,11 +10,9 @@ module Track (
|
|||||||
) where
|
) where
|
||||||
import Data.Time
|
import Data.Time
|
||||||
import qualified Data.List
|
import qualified Data.List
|
||||||
-- import qualified Text.XML as X
|
|
||||||
import Text.XML
|
import Text.XML
|
||||||
import Text.XML.Cursor as Cursor
|
import Text.XML.Cursor as Cursor
|
||||||
import qualified Data.Text
|
import qualified Data.Text
|
||||||
-- import qualified Data.Text.Lazy
|
|
||||||
import Data.Text.Lazy as T
|
import Data.Text.Lazy as T
|
||||||
import Debug.Trace (trace, traceShow)
|
import Debug.Trace (trace, traceShow)
|
||||||
import Data.List as List
|
import Data.List as List
|
||||||
@ -22,8 +20,6 @@ import Data.Map as Map
|
|||||||
import Control.Exception
|
import Control.Exception
|
||||||
|
|
||||||
data Pos = Pos Float Float deriving (Show, Eq)
|
data Pos = Pos Float Float deriving (Show, Eq)
|
||||||
|
|
||||||
|
|
||||||
type Power = Maybe Int
|
type Power = Maybe Int
|
||||||
type Cadence = Maybe Int
|
type Cadence = Maybe Int
|
||||||
type HeartRate = Maybe Int
|
type HeartRate = Maybe Int
|
||||||
@ -37,6 +33,7 @@ data Point = Point {
|
|||||||
heartRate :: HeartRate
|
heartRate :: HeartRate
|
||||||
} deriving (Show)
|
} deriving (Show)
|
||||||
|
|
||||||
|
-- TODO do we even need this type?
|
||||||
type Track = [Point]
|
type Track = [Point]
|
||||||
|
|
||||||
mkPoint pos =
|
mkPoint pos =
|
||||||
@ -48,23 +45,12 @@ mkPoint pos =
|
|||||||
(Just 0)
|
(Just 0)
|
||||||
(Just 0)
|
(Just 0)
|
||||||
|
|
||||||
parse' str = [
|
|
||||||
Point
|
|
||||||
(Pos 51.6 0)
|
|
||||||
(Just 0)
|
|
||||||
(UTCTime (toEnum 60631) 43200)
|
|
||||||
(Just 0)
|
|
||||||
(Just 0)
|
|
||||||
(Just 0)
|
|
||||||
]
|
|
||||||
|
|
||||||
elToPoint :: Cursor -> Point
|
elToPoint :: Cursor -> Point
|
||||||
elToPoint n =
|
elToPoint n =
|
||||||
trace "el" $
|
case node n of
|
||||||
case traceShow (node n) (node n) of
|
|
||||||
NodeElement (Element _ attrs _) ->
|
NodeElement (Element _ attrs _) ->
|
||||||
let
|
let
|
||||||
lat = traceShow (getAttr "lat") (getAttr "lat")
|
lat = getAttr "lat"
|
||||||
lon = getAttr "lon"
|
lon = getAttr "lon"
|
||||||
in mkPoint (Pos lat lon)
|
in mkPoint (Pos lat lon)
|
||||||
where getAttr name =
|
where getAttr name =
|
||||||
@ -78,7 +64,6 @@ getPoints c =
|
|||||||
let
|
let
|
||||||
trkpts =
|
trkpts =
|
||||||
child c >>=
|
child c >>=
|
||||||
-- element "gpx" >>= child >>=
|
|
||||||
element "trk" >>= descendant >>=
|
element "trk" >>= descendant >>=
|
||||||
element "trkpt"
|
element "trkpt"
|
||||||
in
|
in
|
||||||
@ -93,7 +78,7 @@ parse str =
|
|||||||
Right gpx ->
|
Right gpx ->
|
||||||
let
|
let
|
||||||
points = getPoints $ fromDocument gpx
|
points = getPoints $ fromDocument gpx
|
||||||
in traceShow "(gpx)" (Right points)
|
in Right points
|
||||||
Left err ->
|
Left err ->
|
||||||
Left err
|
Left err
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user