Function caseJsonConstructor

  • Internal

    This matches the corresponding Haskell function in lbr-prelude.

    Type Parameters

    • A

    Parameters

    • title: string
    • fromJsonFields: {
          [index: string]: ((fields) => A);
      }
      • [index: string]: ((fields) => A)
          • (fields): A
          • Parameters

            Returns A

    • value: Readonly<Value>

    Returns A

    Example

    caseJsonConstructor(title, [ [ctor1, fromJsonFields1 ], ..., [ctorN, fromJsonFieldsN ] ], value) parses the JSON value value of the form

    { "name" : <ctori>
    , "fields" : <fromJsonFieldsi>
    }

    where

    • <ctori> are the arguments passed in;

    • <fromJsonFieldsi> is the result of fromJsonFieldsi; and

    • <title> === <ctori> for some i.

Generated using TypeDoc