• Home
  • Integrations
  • SDKs
  • Guides
  • API docs
    No results for ""


    Haskell SDK reference

    Read time: 1 minute
    Last edited: Jan 20, 2023


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

    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:

    SDK API documentationSDK API docs
    GitHub repositoryhaskell-server-sdk
    Sample applicationHaskell
    Published moduleHackage

    Getting started

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

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

    Here is an example:

    import LaunchDarkly.Server

    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:

    client :: IO Client
    client = makeClient $ makeConfig "sdk-key-123abc"
    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.

    You can use client to check which variation a particular user will receive for a given feature flag.

    Here's how:

    boolVariation client "flag-key-123abc" (makeUser "user-key-123abc") False

    Shutting down

    Lastly, shut down the client when your application terminates. To learn more, read Shutting down.

    Supported features

    This SDK supports the following features: