@fp-ts/core

中文文档
0.2.1发布于 2023/02/09MITTypeScriptESM + CJS零依赖近 30 天下载 3309
原始使用文档

Functional programming in TypeScript

npm downloads

Credits and sponsorship

This library was inspired by the following projects:

A huge thanks to my sponsors who made the development of @fp-ts/core possible.

If you also want to become a sponsor to ensure this library continues to improve and receive maintenance, check out my GitHub Sponsors profile

Requirements

  • TypeScript 4.8 or newer
  • The strict flag enabled in your tsconfig.json file
{
  // ...
  "compilerOptions": {
    // ...
    "strict": true,
  }
}

Typed functional programming in TypeScript

This project represents the next major iteration of fp-ts and it's objective is a reconciliation with @effect in order to unify the ecosystems.

The @effect project will reduce it's scope to simply being an effect system and will delegate to fp-ts org all the lower level abstractions such as typeclasses and common data structures.

The objective of the fp-ts org in github and in npm (@fp-ts) is to simplify structure and management of the project, have smaller and better scoped packages.

Our "current" idea (that is well open for changes) is for fp-ts org to have:

  • The @fp-ts/core library features a new implementation of the Higher Kinded Type (HKT) pattern, including common typeclasses such as Monad and widely-used data types like Option, Either, and ReadonlyArray
  • @fp-ts/schema offers schema validation with static type inference, including decoders for data structures in @fp-ts/core and @effect/data
  • @fp-ts/optic provides optics for structures in both @fp-ts/core and @effect/data

For those using fp-ts v2 and its ecosystem, roughly these are the equivalents:

Note that @fp-ts/core will not contain any effect system (e.g. Task, TaskEither, ReaderTaskEither) since the handling of effects is entirely delegated to the packages contained in @effect/*.

Installation

To install the alpha version:

npm install @fp-ts/core

Warning. This package is primarily published to receive early feedback and for contributors, during this development phase we cannot guarantee the stability of the APIs, consider each release to contain breaking changes.

Documentation

License

The MIT License (MIT)

版本与发布记录

@fp-ts/core 共发布 15 个版本,首次发布于 2022/10/11;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.2.1latest2023/02/093 年前
0.2.02023/02/083 年前
0.1.12023/01/243 年前
0.1.02023/01/243 年前
0.0.112022/12/143 年前
0.0.102022/12/133 年前

关于 @fp-ts/core 的常见问题

如何安装 @fp-ts/core?

在项目目录运行 npm install @fp-ts/core,或使用 pnpm add / yarn add / bun add。

@fp-ts/core 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@fp-ts/core 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@fp-ts/core 可以商用吗?

@fp-ts/core 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@fp-ts/core 的下载量有多少?

根据 npm 官方下载统计,@fp-ts/core 在 2026/10/16 – 2026/11/14 这 30 天内被下载 3,309 次,日均约 110 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@fp-ts/core 还在维护吗?

最新版本 0.2.1 发布于 2023/02/09(3 年前);至今共发布 15 个版本,其中过去 12 个月发布了 0 个;首次发布于 2022/10/11。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。