package plebeia
Functional storage using Merkle Patricia tree
Install
dune-project
Dependency
Authors
Maintainers
Sources
plebeia-2.1.0.tar.gz
md5=104e71a50a29b96a4b508004a539c88a
sha512=5edcd6c73dc276011c6344e121e978d294e3b8847ce6e8b28b03a2c7f3ed6bd1a860775dfb9d5b399442d66eeffcb45d9aab6f08b4accdf9287b5b7dbbf91506
doc/src/plebeia/result_lwt.ml.html
Source file result_lwt.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
(*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2019,2020 DaiLambda, Inc. <contact@dailambda.jp> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) (* "Error" monad *) include Monad.Make2(struct type ('a, 'b) t = ('a, 'b) Result.t Lwt.t let return = Lwt.return_ok let bind x f = Lwt.bind x @@ function | Error e -> Lwt.return_error e | Ok x -> f x end) (* optimized *) let map f x = Lwt.map (Result.map f) x let (>|=) x f = Lwt.map (Result.map f) x let from_Ok_lwt x = Lwt.bind x (function | Ok x -> Lwt.return x | Error _e -> failwith "Expected an Ok") let from_Error_lwt x = Lwt.bind x (function | Ok _x -> failwith "Expected an Error" | Error e -> Lwt.return e) let default r f = Lwt.bind r @@ function | Ok x -> Lwt.return x | Error e -> Lwt.return (f e) let errorf fmt = Printf.ksprintf (fun s -> Lwt.return_error s) fmt let map_error f = Lwt.map (Result.map_error f) module Infix = struct let (>>=?) = Infix.(>>=) let (>|=?) = (>|=) let (>>?) = Result.Infix.(>>=) let (>|?) = Result.Infix.(>|=) let (>>=) = Lwt.Infix.(>>=) let (>|=) = Lwt.Infix.(>|=) end module Syntax = struct open Infix let (let*=?) = (>>=?) let (let+=?) = (>|=?) let (let*?) = (>>?) let (let+?) = (>|?) let (let*=) = (>>=) let (let+=) = (>|=) end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>