hydra-kernel-0.18.1: src/main/haskell/Hydra/Core/Lib/Eithers.hs
-- Note: this is an automatically generated file. Do not edit.
-- | Primitives in the hydra.core.lib.eithers module.
module Hydra.Core.Lib.Eithers where
import qualified Hydra.Core.Overlay.Haskell.Lib.Lists as Lists
import qualified Hydra.Core.Model as Model
import qualified Hydra.Core.Packaging as Packaging
import qualified Hydra.Core.Typing as Typing
import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines)
import qualified Data.Scientific as Sci
import Data.Void
apply :: Packaging.PrimitiveDefinition
apply =
Packaging.PrimitiveDefinition {
Packaging.primitiveDefinitionName = (Model.Name "hydra.core.lib.eithers.apply"),
Packaging.primitiveDefinitionMetadata = (Just (Packaging.EntityMetadata {
Packaging.entityMetadataDescription = (Just "Applicative apply for either: combine a function under either and an argument under either."),
Packaging.entityMetadataComments = [
"apply(ef, ex) returns right(f(x)) when ef is right(f) and ex is right(x).",
"If either argument is a left, the result is that left; when both arguments are left, the first (function-side) left is returned \8212 first error wins, and ex is not consulted once ef is known to be a left.",
"apply(ef, ex) is bind(ef, \\f -> map(f, ex)); this defining equation is the specification, and the default implementation.",
"Total. Corresponds to Haskell's (<*>) :: Either a (b -> c) -> Either a b -> Either a c."],
Packaging.entityMetadataSeeAlso = [],
Packaging.entityMetadataLifecycle = (Just (Packaging.LifecycleInfo {
Packaging.lifecycleInfoAvailableSince = (Just (Packaging.Version "0.17.6")),
Packaging.lifecycleInfoDeprecatedSince = Nothing})),
Packaging.entityMetadataProvisions = []})),
Packaging.primitiveDefinitionSignature = Typing.TermSignature {
Typing.termSignatureTypeParameters = [
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "x"),
Typing.typeParameterConstraints = []},
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "y"),
Typing.typeParameterConstraints = []},
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "z"),
Typing.typeParameterConstraints = []}],
Typing.termSignatureParameters = [
Typing.Parameter {
Typing.parameterName = (Model.Name "ef"),
Typing.parameterDescription = (Just "the either containing the function to apply"),
Typing.parameterType = (Model.TypeEither (Model.EitherType {
Model.eitherTypeLeft = (Model.TypeVariable (Model.Name "x")),
Model.eitherTypeRight = (Model.TypeFunction (Model.FunctionType {
Model.functionTypeDomain = (Model.TypeVariable (Model.Name "y")),
Model.functionTypeCodomain = (Model.TypeVariable (Model.Name "z"))}))})),
Typing.parameterIsLazy = False},
Typing.Parameter {
Typing.parameterName = (Model.Name "ex"),
Typing.parameterDescription = (Just "the either containing the argument"),
Typing.parameterType = (Model.TypeEither (Model.EitherType {
Model.eitherTypeLeft = (Model.TypeVariable (Model.Name "x")),
Model.eitherTypeRight = (Model.TypeVariable (Model.Name "y"))})),
Typing.parameterIsLazy = False}],
Typing.termSignatureResult = Typing.Result {
Typing.resultDescription = Nothing,
Typing.resultType = (Model.TypeEither (Model.EitherType {
Model.eitherTypeLeft = (Model.TypeVariable (Model.Name "x")),
Model.eitherTypeRight = (Model.TypeVariable (Model.Name "z"))}))}},
Packaging.primitiveDefinitionIsPure = True,
Packaging.primitiveDefinitionIsTotal = True,
Packaging.primitiveDefinitionDefaultImplementation = (Just (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "ef"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "ex"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.eithers.bind")),
Model.applicationArgument = (Model.TermVariable (Model.Name "ef"))})),
Model.applicationArgument = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "f"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.eithers.map")),
Model.applicationArgument = (Model.TermVariable (Model.Name "f"))})),
Model.applicationArgument = (Model.TermVariable (Model.Name "ex"))}))}))}))}))})))}
bimap :: Packaging.PrimitiveDefinition
bimap =
Packaging.PrimitiveDefinition {
Packaging.primitiveDefinitionName = (Model.Name "hydra.core.lib.eithers.bimap"),
Packaging.primitiveDefinitionMetadata = (Just (Packaging.EntityMetadata {
Packaging.entityMetadataDescription = (Just "Map over both sides of an either value."),
Packaging.entityMetadataComments = [
"bimap(f, g, e) applies f to the contained value if e is a Left, or g if e is a Right; the result retains the same Left/Right variant.",
"Total. Corresponds to Haskell's Data.Bifunctor.bimap :: (a -> c) -> (b -> d) -> Either a b -> Either c d."],
Packaging.entityMetadataSeeAlso = [],
Packaging.entityMetadataLifecycle = (Just (Packaging.LifecycleInfo {
Packaging.lifecycleInfoAvailableSince = (Just (Packaging.Version "0.15")),
Packaging.lifecycleInfoDeprecatedSince = Nothing})),
Packaging.entityMetadataProvisions = [
Packaging.Provision {
Packaging.provisionName = (Model.Name "hydra.core.lib.eithers.bimap.mapsBothSidesIndependently"),
Packaging.provisionKind = Packaging.ProvisionKindRequirement,
Packaging.provisionStatement = "bimap applies the first function if the either is a left and the second function if it is a right, preserving the left/right variant of the result."}]})),
Packaging.primitiveDefinitionSignature = Typing.TermSignature {
Typing.termSignatureTypeParameters = [
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "x"),
Typing.typeParameterConstraints = []},
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "y"),
Typing.typeParameterConstraints = []},
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "z"),
Typing.typeParameterConstraints = []},
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "w"),
Typing.typeParameterConstraints = []}],
Typing.termSignatureParameters = [
Typing.Parameter {
Typing.parameterName = (Model.Name "f"),
Typing.parameterDescription = (Just "the function to apply to a Left value"),
Typing.parameterType = (Model.TypeFunction (Model.FunctionType {
Model.functionTypeDomain = (Model.TypeVariable (Model.Name "x")),
Model.functionTypeCodomain = (Model.TypeVariable (Model.Name "z"))})),
Typing.parameterIsLazy = False},
Typing.Parameter {
Typing.parameterName = (Model.Name "g"),
Typing.parameterDescription = (Just "the function to apply to a Right value"),
Typing.parameterType = (Model.TypeFunction (Model.FunctionType {
Model.functionTypeDomain = (Model.TypeVariable (Model.Name "y")),
Model.functionTypeCodomain = (Model.TypeVariable (Model.Name "w"))})),
Typing.parameterIsLazy = False},
Typing.Parameter {
Typing.parameterName = (Model.Name "e"),
Typing.parameterDescription = (Just "the either value to map over"),
Typing.parameterType = (Model.TypeEither (Model.EitherType {
Model.eitherTypeLeft = (Model.TypeVariable (Model.Name "x")),
Model.eitherTypeRight = (Model.TypeVariable (Model.Name "y"))})),
Typing.parameterIsLazy = False}],
Typing.termSignatureResult = Typing.Result {
Typing.resultDescription = Nothing,
Typing.resultType = (Model.TypeEither (Model.EitherType {
Model.eitherTypeLeft = (Model.TypeVariable (Model.Name "z")),
Model.eitherTypeRight = (Model.TypeVariable (Model.Name "w"))}))}},
Packaging.primitiveDefinitionIsPure = True,
Packaging.primitiveDefinitionIsTotal = True,
Packaging.primitiveDefinitionDefaultImplementation = (Just (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "f"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "g"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "e"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.eithers.either")),
Model.applicationArgument = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "x"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermEither (Left (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "f")),
Model.applicationArgument = (Model.TermVariable (Model.Name "x"))}))))}))})),
Model.applicationArgument = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "y"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermEither (Right (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "g")),
Model.applicationArgument = (Model.TermVariable (Model.Name "y"))}))))}))})),
Model.applicationArgument = (Model.TermVariable (Model.Name "e"))}))}))}))})))}
bind :: Packaging.PrimitiveDefinition
bind =
Packaging.PrimitiveDefinition {
Packaging.primitiveDefinitionName = (Model.Name "hydra.core.lib.eithers.bind"),
Packaging.primitiveDefinitionMetadata = (Just (Packaging.EntityMetadata {
Packaging.entityMetadataDescription = (Just "Bind (flatMap) for either: if Right, apply the function; if Left, return unchanged."),
Packaging.entityMetadataComments = [
"bind(e, f) is the monadic bind for either with a fixed Left type: if e is Right v, the result is f(v); if e is Left x, the result is Left x with the Left type preserved.",
"Used to chain computations that may fail with a common error type.",
"Total. Corresponds to Haskell's (>>=) :: Either a b -> (b -> Either a c) -> Either a c."],
Packaging.entityMetadataSeeAlso = [],
Packaging.entityMetadataLifecycle = (Just (Packaging.LifecycleInfo {
Packaging.lifecycleInfoAvailableSince = (Just (Packaging.Version "0.15")),
Packaging.lifecycleInfoDeprecatedSince = Nothing})),
Packaging.entityMetadataProvisions = [
Packaging.Provision {
Packaging.provisionName = (Model.Name "hydra.core.lib.eithers.bind.chainsOnRightShortCircuitsOnLeft"),
Packaging.provisionKind = Packaging.ProvisionKindRequirement,
Packaging.provisionStatement = "bind applies the continuation function when the either is a right, propagating the continuation's own result (which may itself be a left or right); when the either is a left, bind returns that left unchanged without invoking the continuation."}]})),
Packaging.primitiveDefinitionSignature = Typing.TermSignature {
Typing.termSignatureTypeParameters = [
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "x"),
Typing.typeParameterConstraints = []},
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "y"),
Typing.typeParameterConstraints = []},
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "z"),
Typing.typeParameterConstraints = []}],
Typing.termSignatureParameters = [
Typing.Parameter {
Typing.parameterName = (Model.Name "e"),
Typing.parameterDescription = (Just "the either value to bind"),
Typing.parameterType = (Model.TypeEither (Model.EitherType {
Model.eitherTypeLeft = (Model.TypeVariable (Model.Name "x")),
Model.eitherTypeRight = (Model.TypeVariable (Model.Name "y"))})),
Typing.parameterIsLazy = False},
Typing.Parameter {
Typing.parameterName = (Model.Name "f"),
Typing.parameterDescription = (Just "the function to apply to a Right value"),
Typing.parameterType = (Model.TypeFunction (Model.FunctionType {
Model.functionTypeDomain = (Model.TypeVariable (Model.Name "y")),
Model.functionTypeCodomain = (Model.TypeEither (Model.EitherType {
Model.eitherTypeLeft = (Model.TypeVariable (Model.Name "x")),
Model.eitherTypeRight = (Model.TypeVariable (Model.Name "z"))}))})),
Typing.parameterIsLazy = False}],
Typing.termSignatureResult = Typing.Result {
Typing.resultDescription = Nothing,
Typing.resultType = (Model.TypeEither (Model.EitherType {
Model.eitherTypeLeft = (Model.TypeVariable (Model.Name "x")),
Model.eitherTypeRight = (Model.TypeVariable (Model.Name "z"))}))}},
Packaging.primitiveDefinitionIsPure = True,
Packaging.primitiveDefinitionIsTotal = True,
Packaging.primitiveDefinitionDefaultImplementation = (Just (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "e"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "f"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.eithers.either")),
Model.applicationArgument = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "x"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermEither (Left (Model.TermVariable (Model.Name "x"))))}))})),
Model.applicationArgument = (Model.TermVariable (Model.Name "f"))})),
Model.applicationArgument = (Model.TermVariable (Model.Name "e"))}))}))})))}
compose :: Packaging.PrimitiveDefinition
compose =
Packaging.PrimitiveDefinition {
Packaging.primitiveDefinitionName = (Model.Name "hydra.core.lib.eithers.compose"),
Packaging.primitiveDefinitionMetadata = (Just (Packaging.EntityMetadata {
Packaging.entityMetadataDescription = (Just "Kleisli composition for either."),
Packaging.entityMetadataComments = [
"compose(f, g, x) is bind(f(x), g); this defining equation is the specification, and the default implementation.",
"If either f(x) or the second stage produces a left, the result is that left.",
"Total. Corresponds to Kleisli composition (>=>) specialised to Either with a fixed Left type."],
Packaging.entityMetadataSeeAlso = [],
Packaging.entityMetadataLifecycle = (Just (Packaging.LifecycleInfo {
Packaging.lifecycleInfoAvailableSince = (Just (Packaging.Version "0.17.6")),
Packaging.lifecycleInfoDeprecatedSince = Nothing})),
Packaging.entityMetadataProvisions = []})),
Packaging.primitiveDefinitionSignature = Typing.TermSignature {
Typing.termSignatureTypeParameters = [
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "x"),
Typing.typeParameterConstraints = []},
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "y"),
Typing.typeParameterConstraints = []},
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "z"),
Typing.typeParameterConstraints = []},
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "w"),
Typing.typeParameterConstraints = []}],
Typing.termSignatureParameters = [
Typing.Parameter {
Typing.parameterName = (Model.Name "f"),
Typing.parameterDescription = (Just "the first Kleisli arrow to apply"),
Typing.parameterType = (Model.TypeFunction (Model.FunctionType {
Model.functionTypeDomain = (Model.TypeVariable (Model.Name "x")),
Model.functionTypeCodomain = (Model.TypeEither (Model.EitherType {
Model.eitherTypeLeft = (Model.TypeVariable (Model.Name "w")),
Model.eitherTypeRight = (Model.TypeVariable (Model.Name "y"))}))})),
Typing.parameterIsLazy = False},
Typing.Parameter {
Typing.parameterName = (Model.Name "g"),
Typing.parameterDescription = (Just "the second Kleisli arrow to apply"),
Typing.parameterType = (Model.TypeFunction (Model.FunctionType {
Model.functionTypeDomain = (Model.TypeVariable (Model.Name "y")),
Model.functionTypeCodomain = (Model.TypeEither (Model.EitherType {
Model.eitherTypeLeft = (Model.TypeVariable (Model.Name "w")),
Model.eitherTypeRight = (Model.TypeVariable (Model.Name "z"))}))})),
Typing.parameterIsLazy = False},
Typing.Parameter {
Typing.parameterName = (Model.Name "x"),
Typing.parameterDescription = (Just "the input value"),
Typing.parameterType = (Model.TypeVariable (Model.Name "x")),
Typing.parameterIsLazy = False}],
Typing.termSignatureResult = Typing.Result {
Typing.resultDescription = Nothing,
Typing.resultType = (Model.TypeEither (Model.EitherType {
Model.eitherTypeLeft = (Model.TypeVariable (Model.Name "w")),
Model.eitherTypeRight = (Model.TypeVariable (Model.Name "z"))}))}},
Packaging.primitiveDefinitionIsPure = True,
Packaging.primitiveDefinitionIsTotal = True,
Packaging.primitiveDefinitionDefaultImplementation = (Just (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "f"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "g"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "x"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.eithers.bind")),
Model.applicationArgument = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "f")),
Model.applicationArgument = (Model.TermVariable (Model.Name "x"))}))})),
Model.applicationArgument = (Model.TermVariable (Model.Name "g"))}))}))}))})))}
either :: Packaging.PrimitiveDefinition
either =
Packaging.PrimitiveDefinition {
Packaging.primitiveDefinitionName = (Model.Name "hydra.core.lib.eithers.either"),
Packaging.primitiveDefinitionMetadata = (Just (Packaging.EntityMetadata {
Packaging.entityMetadataDescription = (Just "Eliminate an either value by applying one of two functions."),
Packaging.entityMetadataComments = [
"either(f, g, e) returns f(x) if e is Left x and g(y) if e is Right y.",
"The fundamental eliminator for the either type; every other primitive in this namespace can be derived from it.",
"Total. Corresponds to Haskell's either :: (a -> c) -> (b -> c) -> Either a b -> c.",
"Deprecated since 0.18. Use: cases.",
"Note that the argument order also changed in the replacement: cases takes the scrutinee first."],
Packaging.entityMetadataSeeAlso = [],
Packaging.entityMetadataLifecycle = (Just (Packaging.LifecycleInfo {
Packaging.lifecycleInfoAvailableSince = Nothing,
Packaging.lifecycleInfoDeprecatedSince = (Just (Packaging.Version "0.18"))})),
Packaging.entityMetadataProvisions = [
Packaging.Provision {
Packaging.provisionName = (Model.Name "hydra.core.lib.eithers.either.eliminatesByVariant"),
Packaging.provisionKind = Packaging.ProvisionKindRequirement,
Packaging.provisionStatement = "either applies the first function if given a left value and the second function if given a right value, returning that function's result directly."}]})),
Packaging.primitiveDefinitionSignature = Typing.TermSignature {
Typing.termSignatureTypeParameters = [
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "x"),
Typing.typeParameterConstraints = []},
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "y"),
Typing.typeParameterConstraints = []},
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "z"),
Typing.typeParameterConstraints = []}],
Typing.termSignatureParameters = [
Typing.Parameter {
Typing.parameterName = (Model.Name "f"),
Typing.parameterDescription = (Just "the function to apply to a Left value"),
Typing.parameterType = (Model.TypeFunction (Model.FunctionType {
Model.functionTypeDomain = (Model.TypeVariable (Model.Name "x")),
Model.functionTypeCodomain = (Model.TypeVariable (Model.Name "z"))})),
Typing.parameterIsLazy = False},
Typing.Parameter {
Typing.parameterName = (Model.Name "g"),
Typing.parameterDescription = (Just "the function to apply to a Right value"),
Typing.parameterType = (Model.TypeFunction (Model.FunctionType {
Model.functionTypeDomain = (Model.TypeVariable (Model.Name "y")),
Model.functionTypeCodomain = (Model.TypeVariable (Model.Name "z"))})),
Typing.parameterIsLazy = False},
Typing.Parameter {
Typing.parameterName = (Model.Name "e"),
Typing.parameterDescription = (Just "the either value to eliminate"),
Typing.parameterType = (Model.TypeEither (Model.EitherType {
Model.eitherTypeLeft = (Model.TypeVariable (Model.Name "x")),
Model.eitherTypeRight = (Model.TypeVariable (Model.Name "y"))})),
Typing.parameterIsLazy = False}],
Typing.termSignatureResult = Typing.Result {
Typing.resultDescription = Nothing,
Typing.resultType = (Model.TypeVariable (Model.Name "z"))}},
Packaging.primitiveDefinitionIsPure = True,
Packaging.primitiveDefinitionIsTotal = True,
Packaging.primitiveDefinitionDefaultImplementation = Nothing}
foldList :: Packaging.PrimitiveDefinition
foldList =
Packaging.PrimitiveDefinition {
Packaging.primitiveDefinitionName = (Model.Name "hydra.core.lib.eithers.foldList"),
Packaging.primitiveDefinitionMetadata = (Just (Packaging.EntityMetadata {
Packaging.entityMetadataDescription = (Just "Left-fold over a list with an Either-returning function, short-circuiting on Left."),
Packaging.entityMetadataComments = [
"foldList(f, acc0, xs) folds f over xs from the left, threading an accumulator of type a, where each application may fail with Left e: it iterates while f returns Right, propagates Left on the first failure, and returns Right (final accumulator) if all elements were processed.",
"Corresponds to a short-circuiting variant of Haskell's foldM specialised to Either.",
"Renamed from hydra.lib.eithers.foldl, to distinguish the monadic fold from the plain list fold hydra.lib.lists.foldl."],
Packaging.entityMetadataSeeAlso = [],
Packaging.entityMetadataLifecycle = (Just (Packaging.LifecycleInfo {
Packaging.lifecycleInfoAvailableSince = (Just (Packaging.Version "0.17.6")),
Packaging.lifecycleInfoDeprecatedSince = Nothing})),
Packaging.entityMetadataProvisions = [
Packaging.Provision {
Packaging.provisionName = (Model.Name "hydra.core.lib.eithers.foldList.foldsLeftShortCircuitingOnLeft"),
Packaging.provisionKind = Packaging.ProvisionKindRequirement,
Packaging.provisionStatement = "foldList folds the given function over the list from the left, threading an accumulator through successive right results; the first left result returned by the step function short-circuits the whole fold to that left, and folding the empty list returns right of the initial accumulator unchanged."}]})),
Packaging.primitiveDefinitionSignature = Typing.TermSignature {
Typing.termSignatureTypeParameters = [
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "x"),
Typing.typeParameterConstraints = []},
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "y"),
Typing.typeParameterConstraints = []},
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "z"),
Typing.typeParameterConstraints = []}],
Typing.termSignatureParameters = [
Typing.Parameter {
Typing.parameterName = (Model.Name "f"),
Typing.parameterDescription = (Just "the Either-returning folding function"),
Typing.parameterType = (Model.TypeFunction (Model.FunctionType {
Model.functionTypeDomain = (Model.TypeVariable (Model.Name "x")),
Model.functionTypeCodomain = (Model.TypeFunction (Model.FunctionType {
Model.functionTypeDomain = (Model.TypeVariable (Model.Name "y")),
Model.functionTypeCodomain = (Model.TypeEither (Model.EitherType {
Model.eitherTypeLeft = (Model.TypeVariable (Model.Name "z")),
Model.eitherTypeRight = (Model.TypeVariable (Model.Name "x"))}))}))})),
Typing.parameterIsLazy = False},
Typing.Parameter {
Typing.parameterName = (Model.Name "acc0"),
Typing.parameterDescription = (Just "the initial accumulator value"),
Typing.parameterType = (Model.TypeVariable (Model.Name "x")),
Typing.parameterIsLazy = False},
Typing.Parameter {
Typing.parameterName = (Model.Name "xs"),
Typing.parameterDescription = (Just "the list to fold over"),
Typing.parameterType = (Model.TypeList (Model.TypeVariable (Model.Name "y"))),
Typing.parameterIsLazy = False}],
Typing.termSignatureResult = Typing.Result {
Typing.resultDescription = Nothing,
Typing.resultType = (Model.TypeEither (Model.EitherType {
Model.eitherTypeLeft = (Model.TypeVariable (Model.Name "z")),
Model.eitherTypeRight = (Model.TypeVariable (Model.Name "x"))}))}},
Packaging.primitiveDefinitionIsPure = True,
Packaging.primitiveDefinitionIsTotal = True,
Packaging.primitiveDefinitionDefaultImplementation = (Just (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "f"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "acc0"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "xs"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.lists.foldl")),
Model.applicationArgument = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "acc"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "el"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.eithers.bind")),
Model.applicationArgument = (Model.TermVariable (Model.Name "acc"))})),
Model.applicationArgument = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "a"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "f")),
Model.applicationArgument = (Model.TermVariable (Model.Name "a"))})),
Model.applicationArgument = (Model.TermVariable (Model.Name "el"))}))}))}))}))}))})),
Model.applicationArgument = (Model.TermEither (Right (Model.TermVariable (Model.Name "acc0"))))})),
Model.applicationArgument = (Model.TermVariable (Model.Name "xs"))}))}))}))})))}
isLeft :: Packaging.PrimitiveDefinition
isLeft =
Packaging.PrimitiveDefinition {
Packaging.primitiveDefinitionName = (Model.Name "hydra.core.lib.eithers.isLeft"),
Packaging.primitiveDefinitionMetadata = (Just (Packaging.EntityMetadata {
Packaging.entityMetadataDescription = (Just "Check whether an either is a Left value."),
Packaging.entityMetadataComments = [
"True if the argument is a Left variant, false if a Right.",
"Total. Corresponds to Haskell's Data.Either.isLeft :: Either a b -> Bool."],
Packaging.entityMetadataSeeAlso = [],
Packaging.entityMetadataLifecycle = (Just (Packaging.LifecycleInfo {
Packaging.lifecycleInfoAvailableSince = (Just (Packaging.Version "0.15")),
Packaging.lifecycleInfoDeprecatedSince = Nothing})),
Packaging.entityMetadataProvisions = [
Packaging.Provision {
Packaging.provisionName = (Model.Name "hydra.core.lib.eithers.isLeft.testsLeftVariant"),
Packaging.provisionKind = Packaging.ProvisionKindRequirement,
Packaging.provisionStatement = "isLeft returns true exactly when the either is a left value, and false for a right value."}]})),
Packaging.primitiveDefinitionSignature = Typing.TermSignature {
Typing.termSignatureTypeParameters = [
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "x"),
Typing.typeParameterConstraints = []},
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "y"),
Typing.typeParameterConstraints = []}],
Typing.termSignatureParameters = [
Typing.Parameter {
Typing.parameterName = (Model.Name "e"),
Typing.parameterDescription = (Just "the either value to test"),
Typing.parameterType = (Model.TypeEither (Model.EitherType {
Model.eitherTypeLeft = (Model.TypeVariable (Model.Name "x")),
Model.eitherTypeRight = (Model.TypeVariable (Model.Name "y"))})),
Typing.parameterIsLazy = False}],
Typing.termSignatureResult = Typing.Result {
Typing.resultDescription = Nothing,
Typing.resultType = (Model.TypeLiteral Model.LiteralTypeBoolean)}},
Packaging.primitiveDefinitionIsPure = True,
Packaging.primitiveDefinitionIsTotal = True,
Packaging.primitiveDefinitionDefaultImplementation = (Just (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "e"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.eithers.either")),
Model.applicationArgument = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "_"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermLiteral (Model.LiteralBoolean True))}))})),
Model.applicationArgument = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "_"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermLiteral (Model.LiteralBoolean False))}))})),
Model.applicationArgument = (Model.TermVariable (Model.Name "e"))}))})))}
isRight :: Packaging.PrimitiveDefinition
isRight =
Packaging.PrimitiveDefinition {
Packaging.primitiveDefinitionName = (Model.Name "hydra.core.lib.eithers.isRight"),
Packaging.primitiveDefinitionMetadata = (Just (Packaging.EntityMetadata {
Packaging.entityMetadataDescription = (Just "Check whether an either is a Right value."),
Packaging.entityMetadataComments = [
"True if the argument is a Right variant, false if a Left.",
"Total. Corresponds to Haskell's Data.Either.isRight :: Either a b -> Bool."],
Packaging.entityMetadataSeeAlso = [],
Packaging.entityMetadataLifecycle = (Just (Packaging.LifecycleInfo {
Packaging.lifecycleInfoAvailableSince = (Just (Packaging.Version "0.15")),
Packaging.lifecycleInfoDeprecatedSince = Nothing})),
Packaging.entityMetadataProvisions = [
Packaging.Provision {
Packaging.provisionName = (Model.Name "hydra.core.lib.eithers.isRight.testsRightVariant"),
Packaging.provisionKind = Packaging.ProvisionKindRequirement,
Packaging.provisionStatement = "isRight returns true exactly when the either is a right value, and false for a left value."}]})),
Packaging.primitiveDefinitionSignature = Typing.TermSignature {
Typing.termSignatureTypeParameters = [
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "x"),
Typing.typeParameterConstraints = []},
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "y"),
Typing.typeParameterConstraints = []}],
Typing.termSignatureParameters = [
Typing.Parameter {
Typing.parameterName = (Model.Name "e"),
Typing.parameterDescription = (Just "the either value to test"),
Typing.parameterType = (Model.TypeEither (Model.EitherType {
Model.eitherTypeLeft = (Model.TypeVariable (Model.Name "x")),
Model.eitherTypeRight = (Model.TypeVariable (Model.Name "y"))})),
Typing.parameterIsLazy = False}],
Typing.termSignatureResult = Typing.Result {
Typing.resultDescription = Nothing,
Typing.resultType = (Model.TypeLiteral Model.LiteralTypeBoolean)}},
Packaging.primitiveDefinitionIsPure = True,
Packaging.primitiveDefinitionIsTotal = True,
Packaging.primitiveDefinitionDefaultImplementation = (Just (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "e"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.eithers.either")),
Model.applicationArgument = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "_"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermLiteral (Model.LiteralBoolean False))}))})),
Model.applicationArgument = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "_"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermLiteral (Model.LiteralBoolean True))}))})),
Model.applicationArgument = (Model.TermVariable (Model.Name "e"))}))})))}
left :: Packaging.PrimitiveDefinition
left =
Packaging.PrimitiveDefinition {
Packaging.primitiveDefinitionName = (Model.Name "hydra.core.lib.eithers.left"),
Packaging.primitiveDefinitionMetadata = (Just (Packaging.EntityMetadata {
Packaging.entityMetadataDescription = (Just "Construct a left (error/exceptional) either value."),
Packaging.entityMetadataComments = [
"left(x) is Left x. The dual constructor to right, injecting into the Left (error/exceptional) side of an either.",
"Total. Corresponds to Haskell's Left :: a -> Either a b."],
Packaging.entityMetadataSeeAlso = [],
Packaging.entityMetadataLifecycle = (Just (Packaging.LifecycleInfo {
Packaging.lifecycleInfoAvailableSince = (Just (Packaging.Version "0.17.6")),
Packaging.lifecycleInfoDeprecatedSince = Nothing})),
Packaging.entityMetadataProvisions = [
Packaging.Provision {
Packaging.provisionName = (Model.Name "hydra.core.lib.eithers.left.constructsLeftVariant"),
Packaging.provisionKind = Packaging.ProvisionKindRequirement,
Packaging.provisionStatement = "left wraps a value as the left (error/exceptional) variant of an either."}]})),
Packaging.primitiveDefinitionSignature = Typing.TermSignature {
Typing.termSignatureTypeParameters = [
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "x"),
Typing.typeParameterConstraints = []},
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "y"),
Typing.typeParameterConstraints = []}],
Typing.termSignatureParameters = [
Typing.Parameter {
Typing.parameterName = (Model.Name "x"),
Typing.parameterDescription = (Just "the value to wrap as a Left"),
Typing.parameterType = (Model.TypeVariable (Model.Name "x")),
Typing.parameterIsLazy = False}],
Typing.termSignatureResult = Typing.Result {
Typing.resultDescription = Nothing,
Typing.resultType = (Model.TypeEither (Model.EitherType {
Model.eitherTypeLeft = (Model.TypeVariable (Model.Name "x")),
Model.eitherTypeRight = (Model.TypeVariable (Model.Name "y"))}))}},
Packaging.primitiveDefinitionIsPure = True,
Packaging.primitiveDefinitionIsTotal = True,
Packaging.primitiveDefinitionDefaultImplementation = Nothing}
lefts :: Packaging.PrimitiveDefinition
lefts =
Packaging.PrimitiveDefinition {
Packaging.primitiveDefinitionName = (Model.Name "hydra.core.lib.eithers.lefts"),
Packaging.primitiveDefinitionMetadata = (Just (Packaging.EntityMetadata {
Packaging.entityMetadataDescription = (Just "Extract all Left values from a list of either values."),
Packaging.entityMetadataComments = [
"lefts(xs) returns a list containing every Left value in xs, in original order, with Right values discarded.",
"Total. Corresponds to Haskell's Data.Either.lefts :: [Either a b] -> [a]."],
Packaging.entityMetadataSeeAlso = [],
Packaging.entityMetadataLifecycle = (Just (Packaging.LifecycleInfo {
Packaging.lifecycleInfoAvailableSince = (Just (Packaging.Version "0.15")),
Packaging.lifecycleInfoDeprecatedSince = Nothing})),
Packaging.entityMetadataProvisions = [
Packaging.Provision {
Packaging.provisionName = (Model.Name "hydra.core.lib.eithers.lefts.extractsLeftValuesPreservingOrder"),
Packaging.provisionKind = Packaging.ProvisionKindRequirement,
Packaging.provisionStatement = "lefts returns the list of every left value in the input list, in original order, discarding right values; given a list of only right values, or an empty list, the result is the empty list."}]})),
Packaging.primitiveDefinitionSignature = Typing.TermSignature {
Typing.termSignatureTypeParameters = [
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "x"),
Typing.typeParameterConstraints = []},
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "y"),
Typing.typeParameterConstraints = []}],
Typing.termSignatureParameters = [
Typing.Parameter {
Typing.parameterName = (Model.Name "xs"),
Typing.parameterDescription = (Just "the list of either values to extract Lefts from"),
Typing.parameterType = (Model.TypeList (Model.TypeEither (Model.EitherType {
Model.eitherTypeLeft = (Model.TypeVariable (Model.Name "x")),
Model.eitherTypeRight = (Model.TypeVariable (Model.Name "y"))}))),
Typing.parameterIsLazy = False}],
Typing.termSignatureResult = Typing.Result {
Typing.resultDescription = Nothing,
Typing.resultType = (Model.TypeList (Model.TypeVariable (Model.Name "x")))}},
Packaging.primitiveDefinitionIsPure = True,
Packaging.primitiveDefinitionIsTotal = True,
Packaging.primitiveDefinitionDefaultImplementation = (Just (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "xs"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.lists.foldr")),
Model.applicationArgument = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "e"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "acc"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.eithers.either")),
Model.applicationArgument = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "l"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.lists.cons")),
Model.applicationArgument = (Model.TermVariable (Model.Name "l"))})),
Model.applicationArgument = (Model.TermVariable (Model.Name "acc"))}))}))})),
Model.applicationArgument = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "_"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermVariable (Model.Name "acc"))}))})),
Model.applicationArgument = (Model.TermVariable (Model.Name "e"))}))}))}))})),
Model.applicationArgument = (Model.TermList [])})),
Model.applicationArgument = (Model.TermVariable (Model.Name "xs"))}))})))}
map :: Packaging.PrimitiveDefinition
map =
Packaging.PrimitiveDefinition {
Packaging.primitiveDefinitionName = (Model.Name "hydra.core.lib.eithers.map"),
Packaging.primitiveDefinitionMetadata = (Just (Packaging.EntityMetadata {
Packaging.entityMetadataDescription = (Just "Map a function over the Right side of an either (standard functor map)."),
Packaging.entityMetadataComments = [
"map(f, e) returns Right (f y) if e is Right y, or Left x unchanged if e is Left x.",
"The functor instance for either; treats the Right variant as the focus and leaves the Left variant alone.",
"Total. Corresponds to Haskell's fmap :: (a -> b) -> Either e a -> Either e b."],
Packaging.entityMetadataSeeAlso = [],
Packaging.entityMetadataLifecycle = (Just (Packaging.LifecycleInfo {
Packaging.lifecycleInfoAvailableSince = (Just (Packaging.Version "0.15")),
Packaging.lifecycleInfoDeprecatedSince = Nothing})),
Packaging.entityMetadataProvisions = [
Packaging.Provision {
Packaging.provisionName = (Model.Name "hydra.core.lib.eithers.map.mapsRightPreservesLeft"),
Packaging.provisionKind = Packaging.ProvisionKindRequirement,
Packaging.provisionStatement = "map applies the given function to the contained value when the either is a right, and leaves a left value completely unchanged."}]})),
Packaging.primitiveDefinitionSignature = Typing.TermSignature {
Typing.termSignatureTypeParameters = [
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "x"),
Typing.typeParameterConstraints = []},
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "y"),
Typing.typeParameterConstraints = []},
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "z"),
Typing.typeParameterConstraints = []}],
Typing.termSignatureParameters = [
Typing.Parameter {
Typing.parameterName = (Model.Name "f"),
Typing.parameterDescription = (Just "the function to apply to a Right value"),
Typing.parameterType = (Model.TypeFunction (Model.FunctionType {
Model.functionTypeDomain = (Model.TypeVariable (Model.Name "x")),
Model.functionTypeCodomain = (Model.TypeVariable (Model.Name "y"))})),
Typing.parameterIsLazy = False},
Typing.Parameter {
Typing.parameterName = (Model.Name "e"),
Typing.parameterDescription = (Just "the either value to map over"),
Typing.parameterType = (Model.TypeEither (Model.EitherType {
Model.eitherTypeLeft = (Model.TypeVariable (Model.Name "z")),
Model.eitherTypeRight = (Model.TypeVariable (Model.Name "x"))})),
Typing.parameterIsLazy = False}],
Typing.termSignatureResult = Typing.Result {
Typing.resultDescription = Nothing,
Typing.resultType = (Model.TypeEither (Model.EitherType {
Model.eitherTypeLeft = (Model.TypeVariable (Model.Name "z")),
Model.eitherTypeRight = (Model.TypeVariable (Model.Name "y"))}))}},
Packaging.primitiveDefinitionIsPure = True,
Packaging.primitiveDefinitionIsTotal = True,
Packaging.primitiveDefinitionDefaultImplementation = (Just (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "f"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "e"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.eithers.either")),
Model.applicationArgument = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "x"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermEither (Left (Model.TermVariable (Model.Name "x"))))}))})),
Model.applicationArgument = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "y"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermEither (Right (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "f")),
Model.applicationArgument = (Model.TermVariable (Model.Name "y"))}))))}))})),
Model.applicationArgument = (Model.TermVariable (Model.Name "e"))}))}))})))}
mapList :: Packaging.PrimitiveDefinition
mapList =
Packaging.PrimitiveDefinition {
Packaging.primitiveDefinitionName = (Model.Name "hydra.core.lib.eithers.mapList"),
Packaging.primitiveDefinitionMetadata = (Just (Packaging.EntityMetadata {
Packaging.entityMetadataDescription = (Just "Map a function returning either over a list, collecting results or short-circuiting on Left."),
Packaging.entityMetadataComments = [
"mapList(f, xs) applies f to each element of xs. If every application returns Right, the result is Right of the list of contained values, in original order. The first application that returns Left short-circuits the whole result to that Left.",
"Total. Corresponds to Haskell's traverse :: (a -> Either e b) -> [a] -> Either e [b]."],
Packaging.entityMetadataSeeAlso = [],
Packaging.entityMetadataLifecycle = (Just (Packaging.LifecycleInfo {
Packaging.lifecycleInfoAvailableSince = (Just (Packaging.Version "0.15")),
Packaging.lifecycleInfoDeprecatedSince = Nothing})),
Packaging.entityMetadataProvisions = [
Packaging.Provision {
Packaging.provisionName = (Model.Name "hydra.core.lib.eithers.mapList.traversesCollectingOrShortCircuiting"),
Packaging.provisionKind = Packaging.ProvisionKindRequirement,
Packaging.provisionStatement = "mapList applies the given either-returning function to each element of the list; if every application returns a right, the result is a right of the list of contained values in original order, and the first application returning a left short-circuits the whole result to that left; folding the empty list returns a right of the empty list."}]})),
Packaging.primitiveDefinitionSignature = Typing.TermSignature {
Typing.termSignatureTypeParameters = [
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "x"),
Typing.typeParameterConstraints = []},
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "y"),
Typing.typeParameterConstraints = []},
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "z"),
Typing.typeParameterConstraints = []}],
Typing.termSignatureParameters = [
Typing.Parameter {
Typing.parameterName = (Model.Name "f"),
Typing.parameterDescription = (Just "the either-returning function to apply to each element"),
Typing.parameterType = (Model.TypeFunction (Model.FunctionType {
Model.functionTypeDomain = (Model.TypeVariable (Model.Name "x")),
Model.functionTypeCodomain = (Model.TypeEither (Model.EitherType {
Model.eitherTypeLeft = (Model.TypeVariable (Model.Name "z")),
Model.eitherTypeRight = (Model.TypeVariable (Model.Name "y"))}))})),
Typing.parameterIsLazy = False},
Typing.Parameter {
Typing.parameterName = (Model.Name "xs"),
Typing.parameterDescription = (Just "the list to map over"),
Typing.parameterType = (Model.TypeList (Model.TypeVariable (Model.Name "x"))),
Typing.parameterIsLazy = False}],
Typing.termSignatureResult = Typing.Result {
Typing.resultDescription = Nothing,
Typing.resultType = (Model.TypeEither (Model.EitherType {
Model.eitherTypeLeft = (Model.TypeVariable (Model.Name "z")),
Model.eitherTypeRight = (Model.TypeList (Model.TypeVariable (Model.Name "y")))}))}},
Packaging.primitiveDefinitionIsPure = True,
Packaging.primitiveDefinitionIsTotal = True,
Packaging.primitiveDefinitionDefaultImplementation = (Just (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "f"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "xs"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.lists.foldr")),
Model.applicationArgument = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "x"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "acc"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.eithers.bind")),
Model.applicationArgument = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "f")),
Model.applicationArgument = (Model.TermVariable (Model.Name "x"))}))})),
Model.applicationArgument = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "y"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.eithers.map")),
Model.applicationArgument = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "ys"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.lists.cons")),
Model.applicationArgument = (Model.TermVariable (Model.Name "y"))})),
Model.applicationArgument = (Model.TermVariable (Model.Name "ys"))}))}))})),
Model.applicationArgument = (Model.TermVariable (Model.Name "acc"))}))}))}))}))}))})),
Model.applicationArgument = (Model.TermEither (Right (Model.TermList [])))})),
Model.applicationArgument = (Model.TermVariable (Model.Name "xs"))}))}))})))}
mapOptional :: Packaging.PrimitiveDefinition
mapOptional =
Packaging.PrimitiveDefinition {
Packaging.primitiveDefinitionName = (Model.Name "hydra.core.lib.eithers.mapOptional"),
Packaging.primitiveDefinitionMetadata = (Just (Packaging.EntityMetadata {
Packaging.entityMetadataDescription = (Just "Map a function returning either over an optional, or return Right none if none."),
Packaging.entityMetadataComments = [
"mapOptional(f, m) returns Right none if m is none; otherwise applies f to the contained value and returns the result with Right wrapped around given.",
"Total. Corresponds to Haskell's traverse :: (a -> Either e b) -> Maybe a -> Either e (Maybe b)."],
Packaging.entityMetadataSeeAlso = [],
Packaging.entityMetadataLifecycle = (Just (Packaging.LifecycleInfo {
Packaging.lifecycleInfoAvailableSince = (Just (Packaging.Version "0.15")),
Packaging.lifecycleInfoDeprecatedSince = Nothing})),
Packaging.entityMetadataProvisions = [
Packaging.Provision {
Packaging.provisionName = (Model.Name "hydra.core.lib.eithers.mapOptional.traversesOptionalCollectingOrShortCircuiting"),
Packaging.provisionKind = Packaging.ProvisionKindRequirement,
Packaging.provisionStatement = "mapOptional returns a right of none when the input optional is none; when the input is given a value, it applies the given function to that value and lifts a right result back into right of given, or propagates a left result unchanged."}]})),
Packaging.primitiveDefinitionSignature = Typing.TermSignature {
Typing.termSignatureTypeParameters = [
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "x"),
Typing.typeParameterConstraints = []},
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "y"),
Typing.typeParameterConstraints = []},
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "z"),
Typing.typeParameterConstraints = []}],
Typing.termSignatureParameters = [
Typing.Parameter {
Typing.parameterName = (Model.Name "f"),
Typing.parameterDescription = (Just "the either-returning function to apply to the contained value"),
Typing.parameterType = (Model.TypeFunction (Model.FunctionType {
Model.functionTypeDomain = (Model.TypeVariable (Model.Name "x")),
Model.functionTypeCodomain = (Model.TypeEither (Model.EitherType {
Model.eitherTypeLeft = (Model.TypeVariable (Model.Name "z")),
Model.eitherTypeRight = (Model.TypeVariable (Model.Name "y"))}))})),
Typing.parameterIsLazy = False},
Typing.Parameter {
Typing.parameterName = (Model.Name "m"),
Typing.parameterDescription = (Just "the optional to map over"),
Typing.parameterType = (Model.TypeOptional (Model.TypeVariable (Model.Name "x"))),
Typing.parameterIsLazy = False}],
Typing.termSignatureResult = Typing.Result {
Typing.resultDescription = Nothing,
Typing.resultType = (Model.TypeEither (Model.EitherType {
Model.eitherTypeLeft = (Model.TypeVariable (Model.Name "z")),
Model.eitherTypeRight = (Model.TypeOptional (Model.TypeVariable (Model.Name "y")))}))}},
Packaging.primitiveDefinitionIsPure = True,
Packaging.primitiveDefinitionIsTotal = True,
Packaging.primitiveDefinitionDefaultImplementation = (Just (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "f"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "m"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.optionals.match")),
Model.applicationArgument = (Model.TermVariable (Model.Name "m"))})),
Model.applicationArgument = (Model.TermEither (Right (Model.TermOptional Nothing)))})),
Model.applicationArgument = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "x"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.eithers.map")),
Model.applicationArgument = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "y"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermOptional (Just (Model.TermVariable (Model.Name "y"))))}))})),
Model.applicationArgument = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "f")),
Model.applicationArgument = (Model.TermVariable (Model.Name "x"))}))}))}))}))}))})))}
mapSet :: Packaging.PrimitiveDefinition
mapSet =
Packaging.PrimitiveDefinition {
Packaging.primitiveDefinitionName = (Model.Name "hydra.core.lib.eithers.mapSet"),
Packaging.primitiveDefinitionMetadata = (Just (Packaging.EntityMetadata {
Packaging.entityMetadataDescription = (Just "Map a function returning either over a set, collecting results or short-circuiting on Left."),
Packaging.entityMetadataComments = [
"mapSet(f, s) applies f to each element of s in unspecified order. If every application returns Right, the result is Right of the set of contained values (deduplicated by the result type's ordering); the first application returning Left short-circuits the whole result to that Left.",
"Requires an 'ordering' constraint on the input and output element types.",
"Total. Corresponds to Haskell's traverse-style operation specialised to Set."],
Packaging.entityMetadataSeeAlso = [],
Packaging.entityMetadataLifecycle = (Just (Packaging.LifecycleInfo {
Packaging.lifecycleInfoAvailableSince = (Just (Packaging.Version "0.15")),
Packaging.lifecycleInfoDeprecatedSince = Nothing})),
Packaging.entityMetadataProvisions = [
Packaging.Provision {
Packaging.provisionName = (Model.Name "hydra.core.lib.eithers.mapSet.traversesSetCollectingOrShortCircuiting"),
Packaging.provisionKind = Packaging.ProvisionKindRequirement,
Packaging.provisionStatement = "mapSet applies the given either-returning function to each element of the set; if every application returns a right, the result is a right of the set of contained values (deduplicated by the result type's ordering), and the first application returning a left short-circuits the whole result to that left; mapping the empty set returns a right of the empty set."}]})),
Packaging.primitiveDefinitionSignature = Typing.TermSignature {
Typing.termSignatureTypeParameters = [
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "x"),
Typing.typeParameterConstraints = [
Model.TypeClassConstraintSimple (Model.Name "ordering")]},
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "y"),
Typing.typeParameterConstraints = [
Model.TypeClassConstraintSimple (Model.Name "ordering")]},
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "z"),
Typing.typeParameterConstraints = []}],
Typing.termSignatureParameters = [
Typing.Parameter {
Typing.parameterName = (Model.Name "f"),
Typing.parameterDescription = (Just "the either-returning function to apply to each element"),
Typing.parameterType = (Model.TypeFunction (Model.FunctionType {
Model.functionTypeDomain = (Model.TypeVariable (Model.Name "x")),
Model.functionTypeCodomain = (Model.TypeEither (Model.EitherType {
Model.eitherTypeLeft = (Model.TypeVariable (Model.Name "z")),
Model.eitherTypeRight = (Model.TypeVariable (Model.Name "y"))}))})),
Typing.parameterIsLazy = False},
Typing.Parameter {
Typing.parameterName = (Model.Name "s"),
Typing.parameterDescription = (Just "the set to map over"),
Typing.parameterType = (Model.TypeSet (Model.TypeVariable (Model.Name "x"))),
Typing.parameterIsLazy = False}],
Typing.termSignatureResult = Typing.Result {
Typing.resultDescription = Nothing,
Typing.resultType = (Model.TypeEither (Model.EitherType {
Model.eitherTypeLeft = (Model.TypeVariable (Model.Name "z")),
Model.eitherTypeRight = (Model.TypeSet (Model.TypeVariable (Model.Name "y")))}))}},
Packaging.primitiveDefinitionIsPure = True,
Packaging.primitiveDefinitionIsTotal = True,
Packaging.primitiveDefinitionDefaultImplementation = (Just (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "f"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "s"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.eithers.map")),
Model.applicationArgument = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "ys"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.sets.fromList")),
Model.applicationArgument = (Model.TermVariable (Model.Name "ys"))}))}))})),
Model.applicationArgument = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.lists.foldr")),
Model.applicationArgument = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "x"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "acc"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.eithers.bind")),
Model.applicationArgument = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "f")),
Model.applicationArgument = (Model.TermVariable (Model.Name "x"))}))})),
Model.applicationArgument = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "y"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.eithers.map")),
Model.applicationArgument = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "ys"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.lists.cons")),
Model.applicationArgument = (Model.TermVariable (Model.Name "y"))})),
Model.applicationArgument = (Model.TermVariable (Model.Name "ys"))}))}))})),
Model.applicationArgument = (Model.TermVariable (Model.Name "acc"))}))}))}))}))}))})),
Model.applicationArgument = (Model.TermEither (Right (Model.TermList [])))})),
Model.applicationArgument = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.sets.toList")),
Model.applicationArgument = (Model.TermVariable (Model.Name "s"))}))}))}))}))})))}
partition :: Packaging.PrimitiveDefinition
partition =
Packaging.PrimitiveDefinition {
Packaging.primitiveDefinitionName = (Model.Name "hydra.core.lib.eithers.partition"),
Packaging.primitiveDefinitionMetadata = (Just (Packaging.EntityMetadata {
Packaging.entityMetadataDescription = (Just "Partition a list of either values into lefts and rights."),
Packaging.entityMetadataComments = [
"partition(xs) returns a pair (lefts, rights) where lefts contains every Left value from xs in original order and rights contains every Right value from xs in original order.",
"Total. Corresponds to Haskell's Data.Either.partitionEithers :: [Either a b] -> ([a], [b]).",
"Renamed from hydra.lib.eithers.partitionEithers."],
Packaging.entityMetadataSeeAlso = [],
Packaging.entityMetadataLifecycle = (Just (Packaging.LifecycleInfo {
Packaging.lifecycleInfoAvailableSince = (Just (Packaging.Version "0.17.6")),
Packaging.lifecycleInfoDeprecatedSince = Nothing})),
Packaging.entityMetadataProvisions = [
Packaging.Provision {
Packaging.provisionName = (Model.Name "hydra.core.lib.eithers.partition.splitsIntoLeftsAndRights"),
Packaging.provisionKind = Packaging.ProvisionKindRequirement,
Packaging.provisionStatement = "partition returns a pair of (every left value in the input, every right value in the input), each preserving original relative order; an all-left, all-right, or empty input list degrades to the corresponding (full, empty) / (empty, full) / (empty, empty) pairing."}]})),
Packaging.primitiveDefinitionSignature = Typing.TermSignature {
Typing.termSignatureTypeParameters = [
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "x"),
Typing.typeParameterConstraints = []},
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "y"),
Typing.typeParameterConstraints = []}],
Typing.termSignatureParameters = [
Typing.Parameter {
Typing.parameterName = (Model.Name "xs"),
Typing.parameterDescription = (Just "the list of either values to partition"),
Typing.parameterType = (Model.TypeList (Model.TypeEither (Model.EitherType {
Model.eitherTypeLeft = (Model.TypeVariable (Model.Name "x")),
Model.eitherTypeRight = (Model.TypeVariable (Model.Name "y"))}))),
Typing.parameterIsLazy = False}],
Typing.termSignatureResult = Typing.Result {
Typing.resultDescription = Nothing,
Typing.resultType = (Model.TypePair (Model.PairType {
Model.pairTypeFirst = (Model.TypeList (Model.TypeVariable (Model.Name "x"))),
Model.pairTypeSecond = (Model.TypeList (Model.TypeVariable (Model.Name "y")))}))}},
Packaging.primitiveDefinitionIsPure = True,
Packaging.primitiveDefinitionIsTotal = True,
Packaging.primitiveDefinitionDefaultImplementation = (Just (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "xs"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.lists.foldr")),
Model.applicationArgument = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "e"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "acc"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.eithers.either")),
Model.applicationArgument = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "l"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermPair (
Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.lists.cons")),
Model.applicationArgument = (Model.TermVariable (Model.Name "l"))})),
Model.applicationArgument = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.pairs.first")),
Model.applicationArgument = (Model.TermVariable (Model.Name "acc"))}))}),
(Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.pairs.second")),
Model.applicationArgument = (Model.TermVariable (Model.Name "acc"))}))))}))})),
Model.applicationArgument = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "r"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermPair (
Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.pairs.first")),
Model.applicationArgument = (Model.TermVariable (Model.Name "acc"))}),
(Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.lists.cons")),
Model.applicationArgument = (Model.TermVariable (Model.Name "r"))})),
Model.applicationArgument = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.pairs.second")),
Model.applicationArgument = (Model.TermVariable (Model.Name "acc"))}))}))))}))})),
Model.applicationArgument = (Model.TermVariable (Model.Name "e"))}))}))}))})),
Model.applicationArgument = (Model.TermPair (Model.TermList [], (Model.TermList [])))})),
Model.applicationArgument = (Model.TermVariable (Model.Name "xs"))}))})))}
right :: Packaging.PrimitiveDefinition
right =
Packaging.PrimitiveDefinition {
Packaging.primitiveDefinitionName = (Model.Name "hydra.core.lib.eithers.right"),
Packaging.primitiveDefinitionMetadata = (Just (Packaging.EntityMetadata {
Packaging.entityMetadataDescription = (Just "Construct a right (success/normal) either value."),
Packaging.entityMetadataComments = [
"right(x) is Right x. The dual constructor to left, injecting into the Right (success/normal) side of an either.",
"Total. Corresponds to Haskell's Right :: b -> Either a b."],
Packaging.entityMetadataSeeAlso = [],
Packaging.entityMetadataLifecycle = (Just (Packaging.LifecycleInfo {
Packaging.lifecycleInfoAvailableSince = (Just (Packaging.Version "0.17.6")),
Packaging.lifecycleInfoDeprecatedSince = Nothing})),
Packaging.entityMetadataProvisions = [
Packaging.Provision {
Packaging.provisionName = (Model.Name "hydra.core.lib.eithers.right.constructsRightVariant"),
Packaging.provisionKind = Packaging.ProvisionKindRequirement,
Packaging.provisionStatement = "right wraps a value as the right (success/normal) variant of an either."}]})),
Packaging.primitiveDefinitionSignature = Typing.TermSignature {
Typing.termSignatureTypeParameters = [
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "x"),
Typing.typeParameterConstraints = []},
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "y"),
Typing.typeParameterConstraints = []}],
Typing.termSignatureParameters = [
Typing.Parameter {
Typing.parameterName = (Model.Name "x"),
Typing.parameterDescription = (Just "the value to wrap as a Right"),
Typing.parameterType = (Model.TypeVariable (Model.Name "y")),
Typing.parameterIsLazy = False}],
Typing.termSignatureResult = Typing.Result {
Typing.resultDescription = Nothing,
Typing.resultType = (Model.TypeEither (Model.EitherType {
Model.eitherTypeLeft = (Model.TypeVariable (Model.Name "x")),
Model.eitherTypeRight = (Model.TypeVariable (Model.Name "y"))}))}},
Packaging.primitiveDefinitionIsPure = True,
Packaging.primitiveDefinitionIsTotal = True,
Packaging.primitiveDefinitionDefaultImplementation = Nothing}
rights :: Packaging.PrimitiveDefinition
rights =
Packaging.PrimitiveDefinition {
Packaging.primitiveDefinitionName = (Model.Name "hydra.core.lib.eithers.rights"),
Packaging.primitiveDefinitionMetadata = (Just (Packaging.EntityMetadata {
Packaging.entityMetadataDescription = (Just "Extract all Right values from a list of either values."),
Packaging.entityMetadataComments = [
"rights(xs) returns a list containing every Right value in xs, in original order, with Left values discarded.",
"Total. Corresponds to Haskell's Data.Either.rights :: [Either a b] -> [b]."],
Packaging.entityMetadataSeeAlso = [],
Packaging.entityMetadataLifecycle = (Just (Packaging.LifecycleInfo {
Packaging.lifecycleInfoAvailableSince = (Just (Packaging.Version "0.15")),
Packaging.lifecycleInfoDeprecatedSince = Nothing})),
Packaging.entityMetadataProvisions = [
Packaging.Provision {
Packaging.provisionName = (Model.Name "hydra.core.lib.eithers.rights.extractsRightValuesPreservingOrder"),
Packaging.provisionKind = Packaging.ProvisionKindRequirement,
Packaging.provisionStatement = "rights returns the list of every right value in the input list, in original order, discarding left values; given a list of only left values, or an empty list, the result is the empty list."}]})),
Packaging.primitiveDefinitionSignature = Typing.TermSignature {
Typing.termSignatureTypeParameters = [
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "x"),
Typing.typeParameterConstraints = []},
Typing.TypeParameter {
Typing.typeParameterName = (Model.Name "y"),
Typing.typeParameterConstraints = []}],
Typing.termSignatureParameters = [
Typing.Parameter {
Typing.parameterName = (Model.Name "xs"),
Typing.parameterDescription = (Just "the list of either values to extract Rights from"),
Typing.parameterType = (Model.TypeList (Model.TypeEither (Model.EitherType {
Model.eitherTypeLeft = (Model.TypeVariable (Model.Name "x")),
Model.eitherTypeRight = (Model.TypeVariable (Model.Name "y"))}))),
Typing.parameterIsLazy = False}],
Typing.termSignatureResult = Typing.Result {
Typing.resultDescription = Nothing,
Typing.resultType = (Model.TypeList (Model.TypeVariable (Model.Name "y")))}},
Packaging.primitiveDefinitionIsPure = True,
Packaging.primitiveDefinitionIsTotal = True,
Packaging.primitiveDefinitionDefaultImplementation = (Just (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "xs"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.lists.foldr")),
Model.applicationArgument = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "e"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "acc"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.eithers.either")),
Model.applicationArgument = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "_"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermVariable (Model.Name "acc"))}))})),
Model.applicationArgument = (Model.TermLambda (Model.Lambda {
Model.lambdaParameter = (Model.Name "r"),
Model.lambdaDomain = Nothing,
Model.lambdaBody = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermApplication (Model.Application {
Model.applicationFunction = (Model.TermVariable (Model.Name "hydra.core.lib.lists.cons")),
Model.applicationArgument = (Model.TermVariable (Model.Name "r"))})),
Model.applicationArgument = (Model.TermVariable (Model.Name "acc"))}))}))})),
Model.applicationArgument = (Model.TermVariable (Model.Name "e"))}))}))}))})),
Model.applicationArgument = (Model.TermList [])})),
Model.applicationArgument = (Model.TermVariable (Model.Name "xs"))}))})))}