diff --git a/lib/Track.hs b/lib/Track.hs index adde8f8..a05020e 100644 --- a/lib/Track.hs +++ b/lib/Track.hs @@ -10,11 +10,9 @@ module Track ( ) where import Data.Time import qualified Data.List --- import qualified Text.XML as X import Text.XML import Text.XML.Cursor as Cursor import qualified Data.Text --- import qualified Data.Text.Lazy import Data.Text.Lazy as T import Debug.Trace (trace, traceShow) import Data.List as List @@ -22,8 +20,6 @@ import Data.Map as Map import Control.Exception data Pos = Pos Float Float deriving (Show, Eq) - - type Power = Maybe Int type Cadence = Maybe Int type HeartRate = Maybe Int @@ -37,6 +33,7 @@ data Point = Point { heartRate :: HeartRate } deriving (Show) +-- TODO do we even need this type? type Track = [Point] mkPoint pos = @@ -48,23 +45,12 @@ mkPoint pos = (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 n = - trace "el" $ - case traceShow (node n) (node n) of + case node n of NodeElement (Element _ attrs _) -> let - lat = traceShow (getAttr "lat") (getAttr "lat") + lat = getAttr "lat" lon = getAttr "lon" in mkPoint (Pos lat lon) where getAttr name = @@ -78,7 +64,6 @@ getPoints c = let trkpts = child c >>= - -- element "gpx" >>= child >>= element "trk" >>= descendant >>= element "trkpt" in @@ -93,7 +78,7 @@ parse str = Right gpx -> let points = getPoints $ fromDocument gpx - in traceShow "(gpx)" (Right points) + in Right points Left err -> Left err