Copyright | Copyright © FINN.no AS Inc. All rights reserved. |
---|---|
License | MIT |
Stability | experimental |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Functions and types for checking feature toggles and variants.
Synopsis
- data Context = Context {}
- defaultStrategyEvaluator :: StrategyEvaluator
- defaultSupportedStrategies :: SupportedStrategies
- emptyContext :: Context
- emptyVariantResponse :: VariantResponse
- featureGetVariant :: MonadIO m => Features -> FeatureToggleName -> Context -> m VariantResponse
- featureIsEnabled :: MonadIO m => Features -> FeatureToggleName -> Context -> m Bool
- type Features = Map FeatureToggleName Feature
- type FeatureToggleName = Text
- data MetricsPayload = MetricsPayload {}
- data RegisterPayload = RegisterPayload {}
- data Strategy = Strategy {
- name :: Text
- parameters :: Maybe (Map Text Text)
- constraints :: Maybe [Constraint]
- segments :: Maybe [Int]
- type StrategyEvaluator = forall m. MonadIO m => Strategy -> FeatureToggleName -> Context -> m Bool
- type SupportedStrategies = [Text]
- data VariantResponse = VariantResponse {}
Documentation
Client context.
Context | |
|
Instances
defaultStrategyEvaluator :: StrategyEvaluator Source #
Implementation of default strategies.
defaultSupportedStrategies :: SupportedStrategies Source #
A list of currently supported strategies for this library.
emptyContext :: Context Source #
An initial client context.
emptyVariantResponse :: VariantResponse Source #
The default (disabled) variant response.
:: MonadIO m | |
=> Features | Full set of features fetched from a server. |
-> FeatureToggleName | Feature toggle name (as it is represented on the server). |
-> Context | User context. |
-> m VariantResponse | Variant. |
Get a variant for a given feature toggle.
:: MonadIO m | |
=> Features | Full set of features fetched from a server. |
-> FeatureToggleName | Feature toggle name (as it is represented on the server). |
-> Context | User context. |
-> m Bool | Feature toggle state. |
Check whether or not a feature toggle is enabled.
type Features = Map FeatureToggleName Feature Source #
Map of feature toggles keyed on toggle names. Typically the full set of features fetched from a server.
type FeatureToggleName = Text Source #
Alias used for feature toggle names (as they are represented on Unleash servers).
data MetricsPayload Source #
Metrics payload.
Instances
data RegisterPayload Source #
Client registration payload.
RegisterPayload | |
|
Instances
Strategy. Encompasses all (supported) types of strategies.
Strategy | |
|
Instances
FromJSON Strategy Source # | |
ToJSON Strategy Source # | |
Defined in Unleash.Internal.JsonTypes | |
Generic Strategy Source # | |
Show Strategy Source # | |
Eq Strategy Source # | |
type Rep Strategy Source # | |
Defined in Unleash.Internal.JsonTypes type Rep Strategy = D1 ('MetaData "Strategy" "Unleash.Internal.JsonTypes" "unleash-client-haskell-core-0.11.0-inplace" 'False) (C1 ('MetaCons "Strategy" 'PrefixI 'True) ((S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "parameters") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (Map Text Text)))) :*: (S1 ('MetaSel ('Just "constraints") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe [Constraint])) :*: S1 ('MetaSel ('Just "segments") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe [Int]))))) |
type StrategyEvaluator = forall m. MonadIO m => Strategy -> FeatureToggleName -> Context -> m Bool Source #
Functions that implement strategies.
type SupportedStrategies = [Text] Source #
Alias for a list of supported strategies.
data VariantResponse Source #
Variant response.