{
    "title": "Result",
    "level": "Low",
    "elements": [
        {
            "pattern": "Result type, representing either a successul result Ok x or an error Error x.",
            "module": "Result",
            "name": "t",
            "type": "type",
            "signature": "type ('a, 'b) t = ( 'a, 'b ) result",
            "description": "",
            "examples": []
        },
        {
            "pattern": "Wrap a value in a successful result",
            "module": "Result",
            "name": "return",
            "type": "val",
            "signature": "val return : 'a -> ( 'a, 'b ) result",
            "description": "",
            "examples": []
        },
        {
            "pattern": "Wrap a value in an error result",
            "module": "Result",
            "name": "fail",
            "type": "val",
            "signature": "val fail : 'a -> ( 'b, 'a ) result",
            "description": "",
            "examples": []
        },
        {
            "pattern": "Map a function over a successful result",
            "module": "Result",
            "name": "map",
            "type": "val",
            "signature": "val map : ( 'a -> 'b ) -> ( 'a, 'c ) result -> ( 'b, 'c ) result",
            "description": "",
            "examples": []
        },
        {
            "pattern": "Map a function over an error result",
            "module": "Result",
            "name": "map_err",
            "type": "val",
            "signature": "val map_err : ( 'a -> 'b ) -> ( 'c, 'a ) result -> ( 'c, 'b ) result",
            "description": "",
            "examples": []
        },
        {
            "pattern": "Get the value from a successful result or return a default value",
            "module": "Result",
            "name": "get_or",
            "type": "val",
            "signature": "val get_or : ( 'a, 'b ) result -> default:'a -> 'a",
            "description": "",
            "examples": []
        },
        {
            "pattern": "Get the value from a successful result or return a default value",
            "module": "Result",
            "name": "map_or",
            "type": "val",
            "signature": "val map_or : ( 'a -> 'b ) -> ( 'a, 'c ) result -> default:'b -> 'b",
            "description": "",
            "examples": []
        },
        {
            "pattern": "Monadic bind operator",
            "module": "Result",
            "name": "(>=)",
            "type": "val",
            "signature": "val (>=) : ( 'a, 'b ) result -> ( 'a -> 'c ) -> ( 'c, 'b ) result",
            "description": "",
            "examples": []
        },
        {
            "pattern": "Flatten a result of results",
            "module": "Result",
            "name": "flat_map",
            "type": "val",
            "signature": "val flat_map : ( 'a -> ( 'b, 'c ) result ) -> ( 'a, 'c ) result -> ( 'b, 'c ) result",
            "description": "",
            "examples": []
        },
        {
            "pattern": "Monadic bind operator",
            "module": "Result",
            "name": "(>>=)",
            "type": "val",
            "signature": "val (>>=) : ( 'a, 'b ) result -> ( 'a -> ( 'c, 'b ) result ) -> ( 'c, 'b ) result",
            "description": "",
            "examples": []
        },
        {
            "pattern": "Fold a result",
            "module": "Result",
            "name": "fold",
            "type": "val",
            "signature": "val fold : ok:( 'a -> 'b ) -> error:( 'c -> 'b ) -> ( 'a, 'c ) result -> 'b",
            "description": "",
            "examples": []
        },
        {
            "pattern": "Check if a result is successful",
            "module": "Result",
            "name": "is_ok",
            "type": "val",
            "signature": "val is_ok : ( 'a, 'b ) result -> bool",
            "description": "",
            "examples": []
        },
        {
            "pattern": "",
            "module": "Result",
            "name": "is_error",
            "type": "val",
            "signature": "val is_error : ( 'a, 'b ) result -> bool",
            "description": "",
            "examples": []
        },
        {
            "pattern": "Combine two results with a product",
            "module": "Result",
            "name": "monoid_product",
            "type": "val",
            "signature": "val monoid_product : ( 'a, 'b ) result -> ( 'c, 'b ) result -> ( 'a * 'c, 'b ) result",
            "description": "",
            "examples": []
        },
        {
            "pattern": "Combine two results with a product",
            "module": "Result",
            "name": "let+",
            "type": "val",
            "signature": "val let+ : ( 'a, 'b ) result -> ( 'a -> 'c ) -> ( 'c, 'b ) result",
            "description": "",
            "examples": []
        },
        {
            "pattern": "Combine two results with a product",
            "module": "Result",
            "name": "and+",
            "type": "val",
            "signature": "val and+ : ( 'a, 'b ) result -> ( 'c, 'b ) result -> ( 'a * 'c, 'b ) result",
            "description": "",
            "examples": []
        },
        {
            "pattern": "Monadic bind operator",
            "module": "Result",
            "name": "let*",
            "type": "val",
            "signature": "val let* : ( 'a, 'b ) result -> ( 'a -> ( 'c, 'b ) result ) -> ( 'c, 'b ) result",
            "description": "",
            "examples": []
        },
        {
            "pattern": "Combine two results with a product",
            "module": "Result",
            "name": "and*",
            "type": "val",
            "signature": "val and* : ( 'a, 'b ) result -> ( 'c, 'b ) result -> ( 'a * 'c, 'b ) result",
            "description": "",
            "examples": []
        }
    ],
    "metadata": {
        "signatures": [
            "type ('a, 'b) t = ( 'a, 'b ) result",
            "val return : 'a -> ( 'a, 'b ) result",
            "val fail : 'a -> ( 'b, 'a ) result",
            "val map : ( 'a -> 'b ) -> ( 'a, 'c ) result -> ( 'b, 'c ) result",
            "val map_err : ( 'a -> 'b ) -> ( 'c, 'a ) result -> ( 'c, 'b ) result",
            "val get_or : ( 'a, 'b ) result -> default:'a -> 'a",
            "val map_or : ( 'a -> 'b ) -> ( 'a, 'c ) result -> default:'b -> 'b",
            "val (>|=) : ( 'a, 'b ) result -> ( 'a -> 'c ) -> ( 'c, 'b ) result",
            "val flat_map : ( 'a -> ( 'b, 'c ) result ) -> ( 'a, 'c ) result -> ( 'b, 'c ) result",
            "val (>>=) : ( 'a, 'b ) result -> ( 'a -> ( 'c, 'b ) result ) -> ( 'c, 'b ) result",
            "val fold : ok:( 'a -> 'b ) -> error:( 'c -> 'b ) -> ( 'a, 'c ) result -> 'b",
            "val is_ok : ( 'a, 'b ) result -> bool",
            "val is_error : ( 'a, 'b ) result -> bool",
            "val monoid_product : ( 'a, 'b ) result -> ( 'c, 'b ) result -> ( 'a * 'c, 'b ) result",
            "val let+ : ( 'a, 'b ) result -> ( 'a -> 'c ) -> ( 'c, 'b ) result",
            "val and+ : ( 'a, 'b ) result -> ( 'c, 'b ) result -> ( 'a * 'c, 'b ) result",
            "val let* : ( 'a, 'b ) result -> ( 'a -> ( 'c, 'b ) result ) -> ( 'c, 'b ) result",
            "val and* : ( 'a, 'b ) result -> ( 'c, 'b ) result -> ( 'a * 'c, 'b ) result"
        ],
        "description": "Result type, representing either a successul result `Ok x` or an error `Error x`.",
        "source": "https://docs.imandra.ai/imandra-docs/odoc/imandra-base/Imandra_prelude/Result/index.html"
    }
}