Skip to content

Commit 373fc41

Browse files
committed
fix peel type
1 parent 6dad268 commit 373fc41

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/Data/Path/Pathy.purs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -332,21 +332,15 @@ infixl 6 parentAppend as <..>
332332
-- | if the last path segment is root directory, current directory, or parent
333333
-- | directory).
334334
peel
335-
:: forall a b s
336-
. Path a b s
337-
-> Maybe (Tuple (Path a Dir Unsandboxed) (Name b))
338-
peel = unsafeCoerce unsafePeel
339-
340-
unsafePeel
341335
:: forall a b s
342336
. Path a b s
343337
-> Maybe (Tuple (Path a Dir s) (Name b))
344-
unsafePeel Current = Nothing
345-
unsafePeel Root = Nothing
346-
unsafePeel p@(ParentIn _) = case canonicalize' p of
347-
Tuple true p' -> unsafePeel p'
338+
peel Current = Nothing
339+
peel Root = Nothing
340+
peel p@(ParentIn _) = case canonicalize' p of
341+
Tuple true p' -> peel p'
348342
_ -> Nothing
349-
unsafePeel (In p n) = Just $ Tuple p n
343+
peel (In p n) = Just $ Tuple p n
350344

351345
-- | Returns the depth of the path. This may be negative in some cases, e.g.
352346
-- | `./../../../` has depth `-3`.
@@ -482,7 +476,7 @@ relativeTo p1 p2 = relativeTo' (canonicalize p1) (canonicalize p2)
482476
relativeTo' cp1 cp2
483477
| identicalPath cp1 cp2 = pure Current
484478
| otherwise = do
485-
Tuple cp1Path name <- unsafePeel cp1
479+
Tuple cp1Path name <- peel cp1
486480
rel <- relativeTo' cp1Path cp2
487481
pure case dirOrFileName name of
488482
Left dirN -> joinSplit $ rel </> In (Current :: Path Rel Dir s') dirN

0 commit comments

Comments
 (0)