How do I add UndefinedOr to my package set?

It would be ideal if someone can tell me what to past into packages.dhall

Hi,

assuming you are looking for this package you’d have to add something like this to your packages.dhall:

let upstream = -- <package set URL here>
in  upstream
  with undefined-or =
    { dependencies =
        [ "maybe"
        ]
    , repo =
        "https://github.com/d86leader/purescript-undefined-or.git"
    , version =
        "v1.0.1"  -- seems to be the latest Tag you could add `master` too
    }

Basically I copied this snippet from the spago-docs, updated the name, the repo and version field and then took the dependencies from the spago.dhall file on the github for the package to add and inserted it here.


Having said this: The package in question seems to be 2 years old so it will most likely not work directly with the current compiler so you will most likely have to clone the repository, updated the source code to compile against the current eco-system and then use your version (can be local in your file system too).

1 Like

I had a look (see PR) and it’s no big deal to push this repo to PureScript 0.15.4 so it should work for you if you change to

let upstream = -- <package set URL here>
in  upstream
  with undefined-or =
    { dependencies =
        [ "prelude"
        , "control"
        , "maybe"
        ]
    , repo =
        "https://github.com/CarstenKoenig/purescript-undefined-or.git"
    , version =
        "purs15"
    }

for now (hope the PR will get merged so this is not necessary any more).

1 Like

Just to make sure I tried it all and setup a new project with spago - after you can for example change the packages.dhall to:

let upstream =
      https://github.com/purescript/package-sets/releases/download/psc-0.15.4-20220816/packages.dhall
        sha256:8b4467b4b5041914f9b765779c8936d6d4c230b1f60eb64f6269c71812fd7e98

in  upstream
  with undefined-or =
    { dependencies =
        [ "prelude"
        , "control"
        , "maybe"
        ]
    , repo =
        "https://github.com/CarstenKoenig/purescript-undefined-or.git"
    , version =
        "purs15"
    }

and do spago install undefined-or - after a spago build the package should be available in *VS.code` - have fun.


EDIT: The changes got merged in so you can use the master branch of the original repo instead of my fork :heart:

1 Like

Thanks! It works well with that packages.dhall but if I change CarstenKoenig to d86leader I get

[error] 
Failed to install dependency "undefined-or"
Git output:

Cloning into '.'...
error: pathspec 'purs15' did not match any file(s) known to git

Ok - look for the purs15 (that was the name of my branch where I did the changes) and change it to master:

in  upstream
  with undefined-or =
    { dependencies =
        [ "prelude"
        , "control"
        , "maybe"
        ]
    , repo =
        "https://github.com/CarstenKoenig/purescript-undefined-or.git"
    , version =
        "master"
    }

Thank you very much.