Fugue.AWS.IAM.Typed.JSONParse

Module Members

bind

(Function)

Chain together Results.

Type Signature

 fun (Result<a>, fun (a) -> Result<b>) -> Result<b>
Argument: x
Type: Result<a>
Argument: f
Type: fun ( a) -> Result<b>
Returns:
Type: Result<b>

err

(Function)

Return an error as the Result of a JSON conversion.

Type Signature

 fun (String) -> Result<a>
Argument: x
Type: String
Returns:
Type: Result<a>

jsonErr

(Function)

Add the JSON string to a conversion error message.

Type Signature

 fun (String, JSON) -> Result<a>
Argument: x
Type: String
Argument: y
Type: JSON
Returns:
Type: Result<a>

jsonType

(Function)

Convert the type of a JSON value into a Ludwig.String.

Type Signature

 fun (JSON) -> String
Argument: x
Type: JSON
Returns:
Type: String

name

(Function)

Match a literal JSON field name.

Type Signature

 fun (String) -> fun (String) -> Result<0-tuple>
Argument: s0
Type: String
Returns:
Type: fun ( String) -> Result<0-tuple>

optionalField

(Function)

Return an Ludwig.Optional field value from a JSON value.

Type Signature

 fun (fun (String) -> Result<a>, fun (a) -> Parser<b>) -> Parser<Optional<b>>
Argument: f
Type: fun ( String) -> Result<a>
Argument: g
Type: fun ( a) -> Parser<b>
Returns:
Type: Parser<Optional<b>>

parseList

(Function)

Return a Ludwig.List of values from a JSON array.

Type Signature

 fun (Parser<a>) -> Parser<List<a>>
Argument: f
Type: Parser<a>
Returns:
Type: Parser<List<a>>

parseMap

(Function)

Return a Ludwig.List of values from a JSON Ludwig.Dictionary key and value.

Type Signature

 fun (fun (String) -> Parser<a>) -> Parser<List<a>>
Argument: f
Type: fun ( String) -> Parser<a>
Returns:
Type: Parser<List<a>>

reduceResults

(Function)

helper function for parseMap

Type Signature

 fun (fun (b) -> Result<a>, List<b>) -> Result<List<a>>
Argument: f0
Type: fun ( b) -> Result<a>
Argument: xs0
Type: List<b>
Returns:
Type: Result<List<a>>

requiredField

(Function)

Return a required field value from a JSON value.

Type Signature

 fun (fun (String) -> Result<a>, fun (a) -> Parser<b>) -> Parser<b>
Argument: f
Type: fun ( String) -> Result<a>
Argument: g
Type: fun ( a) -> Parser<b>
Returns:
Type: Parser<b>

result

(Function)

Return a value as the Result of a JSON conversion.

Type Signature

 fun (a) -> Result<a>
Argument: x
Type: a
Returns:
Type: Result<a>

=>

(Operator)

operator => infixl 1:
  bind

bind operator

Parser

(Type)

type Parser<a>:
  fun(JSON) -> Result<a>

Parser type used to parse JSON values into Results. JSON) -> Result<a>

Result

(Type)

type Result<a>:
  | Result a
  | Err String

Err

(Constructor)

Argument:
Ludwig.String

Result

(Constructor)

Argument:
a

Result type used to account for possible errors when converting JSON to values.

parseObject

(Value)

(Parser<Dictionary<JSON>>) parseObject:
  fun(x): case x of | Object a -> result(a)
                    | _ -> jsonErr("JSONParse.parseObject", x)

Extract a JSON Ludwig.Dictionary from a JSON value.

Type Signature

 Parser<Dictionary<JSON>>

parseSingletonDictionary

(Value)

(Parser<(String, JSON)>) parseSingletonDictionary:
  fun(x): =>(parseObject(x), fun(a): case uncons(toList(a)) of | None -> err("JSONParse.parseSingletonDictionary: empty list")
                                                               | Optional (b
                                                                          ,[]) -> result(b)
                                                               | Optional _ -> err("JSONParse.parseSingletonDictionary: not singleton"))

Return the key and value from a singleton JSON dictionary.

Type Signature

 Parser<(String, JSON)>

parseString

(Value)

(Parser<String>) parseString:
  fun(x): case x of | String s -> result(s)
                    | _ -> jsonErr("JSONParse.parseString", x)

Return a Ludwig.String from a JSON value.

Type Signature

 Parser<String>