Files
zeekay 0841e12cc2 docs(sdks): full per-language SDK section — 11 languages
Folds rich SDK content out of hanzoai/docs into zap-proto/dev (canonical
brand). Per-SDK pages: typescript, go, python, rust, cpp, c, java,
csharp, ocaml, haskell, erlang. Each carries install, quick-start,
client API, gateway, error handling, server impl, and testing.

Top-level /sdks/ adds the matrix of all 33 zap-proto repos (core SDKs,
community SDKs, wire encoders, editor plugins, tools, protocols over
ZAP, spec/research).
2026-05-27 03:35:01 -07:00

82 lines
1.7 KiB
Plaintext

---
title: Haskell
description: ZAP Haskell SDK - Pure functional binding
---
# Haskell Binding
The Haskell binding provides a pure functional interface with strong types.
## Installation
Add to `package.yaml`:
```yaml
dependencies:
- zap >= 0.1
```
Or `cabal`:
```yaml
build-depends: zap >= 0.1
```
## Quick Start
```haskell
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Zap
import qualified Data.Text.IO as TIO
main :: IO ()
main = do
client <- connect "zap://localhost:9000"
let info = ClientInfo { name = "my-agent", version = "1.0.0" }
server <- initialize client info
TIO.putStrLn $ "Connected to: " <> serverName server <> " v" <> serverVersion server
tools <- listTools client
mapM_ printTool tools
let call = ToolCall
{ toolCallId = "call-1"
, toolCallName = "read_file"
, toolCallArgs = "{\"path\": \"/etc/hosts\"}"
, toolCallMetadata = []
}
result <- callTool client call
case toolResultError result of
Just err -> TIO.putStrLn $ "Error: " <> err
Nothing -> TIO.putStrLn $ "Result: " <> toolResultContent result
close client
where
printTool tool = TIO.putStrLn $ " " <> toolName tool <> " - " <> toolDescription tool
```
## Monadic Interface
```haskell
import Zap.Monad
runZap :: ZapM ()
runZap = do
server <- initialize ClientInfo { name = "my-agent", version = "1.0.0" }
tools <- listTools
results <- mapM callToolWithDefaults tools
return ()
main :: IO ()
main = runZapWith "zap://localhost:9000" runZap
```
## Documentation
Full documentation at [zap-proto/haskell](https://github.com/zap-proto/haskell).