Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move module Track.Range to flight-clip, add modlue Igc.Fix, #249.
- Loading branch information
1 parent
20192da
commit b358cb4
Showing
14 changed files
with
106 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module Main (main) where | ||
|
||
import Test.DocTest (doctest) | ||
|
||
arguments :: [String] | ||
arguments = | ||
[ "-isrc" | ||
, "library/Flight/Track/Range.hs" | ||
] | ||
|
||
main :: IO () | ||
main = doctest arguments |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
module Flight.Igc.Fix | ||
( igcEqOrEqOnTime | ||
, igcBumpOver | ||
) where | ||
|
||
import Flight.Igc.Record | ||
import Flight.Track.Range (asRollovers) | ||
|
||
igcEqOrEqOnTime :: IgcRecord -> IgcRecord -> Bool | ||
igcEqOrEqOnTime (B t0 _ _ _ _) (B t1 _ _ _ _) = t0 == t1 | ||
igcEqOrEqOnTime a b = a == b | ||
|
||
-- | The B record only records time of day. If the sequence is not increasing | ||
-- then for every rollback add a bump 24 hrs. | ||
-- | ||
-- >>> asRollovers [7,9,2,3] | ||
-- [[7,9],[2,3]] | ||
igcBumpOver :: [IgcRecord] -> [IgcRecord] | ||
igcBumpOver xs = | ||
bumpOver | ||
(flip $ addHoursIgc . Hour . show) | ||
[0 :: Integer, 24..] | ||
xs | ||
|
||
-- | Apply a bump from a list every time there is a roll over. | ||
-- | ||
-- >>> bumpOver (+) [0,10..] [7,9,2,3,1] | ||
-- [7,9,12,13,21] | ||
bumpOver :: Ord a => (a -> b -> a) -> [b] -> [a] -> [a] | ||
bumpOver add ns xs = | ||
concat | ||
[ (`add` n) <$> ys | ||
| ys <- asRollovers xs | ||
| n <- ns | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters