Formerly fission-suite/webnative-elm. Search finds this package by either name.
👻 Directory
👻 File
👻 Encapsulated
Convert a POSIX formatted string to a path.
This will return a Encapsulated path. To get a path of the type Path Directory or Path File, use the functions in the Webnative.Path.Encapsulated module.
>>> import Webnative.Path.Encapsulated
>>> "foo/bar/"
..> |> fromPosix
..> |> Webnative.Path.Encapsulated.toDirectory
Just (directory [ "foo", "bar" ])
>>> "foo/bar"
..> |> fromPosix
..> |> Webnative.Path.Encapsulated.toFile
Just (file [ "foo", "bar" ])Convert a path to the POSIX format.
>>> toPosix (directory [ "foo", "bar"])
"foo/bar/"
>>> toPosix (file [ "foo", "bar"])
"foo/bar"Encapsulate a path.
Get the path kind.
>>> kind (directory [])
Directory
>>> kind (file [])
File
Even if a path is encapsulated,
you can still check the kind of path it is.
>>> kind (encapsulate <| directory [])
Directory
>>> kind (encapsulate <| file [])
FileGet the path parts.
>>> unwrap (directory [ "foo", "bar" ])
[ "foo", "bar" ]
>>> unwrap (file [ "foo", "bar" ])
[ "foo", "bar" ]
Path type.
This is used with the phantom 👻 types.