Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
pragmatic-fp-ts
Advanced tools
Opinionated functional programming library with easy use in mind
A library for functional programming in TypeScript. Curried, argument-last, pure, total functions that never mutate any data, Maybe/Either/Chain monads, FutureEither/FutureMaybe monad-likes.
There's not enough JavaScript libraries to choose from. -- no one, never
This is a quick implementation of most of the FP tools I need in may daily work. Typings are kept as as simple as possible, although this may include some dirty castings under the hood. Still, it is quite shiny when seen from the outside.
It's on npmjs.com, so you should know the drill.
npm install --save pragmatic-fp-ts
yarn add pragmatic-fp-ts
Alternatively, include it in your webpage via jsdelivr:
<script src="https://cdn.jsdelivr.net/npm/pragmatic-fp-ts@1/dist/pragmatic-fp-ts.min.js"></script>
Alternate source format created automatically with Denoify.
import * as f from "https://github.com/hermann-p/pragmatic-fp-ts/raw/master/deno_lib/main.ts"
Maybe.match
and Either.match
no longer automatically catch
errors, so they can be used as to throw when absolutely needed
without leaving the monads' flow.An elaborated readme will follow. Until then, you can see the auto generated docs on github.
any
merge
are the most noteworthy, although a
pipe
function exists)innerJoin
behaves more like one would expect from an inner
database joincompose
and pipe
use monadic-style infix composition instead of
just accepting arguments. This allows for type-checked composition
of an arbitrary number of functions in contrast to ramda's "list
overloads" approachCurry4<Map<Filter<...
and being more like
<A,B>(value: A) => B[]
Type-generating Validator returning Either
monads with detailed, extensive
parsing error messages on failure.
Although typing them is a bit of a PITA, transducers are a valuable addition for performance aware functional programmers. The first transducers implemented are:
which behave just like their non-transducing counterparts, as well as
transformList
which wraps the step of composing and applying a list of
transducers over arrays.
Mutables are for those situations where a clean functional solution is inconvenient to implement. They wrap a value and expose methods to mutate that value as well as a value accessor. After soon as the value is accessed for the first time, subsequent calls to the mutating functions will raise an Exception so we can still consume all the data safely.
Some minor bugfixes, extended functionality of keys
and values
, some
improved typings, most notably for the update
function.
Add cycle
to create infinite sequence and a naive dummy infinite array type.
Figured out how to setup webpack to create a browser bundle.
Removed mori
dependency. The runtime library is now completely self-contained.
As a Clojure guy I relied on some of mori's functionality for the heavy lifting
of deep get/set/update/equal operations.
Sadly, to use mori's high performance algorithms, data had to be cast to mori
data and back to JS-data after finishing, crippling performance within large
data sets, so these functions are now completely re-implemented in "plain
TypeScript" with a recursive, queue-based approach to path-getting.
Deep equality implementation is based on
epoberezkin/fast-deep-equal
Added quick intersection testing functions.
Implemented monadic Futures.
bind
of monads, calling it _
instead. Although functional programmers should not have run into
any problems with it, the name bind
might confuse people coming
from object oriented JavaScript programming, expecting
function-this-argument-binding instead of monadic binding. The old
name is still kept to keep older code from breaking too
much. Composition is arguably easier to read this way.flow
, pipe
, and compose
, so now we should now be
able to do anything with this lib we can do with ramda.mergeXXX
, as I still need to find performant ways to
do so. I have a history with lodash's merge
crippling one of my
web apps' performance, and don't want anyone to run into similar
issues, especially myself :DMIT
FAQs
Opinionated functional programming library with easy use in mind
We found that pragmatic-fp-ts demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.