forked from julienchan/purescript-vault
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
230 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# https://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
name: Bug report | ||
about: Report an issue | ||
title: "" | ||
labels: bug | ||
assignees: "" | ||
--- | ||
|
||
**Describe the bug** | ||
|
||
A clear and concise description of the bug. | ||
|
||
**To Reproduce** | ||
|
||
A minimal code example (preferably a runnable example on [Try PureScript](https://try.purescript.org)!) or steps to reproduce the issue. | ||
|
||
**Expected behavior** | ||
|
||
A clear and concise description of what you expected to happen. | ||
|
||
**Additional context** | ||
|
||
Add any other context about the problem here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
name: Change request | ||
about: Propose an improvement to this library | ||
title: "" | ||
labels: "" | ||
assignees: "" | ||
--- | ||
|
||
**Is your change request related to a problem? Please describe.** | ||
|
||
A clear and concise description of the problem. | ||
|
||
Examples: | ||
|
||
- It's frustrating to have to [...] | ||
- I was looking for a function to [...] | ||
|
||
**Describe the solution you'd like** | ||
|
||
A clear and concise description of what a good solution to you looks like, including any solutions you've already considered. | ||
|
||
**Additional context** | ||
|
||
Add any other context about the change request here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
blank_issues_enabled: false | ||
contact_links: | ||
- name: PureScript Discourse | ||
url: https://discourse.purescript.org/ | ||
about: Ask and answer questions on the PureScript discussion forum. | ||
- name: PureScript Discord | ||
url: https://purescript.org/chat | ||
about: Ask and answer questions on the PureScript chat. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
**Description of the change** | ||
|
||
Clearly and concisely describe the purpose of the pull request. If this PR relates to an existing issue or change proposal, please link to it. Include any other background context that would help reviewers understand the motivation for this PR. | ||
|
||
--- | ||
|
||
**Checklist:** | ||
|
||
- [ ] Added the change to the changelog's "Unreleased" section with a link to this PR and your username | ||
- [ ] Linked any existing issues or proposals that this pull request should close | ||
- [ ] Updated or added relevant documentation in the README and/or documentation directory | ||
- [ ] Added a test for the contribution (if applicable) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
branches: [master] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up a PureScript toolchain | ||
uses: purescript-contrib/setup-purescript@main | ||
|
||
- name: Cache PureScript dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
key: ${{ runner.os }}-spago-${{ hashFiles('**/*.dhall') }} | ||
path: | | ||
.spago | ||
output | ||
- name: Install dependencies | ||
run: spago install | ||
|
||
- name: Build source | ||
run: spago build --no-install --purs-args '--censor-lib --strict' | ||
|
||
- name: Run tests | ||
run: spago -x test.dhall test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
/bower_components/ | ||
/node_modules/ | ||
/.pulp-cache/ | ||
/output/ | ||
/generated-docs/ | ||
/.psc* | ||
/.purs* | ||
/.psa* | ||
.* | ||
!.gitignore | ||
!.github | ||
!.editorconfig | ||
!.tidyrc.json | ||
|
||
output | ||
generated-docs | ||
bower_components |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Changelog | ||
|
||
Notable changes to this project are documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
|
||
Breaking changes: | ||
|
||
New features: | ||
|
||
Bugfixes: | ||
|
||
Other improvements: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Contributing to Vault | ||
|
||
Thanks for your interest in contributing to `vault`! We welcome new contributions regardless of your level of experience or familiarity with PureScript. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,56 @@ | ||
### Vault | ||
# Vault | ||
|
||
A typed, persistent store for values of arbitrary types. This is a port of the haskell [Vault](https://github.com/HeinrichApfelmus/vault) library Heinrich Apfelmus. | ||
[![CI](https://github.com/purescript-community/purescript-vault/workflows/CI/badge.svg?branch=master)](https://github.com/purescript-community/purescript-vault/actions?query=workflow%3ACI+branch%3Amaster) | ||
[![Release](https://img.shields.io/github/release/purescript-community/purescript-vault.svg)](https://github.com/purescript-community/purescript-vault/releases) | ||
[![Pursuit](https://pursuit.purescript.org/packages/purescript-vault/badge)](https://pursuit.purescript.org/packages/purescript-vault) | ||
[![Maintainer: nsaunders](https://img.shields.io/badge/maintainer-nsaunders-teal.svg)](https://github.com/nsaunders) | ||
|
||
Think of it as ```Map``` that can store for values of arbitrary types, but it's type-safe. | ||
You can store of any types by creating ```Key a``` first, this key used to parameterized the | ||
type you are going to store in vault. | ||
A typed, persistent store for values of arbitrary types. This is a port of the haskell [Vault](https://github.com/HeinrichApfelmus/vault) library Heinrich Apfelmus. | ||
|
||
In summary a vault API: | ||
Think of it as Map that can store for values of arbitrary types, but it's type-safe. You can store of any types by creating Key a first, this key used to parameterized the type you are going to store in vault. | ||
|
||
```haskell | ||
```purescript | ||
data Vault | ||
data Key a | ||
newKey :: forall e a. Eff (ref :: REF | e) (Key a) | ||
newKey :: forall a. Effect (Key a) | ||
empty :: Vault | ||
lookup :: forall a. Key a -> Vault -> Maybe a | ||
insert :: forall a. Key a -> a -> Vault -> Vault | ||
delete :: forall a. Key a -> Vault -> Vault | ||
``` | ||
|
||
## Installation | ||
|
||
Install `vault` with [Spago](https://github.com/purescript/spago): | ||
|
||
```sh | ||
spago install vault | ||
``` | ||
|
||
## Quick start | ||
|
||
The quick start hasn't been written yet (contributions are welcome!). The quick start covers a common, minimal use case for the library, whereas longer examples and tutorials are kept in the [docs directory](./docs). | ||
|
||
## Documentation | ||
|
||
`vault` documentation is stored in a few places: | ||
|
||
1. Module documentation is [published on Pursuit](https://pursuit.purescript.org/packages/purescript-vault). | ||
2. Written documentation is kept in the [docs directory](./docs). | ||
3. Usage examples can be found in [the test suite](./test). | ||
|
||
If you get stuck, there are several ways to get help: | ||
|
||
- [Open an issue](https://github.com/purescript-community/purescript-vault/issues) if you have encountered a bug or problem. | ||
- Ask general questions on the [PureScript Discourse](https://discourse.purescript.org) forum or the [PureScript Discord](https://discord.com/invite/sMqwYUbvz6) chat. | ||
|
||
## Contributing | ||
|
||
You can contribute to `vault` in several ways: | ||
|
||
1. If you encounter a problem or have a question, please [open an issue](https://github.com/purescript-community/purescript-vault/issues). We'll do our best to work with you to resolve or answer it. | ||
|
||
2. If you would like to contribute code, tests, or documentation, please [read the contributor guide](./CONTRIBUTING.md). It's a short, helpful introduction to contributing to this library, including development instructions. | ||
|
||
3. If you have written a library, tutorial, guide, or other resource based on this package, please share it on the [PureScript Discourse](https://discourse.purescript.org)! Writing libraries and learning resources are a great way to help this library succeed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Vault Documentation | ||
|
||
This directory contains documentation for `vault`. If you are interested in contributing new documentation, please read the [contributor guidelines](../CONTRIBUTING.md) and [What Nobody Tells You About Documentation](https://documentation.divio.com) for help getting started. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
let upstream = | ||
https://github.com/purescript/package-sets/releases/download/psc-0.15.4-20221015/packages.dhall | ||
sha256:4949f9f5c3626ad6a83ea6b8615999043361f50905f736bc4b7795cba6251927 | ||
|
||
in upstream |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
let | ||
pkgs = import (builtins.fetchTarball { | ||
url = "https://github.com/NixOS/nixpkgs/archive/21.11.tar.gz"; | ||
}) {}; | ||
|
||
# To update to a newer version of easy-purescript-nix: | ||
# 1. Obtain the commit hash <rev> via `curl https://api.github.com/repos/justinwoo/easy-purescript-nix/commits/master`. | ||
# 2. Obtain the sha256 hash <sha256> via `nix-prefetch-url --unpack https://github.com/justinwoo/easy-purescript-nix/archive/<rev>.tar.gz`. | ||
# 3. Update the <rev> and <sha256> below. | ||
pursPkgs = import (pkgs.fetchFromGitHub { | ||
owner = "justinwoo"; | ||
repo = "easy-purescript-nix"; | ||
rev = "ee51a6d459b8fecfcb10f24ca9728e649c6a9e00"; | ||
sha256 = "1w4k6mcayyg6388na0cca5qx94sm99xn3na26x2w34jlyz3bwl3m"; | ||
}) {inherit pkgs;}; | ||
in | ||
pkgs.stdenv.mkDerivation { | ||
name = "tecton"; | ||
buildInputs = with pursPkgs; [ | ||
purs | ||
spago | ||
pulp | ||
purs-tidy | ||
|
||
pkgs.nodejs-16_x | ||
pkgs.nodePackages.bower | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ name = "vault" | ||
, dependencies = [ "effect", "functions", "maybe", "prelude", "refs" ] | ||
, packages = ./packages.dhall | ||
, sources = [ "src/**/*.purs" ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
let conf = ./spago.dhall | ||
|
||
in conf // { | ||
sources = conf.sources # ["test/**/*.purs"], | ||
dependencies = conf.dependencies # ["console"] | ||
} |