fission-suite/webnative-elm/6.1.0

NOTE: the latest version is 7.0.0

Renamed to fission-codes/webnative-elm. It is published under that name, and new versions come out there.

Versions published as fission-suite/webnative-elm still install under that name. 9 versions of 9 come from the new location (see their notes).

Rerouted (renamed, verified). The GitHub user or repository was renamed. The tag is still there, at the new name. The Lamdera package server serves a copy recovered from https://github.com/fission-codes/webnative-elm.

What we checked: The repo moved to github.com/fission-codes/webnative-elm. Rebuilt with git archive from commit db7e93f9be10 of https://github.com/fission-codes/webnative-elm (zip prefix fission-suite-webnative-elm-db7e93f/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 fea834566663f075cf2af19f2498a313cde4a11e.

The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.

Details · package.elm-lang.org's zip: https://github.com/fission-suite/webnative-elm/zipball/6.1.0/

Webnative.Path

Paths

type Path t

Path type.

This is used with the phantom 👻 types.

directoryPath : Path Directory


filePath : Path File


encapsulatedPath : Path Encapsulated

👻 Directory

type File

👻 File

👻 Encapsulated

type Kind
= Directory
| File

Creation

directory : List String -> Path Directory

Create a directory path.

directory [ "Audio", "Playlists" ]
file : List String -> Path File

Create a file path.

file [ "Document", "invoice.pdf" ]

Root directory.

POSIX

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" ])
toPosix : Path t -> String

Convert a path to the POSIX format.

>>> toPosix (directory [ "foo", "bar"])
"foo/bar/"


>>> toPosix (file [ "foo", "bar"])
"foo/bar"

Encapsulation

Encapsulate a path.

Functions

kind : Path t -> Kind

Get the path kind.

>>> kind (directory [])
Directory


>>> kind (file [])
File
map : (List String -> List String) -> Path t -> Path t

Map.

unwrap : Path t -> List String

Get the path parts.

>>> unwrap (directory [ "foo", "bar" ])
[ "foo", "bar" ]


>>> unwrap (file [ "foo", "bar" ])
[ "foo", "bar" ]

Miscellaneous

encode : Path t -> Value

Encode to JSON.

>>> import Json.Encode


>>> [ "foo" ]
..>   |> directory
..>   |> encode
..>   |> Json.Encode.encode 0
"{\"directory\":[\"foo\"]}"


>>> [ "bar" ]
..>   |> file
..>   |> encode
..>   |> Json.Encode.encode 0
"{\"file\":[\"bar\"]}"