> ## Documentation Index
> Fetch the complete documentation index at: https://launchdarkly-preview.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Haskell SDK reference

> This topic documents how to get started with the Haskell SDK, and links to reference information on all of the supported features.

> For the complete documentation index, see [llms.txt](/llms.txt). For the full documentation snapshot, see [llms-full.txt](/llms-full.txt).

## Overview

This topic documents how to get started with the Haskell SDK, and links to reference information on all of the supported features.

<Note title="SDK quick links">
  LaunchDarkly's SDKs are open source. In addition to this reference guide, we provide source, API reference documentation, and a sample application:
</Note>

| Resource | Location |
| - | - |
| SDK API documentation | [SDK API docs](https://launchdarkly.github.io/haskell-server-sdk/) |
| Supported SDK Versions | [Haskell server SDK](../concepts/supported-versions#haskell-server-sdk) |
| GitHub repository | [haskell-server-sdk](https://github.com/launchdarkly/haskell-server-sdk) |
| Sample application | [Haskell](https://github.com/launchdarkly/hello-haskell-server) |
| Published module | [Hackage](https://hackage.haskell.org/package/launchdarkly-server-sdk) |

## Get started

Follow the steps below to get started using the LaunchDarkly SDK in your Haskell application.

### Install the SDK

The root module of the SDK `LaunchDarkly.Server` re-exports the entire project.

Here is an example:

<CodeGroup>
  ```haskell title="Haskell" theme={null}
      import LaunchDarkly.Server
  ```
</CodeGroup>

<Note title="The Haskell SDK uses an SDK key">
  The Haskell SDK uses an SDK key. Keys are specific to each project and environment. They are available from **Project settings**, on the **Environments** list. To learn more about key types, read [Keys](/sdk/concepts/client-side-server-side#keys).
</Note>

### Initialize the client

After you import and install the SDK, create a single shared instance of `Client`. Specify your SDK key to authorize your application to connect to a particular environment within LaunchDarkly.

Here's how:

<CodeGroup>
  ```haskell title="Haskell" theme={null}
      client :: IO Client
      client = makeClient $ makeConfig "YOUR_SDK_KEY"
  ```
</CodeGroup>

To learn more about the specific configuration properties that are available in this SDK, read [`Config`](https://launchdarkly.github.io/haskell-server-sdk/LaunchDarkly-Server-Config.html).

<Warning title="Client must be a singleton">
  It's important to make `Client` a singleton for each LaunchDarkly project. The client instance maintains an internal state that allows LaunchDarkly to serve feature flags without making any remote requests. Do not instantiate a new client with every request.

  If you have multiple LaunchDarkly projects, you can create one `LDClient` for each. In this situation, the clients operate independently. For example, they do not share a single connection to LaunchDarkly.
</Warning>

### Evaluate a context

You can use `client` to check which variation a particular context will receive for a given feature flag. To learn more, read [Evaluating flags](/sdk/features/evaluating) and [Flag evaluation reasons](/sdk/features/evaluation-reasons). For more information about how contexts are specified, read [Context configuration](/sdk/features/context-config).

Here's how:

<CodeGroup>
  ```haskell title="Haskell SDK v4.0" theme={null}
      boolVariation client "example-flag-key" (makeContext "example-context-key" "context-kind") False
  ```

  ```haskell title="Haskell SDK v3.x" theme={null}
      boolVariation client "example-flag-key" (makeUser "example-user-key") False
  ```
</CodeGroup>

## Shut down the client

Shut down the client when your application terminates. To learn more, read [Shutting down](/sdk/features/shutdown#haskell).

## Supported features

This SDK supports the following features:

* [Anonymous contexts and users](/sdk/features/anonymous#haskell)
* [Configuration](/sdk/features/config#haskell), including
  * [Application metadata configuration](/sdk/features/app-config#haskell)
  * [Service endpoint configuration](/sdk/features/service-endpoint-configuration/server-side#haskell)
* [Context configuration](/sdk/features/context-config/server-side#haskell)
* [Evaluating flags](/sdk/features/evaluating#haskell)
* [Flag evaluation reasons](/sdk/features/evaluation-reasons/server-side#haskell)
* [Flushing events](/sdk/features/flush#haskell)
* [Getting all flags](/sdk/features/all-flags#haskell)
* [Identifying and changing contexts](/sdk/features/identify#haskell)
* [Offline mode](/sdk/features/offline-mode#haskell)
* [Private attributes](/sdk/features/private-attributes/server-side#haskell)
* [Reading flags from a file](/sdk/features/flags-from-files#haskell)
* [Relay Proxy configuration](/sdk/features/relay-proxy-configuration)
  * [Using proxy mode](/sdk/features/relay-proxy-configuration/proxy-mode#haskell)
  * [Using daemon mode](/sdk/features/relay-proxy-configuration/daemon-mode#haskell)
* [Secure mode](/sdk/features/secure-mode#haskell)
* [Sending custom events](/sdk/features/events#haskell)
* [Shutting down](/sdk/features/shutdown#haskell)
* [Storing data](/sdk/features/storing-data#haskell)
* [Test data sources](/sdk/features/test-data-sources#haskell)
