@@ -205,15 +205,10 @@ foldPath r f g = case _ of
205205
206206-- | Peels off the last directory and the terminal file or directory name
207207-- | from the path. Returns `Nothing` if the path is `rootDir` / `currentDir` or
208- -- | some `parentOf p`, so you might wanna [canonicalize](#v:canonicalize) first,
209- -- | or use [`peel'`](#v:peel').
208+ -- | some `parentOf p`, so you might wanna [`canonicalize`](#v:canonicalize) path first.
210209peel :: forall a b . Path a b -> Maybe (Tuple (Path a Dir ) (Name b ))
211210peel = foldPath Nothing (const Nothing ) (\p n -> Just (Tuple p n))
212211
213- -- | Same as [`peel`](#v:peel) but input is first [canonicalized](#v:canonicalize).
214- peel' :: forall a b . IsRelOrAbs a => Path a b -> Maybe (Tuple (Path a Dir ) (Name b ))
215- peel' = canonicalize >>> peel
216-
217212-- | Peels off the last director and terminal file from a path. Unlike the
218213-- | general `peel` function this is guaranteed to return a result, as `File`
219214-- | paths are known to have a name.
@@ -256,12 +251,16 @@ renameTraverse f = case _ of
256251 p -> pure p
257252
258253-- | Sets the extension on the terminal segment of a path. If the path is
259- -- | `rootDir` / `currentDir` or some `parentOf p` this will have no effect. If
260- -- | the passed string is empty, this will remove any existing extension.
254+ -- | `rootDir` / `currentDir` or some `parentOf p` this will have no effect,
255+ -- | so in some cases you might need to [`canonicalize`](#v:canonicalize)
256+ -- | path first. If the passed string is empty, this will remove any existing
257+ -- | extension.
261258-- |
262259-- | ```purescript
263260-- | file "image" <.> "png"
264261-- | ```
262+ -- | See [`splitName`](Pathy.Name#v:splitName) and [`alterExtension`](Pathy.Name#v:alterExtension)
263+ -- | fore more examples.
265264setExtension :: forall a b . Path a b -> String -> Path a b
266265setExtension p ext = rename (alterExtension (const (NES .fromString ext))) p
267266
0 commit comments