Monadic Operations in Modern C++: A Practical Approach
Monadic Operations in Modern C++: A Practical Approach2About me ● Vitaly Fanaskov ● Senior software engineer at reMarkable ● 10+ years of C++ experience ● GIS, VFX, frameworks, and libraries ● Ph Ph.D (CS) 3Agenda ● Briefly about expected and optional ● Common use cases of expected ● Monadic operations in software development ● Tips and tricks 4In this talk ● Less theory ● C++ only ● Practical get a new widget {}: {}.", widgetBox.value(), error); } } 22How do we handle this? 23Monadic operations: and_then if (const auto widgetBox = getNewWidget(); widgetBox.has_value()) { const auto0 码力 | 61 页 | 411.49 KB | 5 月前3Pipeline Architectures in C++: Overloaded Pipe Operator | and Its Monadic Operations
Title: Pipeline architectures in C++: overloaded pipe operator | std::expected and its monadic operations Brief overview: Functional programming in C++ is gaining importance and is attracting programmers pipe operator | will be presented, as well as I’ll explain std::expected and especially its monadic operations that can be tricky in practice. All these together present novel and efficient programming pipelines. What's more, std::expected itself allows you to build pipelines – this time using its monadic operations. In this poseter I will explain details how to build your own pipeline architecture in modern0 码力 | 3 页 | 422.24 KB | 5 月前3Intro to Prometheus - With a dash of operations & observability
Introduction Background Operations & observability Outro Intro to Prometheus With a dash of operations & observability Richard Hartmann & Frederic Branczyk @TwitchiH & @fredbrancz 2018-12-12 Richard Hartmann & Frederic Branczyk @TwitchiH & @fredbrancz Intro to Prometheus Introduction Background Operations & observability Outro Who are we? Richard ”RichiH” Hartmann Swiss army chainsaw at SpaceNet Hartmann & Frederic Branczyk @TwitchiH & @fredbrancz Intro to Prometheus Introduction Background Operations & observability Outro Time split 1 1/3 Prometheus 2 1/3 Observability 3 1/3 Questions Richard0 码力 | 19 页 | 63.73 KB | 1 年前3C++23: An Overview of Almost All New and Updated Features
tains() Construct string(_view) From nullptr basic_string::resize_and_overwrite() Monadic Operations for std::optional Stacktrace Library Changes to Ranges Library Changes to Views Library tains() Construct string(_view) From nullptr basic_string::resize_and_overwrite() Monadic Operations for std::optional Stacktrace Library Changes to Ranges Library Changes to Views Library tains() Construct string(_view) From nullptr basic_string::resize_and_overwrite() Monadic Operations for std::optional Stacktrace Library Changes to Ranges Library Changes to Views Library0 码力 | 105 页 | 759.96 KB | 5 月前3Leveraging a Functional Approach for More Testable and Maintainable ROS 2 Code
Code */ }Monadic Error Handling ● Monadic error handling is a functional programming technique for dealing with errors in a clean, compositional, and type-safe wayMonadic Error Handling ● Monadic error type-safe way ● This approach encapsulates error handling into types and operations on these typesMonadic Error Handling ● Monadic error handling is a functional programming technique for dealing with errors ● This approach encapsulates error handling into types and operations on these types ● Why is this desirable?Monadic Error Handling ● Monadic error handling is a functional programming technique for dealing0 码力 | 200 页 | 1.77 MB | 5 月前3Haskell 2010 Language Report
. . . . . . . . . . . . . . . . 47 4.3.4 Ambiguous Types, and Defaults for Overloaded Numeric Operations . . . . . . . . 48 4.4 Nested Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 6.4.2 Arithmetic and Number-Theoretic Operations . . . . . . . . . . . . . . . . . . . . . 82 6.4.3 Exponentiation and Logarithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 7.2 Sequencing I/O Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 7.3 Exception Handling0 码力 | 329 页 | 1.43 MB | 1 年前3Monads in Modern C++
wrapping monadic type, monads define two operators: one to wrap a value in the monad type, and another to compose together functions that output values of the monad type (these are known as monadic functions) functions). General-purpose languages use monads to reduce boilerplate code needed for common operations (such as dealing with undefined values or fallible functions, or encapsulating bookkeeping code). wrapping monadic type, monads define two operators: one to wrap a value in the monad type, and another to compose together functions that output values of the monad type (these are known as monadic functions)0 码力 | 94 页 | 4.56 MB | 5 月前3Compile-Time Validation
composition operators. • Monads: Encapsulates computations with context, allowing for the chaining of operations while managing side effects or state through a standardized interface.Composition - Return Values access can throw result.value(); result.error();Monadic Operations Safely access the wrapped result value. The context type can change between monadic operations. std::expectedresult = foo(); caused itCons • Can only validate based on the recorded actions • Requires proxy types to record operations • Uses macros to record control flow • Uses compiler loophole for stateful metaprogrammingC++26 0 码力 | 137 页 | 1.70 MB | 5 月前3Modern C++ Error Handling
passed string is not a number Error: Divide by zerostd::expected and std::optional C++23 monadic operations for0.024390243 Error: passed string is not a number Error: Divide by zero void test(std::string_view param Global/ TL variable Boost Leaf? Exceptions optional/ expected Raw Raw in lambda Monadic operations assert Policy-based Checking Checked/ unchecked versions Correct-by-construction Throwing0 码力 | 66 页 | 36.65 MB | 5 月前3Applicative: The Forgotten Functional Pattern
m b) -> m a -> m b -- bind with flipped args (>>=) :: m a -> (a -> m b) -> m b 16MONADIC FUNCTIONS FOR MONADIC FUNCTIONS FOR std::optional std::optional "If "If *this *this contains a value, invokes (this is (this is fmap fmap)) templateconstexpr auto transform(F&& f); 17MONADIC FUNCTIONS FOR MONADIC FUNCTIONS FOR std::optional std::optional "If "If *this *this contains a value, invokes and Monad. Every Monad is also an Applicative. And Functorial/Monadic patterns show up in C++ sometime post C++11. And Functorial/Monadic patterns show up in C++ sometime post C++11. 21PART 2 PART 2 0 码力 | 141 页 | 11.33 MB | 5 月前3
共 1000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 100
相关搜索词
MonadicOperationsinModernC++PracticalApproachPipelineArchitecturesOverloadedPipeOperatorandItsIntrotoPrometheusWithdashofoperationsobservability23AnOverviewAlmostAllNewUpdatedFeaturesLeveragingFunctionalforMoreTestableMaintainableROSCodeHaskell2010MonadsCompileTimeValidationErrorHandlingApplicativeTheForgottenPattern