purescript-contrib / purescript-profunctor-lenses

Pure profunctor lenses
MIT License
144 stars 51 forks source link

Update according to Contributors library guidelines #121

Closed maxdeviant closed 3 years ago

maxdeviant commented 3 years ago

This pull request is part of an effort to update and standardize the Contributors libraries according to the Library Guidelines. Specifically, it:

  1. Adjusts the files and repository structure according to the repository structure section of the guidelines, which includes standard pr templates, issue templates, CI in GitHub Actions, automatic stale issue management, ensures the project uses Spago, and so on.
  2. Updates the README and documentation according to the documentation section of the guidelines. This is a first step towards ensuring Contributors libraries have adequate module documentation, READMEs, a docs directory, and tests (even if just usage examples) in a test directory.
  3. Updates labels where relevant to help folks better sift through issues on this library and get started contributing.

This PR is the groundwork for followup efforts to ensure contributor libraries are kept up-to-date, documented, tested, and accessible to users and new contributors.

maxdeviant commented 3 years ago

Verified that spago build and spago test work as expected:

λ spago build
[info] Installation complete.
[info] Build succeeded.
λ spago test
[info] Installation complete.
[info] Build succeeded.
"Hello World"
(Tuple "bar" "foo")
(Just 2)
[1.0,2.0,3.0]
2
(Tuple 0 1)
(Tuple 4 "FooBar")
(Tuple 1 (Tuple 0 2))
(Tuple 4 6)
(Just 1)
[info] Tests succeeded.
maxdeviant commented 3 years ago

I wasn't sure what to do about the examples directory. I tried including it in the sources in spago.dhall:

- , sources = [ "src/**/*.purs", "test/**/*.purs" ]
+ , sources = [ "src/**/*.purs", "test/**/*.purs", "examples/**/*.purs ]

but doing so causes spago build to fail with the following:

λ spago build
[info] Installation complete.
Error 1 of 6:

  in module PrismsForSumTypes
  at examples/src/PrismsForSumTypes.purs:34:1 - 34:21 (line 34, column 1 - line 34, column 21)

    Module Color was not found.
    Make sure the source file exists, and that it has been provided as an input to the compiler.

  See https://github.com/purescript/documentation/blob/master/errors/ModuleNotFound.md for more information,
  or to contribute content related to this error.

Error 2 of 6:

  in module PrismsForSumTypes
  at examples/src/PrismsForSumTypes.purs:35:1 - 35:22 (line 35, column 1 - line 35, column 22)

    Module Color was not found.
    Make sure the source file exists, and that it has been provided as an input to the compiler.

  See https://github.com/purescript/documentation/blob/master/errors/ModuleNotFound.md for more information,
  or to contribute content related to this error.

Error 3 of 6:

  in module PrismsForSumTypes
  at examples/src/PrismsForSumTypes.purs:37:1 - 37:40 (line 37, column 1 - line 37, column 40)

    Module Data.Generic.Rep was not found.
    Make sure the source file exists, and that it has been provided as an input to the compiler.

  See https://github.com/purescript/documentation/blob/master/errors/ModuleNotFound.md for more information,
  or to contribute content related to this error.

Error 4 of 6:

  in module PrismsForSumTypes
  at examples/src/PrismsForSumTypes.purs:38:1 - 38:34 (line 38, column 1 - line 38, column 34)

    Module Data.Generic.Rep.Eq was not found.
    Make sure the source file exists, and that it has been provided as an input to the compiler.

  See https://github.com/purescript/documentation/blob/master/errors/ModuleNotFound.md for more information,
  or to contribute content related to this error.

Error 5 of 6:

  in module PrismsForSumTypes
  at examples/src/PrismsForSumTypes.purs:39:1 - 39:38 (line 39, column 1 - line 39, column 38)

    Module Data.Generic.Rep.Show was not found.
    Make sure the source file exists, and that it has been provided as an input to the compiler.

  See https://github.com/purescript/documentation/blob/master/errors/ModuleNotFound.md for more information,
  or to contribute content related to this error.

Error 6 of 6:

  in module PrismsForSumTypes
  at examples/src/PrismsForSumTypes.purs:40:1 - 40:43 (line 40, column 1 - line 40, column 43)

    Module Data.Record.ShowRecord was not found.
    Make sure the source file exists, and that it has been provided as an input to the compiler.

  See https://github.com/purescript/documentation/blob/master/errors/ModuleNotFound.md for more information,
  or to contribute content related to this error.

[error] Failed to build.
JordanMartinez commented 3 years ago

The examples/**/*.purs glob shouldn't be included in the normal spago.dhall file. Rather, that should be added in a separate examples.dhall file that adds in these additional dependencies. Something like:

let config = ./spago.dhall
in config
  with dependencies = config.dependencies # [ newDependency ]
  with sources = config.sources # [ "examples/**/*.purs" ]
maxdeviant commented 3 years ago

The examples are now functional and I added a note in the quick start about how to run them.