1212#endif
1313
1414-- |
15- -- Module : Streamly.Internal.FileSystem.OS_PATH.Typed
15+ -- Module : Streamly.Internal.FileSystem.OS_PATH.SegNode
1616-- Copyright : (c) 2023 Composewell Technologies
1717-- License : BSD3
18182323-- a) or Dir (Rooted a) are not allowed but Rooted (Dir a) and Rooted (File a) are
2424-- allowed.
2525
26- module Streamly.Internal.FileSystem.OS_PATH.Typed
26+ module Streamly.Internal.FileSystem.OS_PATH.SegNode
2727 (
2828 -- * Statically Verified Path Literals
2929 -- | Quasiquoters.
@@ -65,9 +65,9 @@ For APIs that have not been released yet.
6565>>> import Streamly.Internal.FileSystem.PosixPath (PosixPath)
6666>>> import Streamly.Internal.FileSystem.PosixPath.Node (Dir, File, dir, file)
6767>>> import Streamly.Internal.FileSystem.PosixPath.Seg (Rooted, Branch, rt, br)
68- >>> import Streamly.Internal.FileSystem.PosixPath.Typed (rtdir, brdir, rtfile, brfile)
68+ >>> import Streamly.Internal.FileSystem.PosixPath.SegNode (rtdir, brdir, rtfile, brfile)
6969>>> import qualified Streamly.Internal.FileSystem.PosixPath as Path
70- >>> import qualified Streamly.Internal.FileSystem.PosixPath.Typed as PathTyp
70+ >>> import qualified Streamly.Internal.FileSystem.PosixPath.SegNode as SegNode
7171-}
7272
7373-- Note that (Rooted a) may also be a directory if "a" is (Dir b), but it can also
@@ -245,36 +245,36 @@ brfile = mkQ brfileE
245245-- If the second path does not have 'File' or 'Dir' information then the return
246246-- type too cannot have it.
247247--
248- -- >> Path.toString (PathTyp .append [rtdir|/usr|] [seg |bin|] :: Rooted PosixPath)
248+ -- >> Path.toString (SegNode .append [rtdir|/usr|] [br |bin|] :: Rooted PosixPath)
249249-- "/usr/bin"
250- -- >> Path.toString (PathTyp .append [brdir|usr|] [seg |bin|] :: Branch PosixPath)
250+ -- >> Path.toString (SegNode .append [brdir|usr|] [br |bin|] :: Branch PosixPath)
251251-- "usr/bin"
252252--
253- -- >> Path.toString (PathTyp .append [loc |/usr|] [seg |bin|] :: Rooted PosixPath)
253+ -- >> Path.toString (SegNode .append [rt |/usr|] [br |bin|] :: Rooted PosixPath)
254254-- "/usr/bin"
255- -- >> Path.toString (PathTyp .append [seg |usr|] [seg |bin|] :: Branch PosixPath)
255+ -- >> Path.toString (SegNode .append [br |usr|] [br |bin|] :: Branch PosixPath)
256256-- "usr/bin"
257257--
258258-- If the second path has 'File' or 'Dir' information then the return type
259259-- also has it.
260260--
261- -- >> Path.toString (PathTyp .append [loc |/usr|] [brdir|bin|] :: Rooted (Dir PosixPath))
261+ -- >> Path.toString (SegNode .append [rt |/usr|] [brdir|bin|] :: Rooted (Dir PosixPath))
262262-- "/usr/bin"
263- -- >> Path.toString (PathTyp .append [loc |/usr|] [brfile|bin|] :: Rooted (File PosixPath))
263+ -- >> Path.toString (SegNode .append [rt |/usr|] [brfile|bin|] :: Rooted (File PosixPath))
264264-- "/usr/bin"
265- -- >> Path.toString (PathTyp .append [seg |usr|] [brdir|bin|] :: Branch (Dir PosixPath))
265+ -- >> Path.toString (SegNode .append [br |usr|] [brdir|bin|] :: Branch (Dir PosixPath))
266266-- "usr/bin"
267- -- >> Path.toString (PathTyp .append [seg |usr|] [brfile|bin|] :: Branch (File PosixPath))
267+ -- >> Path.toString (SegNode .append [br |usr|] [brfile|bin|] :: Branch (File PosixPath))
268268-- "usr/bin"
269269--
270270-- Type error cases:
271271--
272- -- >> PathTyp .append [dir|/usr|] [seg |bin|] -- first arg must be Rooted/Branch
273- -- >> PathTyp .append [file|/usr|] [seg |bin|] -- first arg must be Rooted/Branch
274- -- >> PathTyp .append [rtfile|/usr|] [seg |bin|] -- first arg must be a dir
275- -- >> PathTyp .append [loc |/usr|] [loc |/bin|] -- second arg must be seg
276- -- >> PathTyp .append [loc |/usr|] [dir|bin|] -- second arg must be seg
277- -- >> PathTyp .append [loc |/usr|] [file|bin|] -- second arg must be seg
272+ -- >> SegNode .append [dir|/usr|] [br |bin|] -- first arg must be Rooted/Branch
273+ -- >> SegNode .append [file|/usr|] [br |bin|] -- first arg must be Rooted/Branch
274+ -- >> SegNode .append [rtfile|/usr|] [br |bin|] -- first arg must be a dir
275+ -- >> SegNode .append [rt |/usr|] [rt |/bin|] -- second arg must be seg
276+ -- >> SegNode .append [rt |/usr|] [dir|bin|] -- second arg must be seg
277+ -- >> SegNode .append [rt |/usr|] [file|bin|] -- second arg must be seg
278278--
279279{- # INLINE append #-}
280280append ::
@@ -290,13 +290,13 @@ append a (Branch c) = unsafeFromPath $ OS_NAME.unsafeAppend (toPath a) (toPath c
290290
291291-- | Append a branch type path to a directory.
292292--
293- -- >>> Path.toString (PathTyp .append [rtdir|/usr|] [brdir|bin|] :: Rooted (Dir PosixPath))
293+ -- >>> Path.toString (SegNode .append [rtdir|/usr|] [brdir|bin|] :: Rooted (Dir PosixPath))
294294-- "/usr/bin"
295- -- >>> Path.toString (PathTyp .append [rtdir|/usr|] [brfile|bin|] :: Rooted (File PosixPath))
295+ -- >>> Path.toString (SegNode .append [rtdir|/usr|] [brfile|bin|] :: Rooted (File PosixPath))
296296-- "/usr/bin"
297- -- >>> Path.toString (PathTyp .append [brdir|usr|] [brdir|bin|] :: Branch (Dir PosixPath))
297+ -- >>> Path.toString (SegNode .append [brdir|usr|] [brdir|bin|] :: Branch (Dir PosixPath))
298298-- "usr/bin"
299- -- >>> Path.toString (PathTyp .append [brdir|usr|] [brfile|bin|] :: Branch (File PosixPath))
299+ -- >>> Path.toString (SegNode .append [brdir|usr|] [brfile|bin|] :: Branch (File PosixPath))
300300-- "usr/bin"
301301--
302302{-# INLINE append #-}
0 commit comments