https://github.com/guiltydolphin/functionality
Functional programming for TypeScript
https://github.com/guiltydolphin/functionality
Last synced: 12 months ago
JSON representation
Functional programming for TypeScript
- Host: GitHub
- URL: https://github.com/guiltydolphin/functionality
- Owner: GuiltyDolphin
- License: gpl-3.0
- Created: 2021-05-23T17:52:33.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-06-26T18:04:40.000Z (almost 5 years ago)
- Last Synced: 2025-01-13T16:18:09.748Z (over 1 year ago)
- Language: TypeScript
- Size: 93.8 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
- Changelog: CHANGELOG.org
- License: LICENSE
Awesome Lists containing this project
README
#+TITLE: Functionality
#+BEGIN_EXPORT html
#+END_EXPORT
This package provides utilities for functional programming
with TypeScript.
* Documentation
The main entry point is [[./mod.ts][mod.ts]]. The full documentation is
available at [[https://doc.deno.land/https/deno.land/x/functionality/mod.ts][doc.deno.land]].
- [[./src/array.ts][src/array.ts]]
Provides utilities for working with arrays.
- [[./src/either.ts][src/either.ts]]
Provides the ~Either~ type, which captures values that
can be /either/ an ~L~ or an ~R~. Can be used to model
failure when you want to provide more information than
~Maybe~ can (e.g., ~Either~ could be used to
provide a descriptive ~string~ message about what went
wrong). Can also be used to model branching and
alternatives.
- [[./src/function.ts][src/function.ts]]
Provides utilities for working with and manipulating
functions.
- [[./src/functional.ts][src/functional.ts]]
Exports types and functions useful for general functional
programming, e.g., the ~Either~ and ~Maybe~ types.
- [[./src/functor.ts][src/functor.ts]]
Defines the ~Functor~ interface, which describes types which
act like "containers" that can be mapped over, whilst
preserving the underlying "container" structure.
- [[./src/generic.ts][src/generic.ts]]
Provides infrastructure for recording information about
types, such as how to apply type parameters to them. For
example, the ~Maybe~ type is registered in the ~Generic1~
interface as ~'Maybe': Maybe~, which enables a form of
"partial type application".
- [[./src/maybe.ts][src/maybe.ts]]
Provides the ~Maybe~ type, which captures the notion of
"optional" values. Can also be used to model results which
may fail, when you don't need to provide more information
about failure (if you do, then use ~Either~).
- [[./src/monad.ts][src/monad.ts]]
Defines the ~Monad~ interface, which describes types that
can sequence computations in some computational
context. Useful for e.g., threading state.
- [[./src/types.ts][src/types.ts]]
Provides various utility types and functions for working
with types.
- [[./src/unwrap.ts][src/unwrap.ts]]
Provides the ~Unwrap~ interface, which describes types that
can be unwrapped to provide an inner value.
* Development
** Coverage
To generate code test coverage, make sure you have access to
the =genhtml= tool (e.g., via the [[https://aur.archlinux.org/packages/lcov/][lcov package on AUR]]), then
run =make coverage= in the top-level of the project.
** Testing
Run =make test= in the top-level of the project to run the
tests. If you need to see results for tests that passed, run
=make test_verbose= or =deno test= instead.