Skip to content

Commit ae145cd

Browse files
committed
clenup appendPath
1 parent c2f5cdd commit ae145cd

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/Data/Path/Pathy.purs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -276,18 +276,14 @@ pathName :: forall b s. AnyPath b s -> Either (Maybe (Name Dir)) (Name File)
276276
pathName = bimap dirName fileName
277277

278278
-- | Given a directory path, appends either a file or directory to the path.
279-
appendPath :: forall a b s. SplitDirOrFile b => Path a Dir s -> Path Rel b s -> Path a b s
279+
appendPath :: forall a b s. Path a Dir s -> Path Rel b s -> Path a b s
280280
appendPath _ Root = unsafeCrashWith "Imposible as Root can't be Path Rel"
281281
appendPath Current Current = Current
282282
appendPath Root Current = Root
283-
-- TODO this shold be correct?
284-
-- appendPath (ParentIn p) c@Current = ParentIn (p </> c)
285283
appendPath (ParentIn p) Current = ParentIn (p </> Current)
286-
appendPath (In p1 (Name f1)) c@Current = case dirOrFile c of
287-
Left dir -> In (p1 </> dir) (Name f1)
288-
Right _ -> unsafeCrashWith "Imposible"
284+
appendPath (In p (Name d)) Current = In (p </> Current) (Name d)
289285
appendPath p1 (ParentIn p2) = ParentIn (p1 </> p2)
290-
appendPath p1 (In p2 f2) = In (p1 </> p2) f2
286+
appendPath p1 (In p2 n2) = In (p1 </> p2) n2
291287

292288
infixl 6 appendPath as </>
293289

@@ -306,8 +302,7 @@ infixl 6 setExtension as <.>
306302
-- | its previous sandbox.
307303
parentAppend
308304
:: forall a b s s'
309-
. SplitDirOrFile b
310-
=> Path a Dir s
305+
. Path a Dir s
311306
-> Path Rel b s'
312307
-> Path a b Unsandboxed
313308
parentAppend d p = parentDir d </> unsandbox p
@@ -346,7 +341,7 @@ unsandbox (In p n) = In (unsandbox p) n
346341

347342
-- | Creates a path that points to the parent directory of the specified path.
348343
-- | This function always unsandboxes the path.
349-
parentDir :: forall a b s. Path a Dir s -> Path a Dir Unsandboxed
344+
parentDir :: forall a s. Path a Dir s -> Path a Dir Unsandboxed
350345
parentDir = ParentIn <<< unsandbox
351346

352347
unsafeCoerceType :: forall a b b' s. Path a b s -> Path a b' s

0 commit comments

Comments
 (0)