From 34b90f08a21fbe3f1928e16a8ea48f1fc7453e4e Mon Sep 17 00:00:00 2001 From: pacien Date: Mon, 15 Jun 2020 05:34:33 +0200 Subject: compiler/Files: simplify subPaths computation Ignoring subsequences that aren't rooted --- compiler/src/Files.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'compiler') 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 ) where -import Data.List (isPrefixOf, length, subsequences, sortOn) +import Data.List (isPrefixOf, length, sortOn) import Data.Function ((&)) import Data.Functor ((<&>)) import Data.Text (pack) @@ -81,7 +81,10 @@ fileName (Path (name:_)) = Just name fileName _ = Nothing subPaths :: Path -> [Path] -subPaths (Path path) = map Path $ subsequences path +subPaths (Path path) = map Path $ subpaths path + where + subpaths [] = [] + subpaths full@(_:r) = full : subpaths r pathLength :: Path -> Int pathLength (Path path) = Data.List.length path -- cgit v1.2.3