aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpacien2020-06-15 05:34:33 +0200
committerpacien2020-06-16 18:23:01 +0200
commit34b90f08a21fbe3f1928e16a8ea48f1fc7453e4e (patch)
treee6fb001da6c1b6e025f700920fcebfb306d00572
parent00c6216259d8a7b131307953ba5000d2b5dc564b (diff)
downloadldgallery-34b90f08a21fbe3f1928e16a8ea48f1fc7453e4e.tar.gz
compiler/Files: simplify subPaths computation
Ignoring subsequences that aren't rooted
-rw-r--r--compiler/src/Files.hs7
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
31import Data.List (isPrefixOf, length, subsequences, sortOn) 31import Data.List (isPrefixOf, length, sortOn)
32import Data.Function ((&)) 32import Data.Function ((&))
33import Data.Functor ((<&>)) 33import Data.Functor ((<&>))
34import Data.Text (pack) 34import Data.Text (pack)
@@ -81,7 +81,10 @@ fileName (Path (name:_)) = Just name
81fileName _ = Nothing 81fileName _ = Nothing
82 82
83subPaths :: Path -> [Path] 83subPaths :: Path -> [Path]
84subPaths (Path path) = map Path $ subsequences path 84subPaths (Path path) = map Path $ subpaths path
85 where
86 subpaths [] = []
87 subpaths full@(_:r) = full : subpaths r
85 88
86pathLength :: Path -> Int 89pathLength :: Path -> Int
87pathLength (Path path) = Data.List.length path 90pathLength (Path path) = Data.List.length path