eco-pro/project-metadata-utils/1.0.0

Rerouted (archive, verified). The original repository is gone. This copy comes from an archive (Software Heritage). The Lamdera package server serves a copy recovered from swh:1:rev:ccedc9b26200893c07fe8295a6a061cb4d4b8e7f (Software Heritage, origin https://github.com/eco-pro/project-metadata-utils).

What we checked: Software Heritage archived tag 1.0.0 of github.com/eco-pro/project-metadata-utils at commit ccedc9b26200; its commit ccedc9b26200 is from 2021-02-20 17:08 UTC, before the version was published (2021-02-20 17:14 UTC); elm.json is byte-identical to package.elm-lang.org's; the exposed modules match docs.json; the zip is our own, made from Software Heritage's copy of the files Elm uses, so its SHA-1 is not the published one.

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/eco-pro/project-metadata-utils/zipball/1.0.0/

Elm.Constraint

Helpers for working with version constraint strings in elm.json files.

Constraint

A guaranteed valid Elm constraint. That means the lower bound v1 and the upper bound v2 are both valid Elm.Version versions, and v1 <= v2 is guaranteed.

check : Version -> Constraint -> Bool

Check if a version is within the given constraint:

import Elm.Version as V


oneToTwo = fromString "1.0.0 <= v < 2.0.0"
sixToTen = fromString "6.0.0 <= v < 10.0.0"


-- Maybe.map (check V.one) oneToTwo == Just True
-- Maybe.map (check V.one) sixToTen == Just False

String Conversions

toString : Constraint -> String

Convert a Constraint to a String that works in elm.json

fromString : String -> Maybe Constraint

Try to convert a String into a Constraint:

fromString "1.0.0 <= v < 2.0.0"   == Just ...
fromString "1.0.0 <= v < 10.0.0"  == Just ...
fromString "1.0.0 <= v <= 1.0.0"  == Just ...


fromString "1.0.0"                == Nothing
fromString "1.0.0 <= 2.0.0"       == Nothing
fromString "1.0.0 <=  v  < 2.0.0" == Nothing -- extra spaces
fromString "1.0.0 <= vsn < 2.0.0" == Nothing -- not "v" only
fromString "2.0.0 <= v < 1.0.0"   == Nothing -- unsatisfiable

JSON Conversions

encode : Constraint -> Value

Turn a Constraint into a string for use in elm.json

Decode the constraint strings that appear in elm.json