-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from danslapman/refactor/sequence
Use Data.Sequence instead of Deque
- Loading branch information
Showing
11 changed files
with
70 additions
and
81 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
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,6 @@ | ||
b.$.value;a | ||
field b2;field a0 | ||
field b xxx;field a0 | ||
field b1;field a1 | ||
field b2;field a2 | ||
field b xxx;field a2 |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,18 @@ | ||
module SequenceUtils where | ||
|
||
import Data.Foldable (find, toList) | ||
import qualified Data.List as L | ||
import qualified Data.Maybe as Mb (mapMaybe) | ||
import Data.Sequence | ||
import Prelude hiding (concat, elem, foldl, foldl', foldl1, mapM, null, (++)) | ||
|
||
maybeNes :: Seq a -> Maybe (Seq a) | ||
maybeNes = find (not . null) . Just | ||
|
||
uniq :: Eq a => Seq a -> Seq a | ||
uniq = fromList . L.nub . toList | ||
|
||
mapMaybe :: (a -> Maybe b) -> Seq a -> Seq b | ||
mapMaybe _ Empty = empty | ||
mapMaybe pred dq = | ||
fromList . Mb.mapMaybe pred . toList $ dq |
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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
import Test.HUnit | ||
Check warning on line 1 in test/Spec.hs GitHub Actions / Build (ubuntu-latest, json2csv, json2csv-linux-amd64)
Check warning on line 1 in test/Spec.hs GitHub Actions / Build (windows-latest, json2csv.exe, json2csv-windows-amd64.exe)
Check warning on line 1 in test/Spec.hs GitHub Actions / Build (macos-13, json2csv, json2csv-macos-amd64)
|
||
|
||
main :: IO () | ||
main = putStrLn "Test suite not yet implemented" |