Haskell SDK reference
Read time: 1 minute
Last edited: Sep 27, 2022
This topic documents how to get started with the Haskell SDK, and links to reference information on all of the supported features.
LaunchDarkly's SDKs are open source. In addition to this reference guide, we provide source, API reference documentation, and a sample application:
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:
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.
client :: IO Clientclient = makeClient $ makeConfig "YOUR_SDK_KEY"
It's important to make
Client a singleton. 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.
You can use
client to check which variation a particular user will receive for a given feature flag.
boolVariation client "YOUR_FLAG_KEY" (makeUser "abc") False
Lastly, shut down the client when your application terminates. To learn more, read Shutting down.
This SDK supports the following features:
- Aliasing users
- Evaluating flags
- Flag evaluation reasons
- Flushing events
- Getting all flags
- Identifying and changing users
- Offline mode
- Reading flags from a file
- Relay Proxy configuration
- Sending custom events
- Service endpoint configuration
- Shutting down
- Test data sources
- User configuration