Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fluture-js/fluture-sanctuary-types
Fluture type definitions for Sanctuary
https://github.com/fluture-js/fluture-sanctuary-types
fluture sanctuary types
Last synced: about 2 months ago
JSON representation
Fluture type definitions for Sanctuary
- Host: GitHub
- URL: https://github.com/fluture-js/fluture-sanctuary-types
- Owner: fluture-js
- License: mit
- Created: 2017-05-13T14:15:13.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-04-06T11:19:12.000Z (over 3 years ago)
- Last Synced: 2024-11-05T17:27:09.315Z (about 2 months ago)
- Topics: fluture, sanctuary, types
- Language: JavaScript
- Size: 174 KB
- Stars: 19
- Watchers: 5
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# fluture-sanctuary-types
[Fluture][] type definitions for [Sanctuary][].
## Usage
### Node
```console
$ npm install --save fluture-sanctuary-types
```Note that you also need [Fluture][] and [sanctuary-def][] installed.
Sanctuary-def comes preinstalled with Sanctuary, so you could install
either one. Fluture has to be installed separately. See `package.json`
for compatible versions (defined in `peerDependencies`).On Node 12 and up, this module can be loaded directly with `import` or
`require`. On Node versions below 12, `require` or the [esm][]-loader can
be used.```js
import $ from 'sanctuary-def';
import sanctuary from 'sanctuary';
import {env, FutureType} from 'fluture-sanctuary-types/index.js';
import {resolve} from 'fluture/index.js';const S = sanctuary.create ({
checkTypes: process.env.NODE_ENV !== 'production',
env: sanctuary.env.concat (env)
});S.is (FutureType ($.String) ($.Number)) (resolve (42));
```### Deno and Modern Browsers
You can load the EcmaScript module from various content delivery networks:
- [Skypack](https://cdn.skypack.dev/[email protected])
- [JSPM](https://jspm.dev/[email protected])
- [jsDelivr](https://cdn.jsdelivr.net/npm/[email protected]/+esm)### Old Browsers and Code Pens
There's a [UMD][] file included in the NPM package, also available via
jsDelivr: https://cdn.jsdelivr.net/npm/[email protected]/dist/umd.jsThis file adds `flutureSanctuaryTypes` to the global scope, or use
CommonJS/AMD when available.```js
const $ = require ('sanctuary-def');
const sanctuary = require ('sanctuary');
const {env, FutureType} = require ('fluture-sanctuary-types');
const {resolve} = require ('fluture');const S = sanctuary.create ({
checkTypes: process.env.NODE_ENV !== 'production',
env: sanctuary.env.concat (env)
});S.is (FutureType ($.String) ($.Number)) (resolve (42));
```#### `FutureType :: Type -> Type -> Type`
The binary type constructor for members of Future.
```js
> $.test (env)
. (FutureType ($.String) ($.Number))
. (Future['fantasy-land/of'] (1));
true
```#### `ConcurrentFutureType :: Type -> Type -> Type`
The binary type constructor for members of ConcurrentFuture.
```js
> $.test (env)
. (ConcurrentFutureType ($.String) ($.Number))
. (Par['fantasy-land/of'] (1));
true
```#### `env :: Array Type`
An Array containing all types applied to [`$.Unknown`][Unknown] for
direct use as a Sanctuary environment, as shown in [Usage](#usage).[Fluture]: https://github.com/fluture-js/Fluture
[Sanctuary]: https://sanctuary.js.org/
[sanctuary-def]: https://github.com/sanctuary-js/sanctuary-def
[Unknown]: https://github.com/sanctuary-js/sanctuary-def#Unknown
[esm]: https://github.com/standard-things/esm
[UMD]: https://github.com/umdjs/umd