add hlint and apply suggestions
This commit is contained in:
parent
c514c20e68
commit
3278c7962c
@ -6,6 +6,7 @@ let
|
||||
pkgs.haskell.lib.addBuildTools drv (with pkgs.haskellPackages;
|
||||
[
|
||||
cabal-install
|
||||
hlint
|
||||
]);
|
||||
};
|
||||
in haskellEnv.overrideAttrs(o: {
|
||||
|
@ -57,7 +57,7 @@ elToPoint c =
|
||||
ele = child c >>= element (Name "ele" (Just gpxNS) Nothing) >>= child >>= content
|
||||
in Point (Pos lat lon)
|
||||
(case ele of
|
||||
e:[] -> Just $ asFloat e
|
||||
[e] -> Just $ asFloat e
|
||||
_ -> Nothing)
|
||||
(UTCTime (toEnum 60631) 43200)
|
||||
(Just 0)
|
||||
@ -66,7 +66,7 @@ elToPoint c =
|
||||
where
|
||||
asFloat v = (read (Data.Text.unpack v) :: Float)
|
||||
getAttr name =
|
||||
case (Map.lookup name attrs) of
|
||||
case Map.lookup name attrs of
|
||||
Just v -> asFloat v
|
||||
_ -> 0
|
||||
_ -> mkPoint (Pos 0 0)
|
||||
@ -80,7 +80,7 @@ getPoints c =
|
||||
element (ns "trk") >>= descendant >>=
|
||||
element (ns "trkpt")
|
||||
in
|
||||
(List.map elToPoint trkpts)
|
||||
List.map elToPoint trkpts
|
||||
|
||||
parse :: String -> Either SomeException [Point]
|
||||
parse str = do
|
||||
@ -88,4 +88,4 @@ parse str = do
|
||||
return (getPoints (fromDocument gpx))
|
||||
|
||||
length :: Track -> Int
|
||||
length trk = Data.List.length trk
|
||||
length = Data.List.length
|
||||
|
@ -28,11 +28,11 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/
|
||||
wrap x = preamble ++ x ++ "</gpx>"
|
||||
|
||||
|
||||
onepoint = wrap $
|
||||
onepoint = wrap
|
||||
"<trk> <trkseg> \n\
|
||||
\<trkpt lat=\"51\" lon=\"-0.1\"> </trkpt> \n\
|
||||
\</trkseg> </trk>"
|
||||
onepointWithAttrs = wrap $
|
||||
onepointWithAttrs = wrap
|
||||
"<trk> <trkseg> \n\
|
||||
\<trkpt lat=\"51\" lon=\"-0.1\"> \n\
|
||||
\ <ele>25.2</ele>\n\
|
||||
|
Loading…
Reference in New Issue
Block a user