diff options
author | pacien | 2020-06-15 05:34:33 +0200 |
---|---|---|
committer | pacien | 2020-06-16 18:23:01 +0200 |
commit | 34b90f08a21fbe3f1928e16a8ea48f1fc7453e4e (patch) | |
tree | e6fb001da6c1b6e025f700920fcebfb306d00572 /compiler/src/Files.hs | |
parent | 00c6216259d8a7b131307953ba5000d2b5dc564b (diff) | |
download | ldgallery-34b90f08a21fbe3f1928e16a8ea48f1fc7453e4e.tar.gz |
compiler/Files: simplify subPaths computation
Ignoring subsequences that aren't rooted
Diffstat (limited to 'compiler/src/Files.hs')
-rw-r--r-- | compiler/src/Files.hs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/src/Files.hs b/compiler/src/Files.hs index 40149e1..1f14e7f 100644 --- a/compiler/src/Files.hs +++ b/compiler/src/Files.hs | |||
@@ -28,7 +28,7 @@ module Files | |||
28 | ) where | 28 | ) where |
29 | 29 | ||
30 | 30 | ||
31 | import Data.List (isPrefixOf, length, subsequences, sortOn) | 31 | import Data.List (isPrefixOf, length, sortOn) |
32 | import Data.Function ((&)) | 32 | import Data.Function ((&)) |
33 | import Data.Functor ((<&>)) | 33 | import Data.Functor ((<&>)) |
34 | import Data.Text (pack) | 34 | import Data.Text (pack) |
@@ -81,7 +81,10 @@ fileName (Path (name:_)) = Just name | |||
81 | fileName _ = Nothing | 81 | fileName _ = Nothing |
82 | 82 | ||
83 | subPaths :: Path -> [Path] | 83 | subPaths :: Path -> [Path] |
84 | subPaths (Path path) = map Path $ subsequences path | 84 | subPaths (Path path) = map Path $ subpaths path |
85 | where | ||
86 | subpaths [] = [] | ||
87 | subpaths full@(_:r) = full : subpaths r | ||
85 | 88 | ||
86 | pathLength :: Path -> Int | 89 | pathLength :: Path -> Int |
87 | pathLength (Path path) = Data.List.length path | 90 | pathLength (Path path) = Data.List.length path |