登录 注册
教育与学习网站与 SaaS 工具内容创作与媒体工具 hacktoberfesthaskell
1,970
Stars
431
Forks
50
Watchers
303
Open Issues
待补全
许可证
Haskell
语言
2014-12-02
创建时间
2026-11-11
最近更新

项目能做什么

Servant 是一个基于 Haskell 的类型级领域特定语言(DSL)。它主要解决 Web 应用中 API 定义与实现脱节的问题,允许开发者在类型层面精确描述 Web API,并以此统一支持后端服务搭建、客户端请求查询、接口 Mock 测试以及自动生成文档等功能。
来源:AI 基于仓库事实生成 · 内容以仓库实际 README 为准

使用说明 查看原始 README 原仓库文档

中文使用说明暂未生成。下面保留原仓库 README 摘录,命令与配置均以原文为准。
原始 README 摘录(英文原文,节选前 3000 字符)
# servant - A Type-Level Web DSL

![servant](https://raw.githubusercontent.com/haskell-servant/servant/master/servant.png)

## Getting Started

We have a [tutorial](http://docs.servant.dev/en/latest/tutorial/index.html) that
introduces the core features of servant. After this article, you should be able
to write your first servant webservices, learning the rest from the haddocks'
examples.

The core documentation can be found [here](http://docs.servant.dev/).
Other blog posts, videos and slides can be found on the
[website](http://www.servant.dev/).

If you need help, drop by the IRC channel (#haskell-servant on libera.chat) or [mailing
list](https://groups.google.com/forum/#!forum/haskell-servant).

## Contributing

See `CONTRIBUTING.md`

## Release process outline (by phadej)

- Update changelog and bump versions in `master`
    - `git log --oneline v0.12.. | grep 'Merge pull request'` is a good starting point (use correct previous release tag)
- Create a release branch, e.g. `release-0.13`
    - Release branch is useful for backporting fixes from `master`
- Smoke test in [`servant-universe`](https://github.com/phadej/servant-universe)
    - `git submodule foreach git checkout master` and `git submodule foreach git pull` to get newest of everything.
    - `cabal new-build --enable-tests all` to verify that everything builds, and `cabal new-test all` to run tests
        - It's a good idea to separate these steps, as tests often pass, if they compile :)
    - See `cabal.project` to selectively `allow-newer`
    - If some packages are broken, on your discretisation there are two options:
        - Fix them and make PRs: it's a good idea to test against older `servant` version too.
        - Temporarily comment out broken package
    - If you make a commit for `servant-universe`, you can use it as submodule in private projects to test even more
- When ripples are cleared out:
    - `git tag -s` the release
    - `git push --tags`
    - `cabal sdist` and `cabal upload`

## TechEmpower framework benchmarks

We develop and maintain the servant TFB entry in https://github.com/haskell-servant/FrameworkBenchmarks/

To verify (i.e. compile and test that it works)

```sh
./tfb --mode verify --test servant servant-beam servant-psql-simple --type json plaintext db fortune
```

To compare with  `warp`

```sh
./tfb --mode benchmark --test warp servant servant-beam servant-psql-simple --type json plaintext db fortune
```

To compare with `reitit` (Clojure framework)

```sh
./tfb --mode benchmark --test reitit reitit-async reitit-jdbc servant servant-beam servant-psql-simple --type json plaintext db fortune
```

You can see the visualised results at https://www.techempower.com/benchmarks/#section=test

## Nix

A developer `flake.nix` file is provided in the root directory.

Default shell will provide you with tools and dependencies needed to build servant packages.

```sh
$ nix develop
```

For the tutorial and the cookbook you can use `tutorial` shell.

```sh
阅读完整原文

项目深度分析 AI 生成

基于Servant的企业级API网关与OpenAPI双向代码生成SaaS

产品构想利用Servant的类型级描述能力,提供从OpenAPI规范直接生成生产级Servant服务端骨架及前端强类型SDK的托管工具平台。
核心功能OpenAPI 3.x至Servant双向转换器、TypeScript/Swift客户端强类型SDK自动分发、API Breaking Change类型级静态检测。
目标用户采用Haskell微服务架构的中大型企业团队、需要严格契约测试的API架构师。
难度/周期高 · 3-6个月 · 成本:极低(主要是服务器部署与自动化构建资源)
收费模式按团队席位/每月生成的API端点数收取SaaS订阅费。
竞争风险Haskell整体生态受众较小,潜在付费用户基数有限。
依据 AI推测

Servant架构咨询与性能基准优化服务

产品构想依托TechEmpower基准调优经验与Nix工程化能力,为企业提供Servant与Warp结合的高并发性能调优及架构设计顾问服务。
核心功能TechEmpower级别性能瓶颈分析与调优、GHC内存泄漏排查、Nix部署流水线设计。
目标用户金融高频交易平台、区块链节点开发商、正在尝试引入Haskell的初创团队。
难度/周期高 · 按项目交付(通常2-4周) · 成本:人力成本为主
收费模式专家顾问费/按项目交付包结算(如单次架构审计套餐)。
竞争风险咨询模式难以标准化扩展,极度依赖个人在Haskell社区的声誉和技术深度。
依据 已验证事实

Servant商业插件与企业认证组件库(Servant Enterprise Kit)

产品构想开发闭源或双重许可的企业级中间件插件包,涵盖OAuth2/OIDC、复杂限流、分布式链路追踪(OpenTelemetry)及企业级安全审计。
核心功能开箱即用的OIDC认证Type-Level组合子、Servant-OpenTelemetry监控集成模块、自动化合规审计日志导出器。
目标用户需要符合SOC2/合规认证的企业Haskell后端工程师。
难度/周期中等 · 2-3个月 · 成本:开发与维护环境成本
收费模式商业授权许可(按年订阅License)及高级工单支持服务。
竞争风险开源社区可能自发实现同类基础库造成替代风险。
依据 尚需验证的假设
AI 基于仓库公开数据分析生成,含推测成分,不构成收益承诺。
报告会保存到 个人中心

竞品与相似项目 GitHub Search 真实检索

相似项目数据正在完善中,暂不展示(避免误导)

项目优势与风险

技术成熟度创建于 2014-12-02,近 30 天仍在推送
社区活跃Star 1,970 / Fork 431 / Issue 303(数据支持,可自行核实)
许可证未检测到(需人工确认)
主要风险上游项目方向可能变化;同赛道竞争者较多(见竞品表);热度与需求不完全等价

安装与使用

此项目未提供 Docker 镜像,安装步骤以原仓库 README 为准(涉及依赖安装与环境配置,对新手门槛较高)。