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

# Haskell SDK reference

<View title="Developer" />

<View title="Federal docs" />

<View title="EU docs" />

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

<Note>
  **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:

  <table>
    <thead>
      <tr>
        <th>Resource</th>
        <th>Location</th>
      </tr>
    </thead>

    <tbody>
      <tr>
        <td>SDK API documentation</td>
        <td>[SDK API docs](https://launchdarkly.github.io/haskell-server-sdk/)</td>
      </tr>

      <tr>
        <td>Supported SDK Versions</td>
        <td>[Haskell server SDK](/docs/sdk/concepts/supported-versions#haskell-server-sdk)</td>
      </tr>

      <tr>
        <td>GitHub repository</td>
        <td>[haskell-server-sdk](https://github.com/launchdarkly/haskell-server-sdk)</td>
      </tr>

      <tr>
        <td>Sample application</td>
        <td>[Haskell](https://github.com/launchdarkly/hello-haskell-server)</td>
      </tr>

      <tr>
        <td>Published module</td>
        <td>[Hackage](https://hackage.haskell.org/package/launchdarkly-server-sdk)</td>
      </tr>
    </tbody>
  </table>
</Note>

## 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" lines wrap theme={null}
  import LaunchDarkly.Server
  ```
</CodeGroup>

<Note>
  **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 on the **SDK keys** page under **Settings**. To learn more about key types, read [Keys](/docs/sdk/concepts/client-side-server-side#keys-and-credentials).
</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" lines wrap 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>
  **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 [Flag variation evaluation](/docs/sdk/features/evaluating) and [Flag variation evaluation details](/docs/sdk/features/evaluation-reasons). For more information about how contexts are specified, read [Context configuration](/docs/sdk/features/context-config).

Here's how:

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

## Shut down the client

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

## Supported features

This SDK supports the following features:

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