Monads in Modern C++## +23 ## Monads in Modern C++ ## GEORGI KOYRUSHKI & ALISTAIR FISHER ## 20 23 October 01 - 06 ## Monads in Modern C++ Bloomberg Engineering ACCU 2023 April 20, 2023 Georgi Koyrushki, Senior com ## Bloomberg ## Agenda • Motivation: Why do we care about monads? • Theoretical basis: What are monads? • Beyond theory: Monads in the STL and the wider world ### TechAtBloomberg.com ## Bloomberg return values in a type with additional computation. In addition to defining a wrapping monadic type, monads define two operators: one to wrap a value in the monad type, and another to compose together functions0 码力 | 94 页 | 4.56 MB | 1 年前3
Applicative: The Forgotten Functional Pattern• I've written code that uses them, and it was good • I completely understand a) functors b) monads c) applicative ## FIRST, A QUICK SURVEY • I've heard of these functional patterns, but that's • I completely understand a) functors b) monads c) applicative • Haskell informs all my API designs ##### OR MAYBE THIS...? Well, I thought I knew about monads until you just said that, now I'm not not so sure... ##### OR MAYBE THIS...? Well, I thought I knew about monads until you just said that, now I'm not so sure... Don't worry about what ais. Rather we'll 0 码力 | 141 页 | 11.33 MB | 1 年前3
The Hitchhiker’s Guide to
Logical Verification85 5.5 Elimination 85 5.6 Further Examples 87 5.7 Summary of New Lean Constructs 91 6 Monads 93 6.1 Introductory Example 93 6.2 Two Operations and Three Laws 95 6.3 A Type Class 97 6 love06_monads_demo.lean is the main file associated with Chapter 6 ("Monads"), which is demonstrated in class, love06_monads_exercise_sheet.lean is the exercise sheet, and love06_monads_homework_sheet propositional extensionality linarith invokes a procedure for linear arithmetic ## Chapter 6 ## Monads Pure functional programming can sometimes feel overly restrictive. Effectful functional programming0 码力 | 215 页 | 1.95 MB | 2 年前3
An Introduction to Lean28 3.2 Recursive Definitions 30 3.3 Inhabited Types, Subtypes, and Option Types 32 3.4 Monads 34 3.5 Input and Output 35 3.6 An Example: Abstract Syntax 36 4 Theorem Proving in Lean methods and techniques of functional programming, including higher types, type classes, records, monads, and other abstractions. In fact, we have the entire Lean library at our disposal. With just a few it is much more pleasant and natural using monads, which we turn to next. ### 3.4 Monads This section assumes that you are familiar with the use of monads in functional programming languages, such as0 码力 | 48 页 | 191.92 KB | 2 年前3
Programming in Lean
Release 3.4.2Definitions 17 3.3 Inhabited Types, Subtypes, and Option Types 19 3.4 Input and Output 20 4 Monads 23 4.1 The option monad 24 4.2 The list monad 25 4.3 The state monad 26 4.4 The IO monad manually in the course of a computation can be tedious, but it is much more pleasant and natural using monads, which we turn to next. ### 3.4 Input and Output Lean can support programs that interact with the involving io that do not depend in any way on the particular results of the input and output. # MONADS In this chapter, we will describe a powerful abstraction known as a monad. A monad is a type constructor0 码力 | 51 页 | 220.07 KB | 2 年前3
Leveraging a Functional Approach for More Testable and Maintainable ROS 2 Codeeffects - Functional programming is identified by the use of higher order functions, pure functions, monads, declarative syntax ## What is Functional Programming? - A programming paradigm characterized by effects - Functional programming is identified by the use of higher order functions, pure functions, monads, declarative syntax ☐ C++ has all the tools to implement functional programming, including lambda effects - Functional programming is identified by the use of higher order functions, pure functions, monads, declarative syntax ☐ C++ has all the tools to implement functional programming, including lambda0 码力 | 200 页 | 1.77 MB | 1 年前3
The Lean Reference Manual
Release 3.3.0Conversions .56 6.11 The SMT State .56 7 Programming .57 7.1 The Virtual Machine .57 7.2 Monads .57 8 Metaprogramming .59 8.1 Quotations .59 8.2 User Defined Attributes .59 Conversions ### 6.11 The SMT State ## PROGRAMMING ### 7.1 The Virtual Machine ### 7.2 Monads (Describe instances of monads and monadic notation.) METAPROGRAMMING 8.1 Quotations 8.2 User Defined Attributes0 码力 | 67 页 | 266.23 KB | 2 年前3
2.1.6 谈谈 Go 泛型alt=‘OCR图片’/> 函数式编程 github.com/samber/mo Option[T] (Maybe) Result[T] github.com/OlegStotsky/go-monads Either[A, B] EitherX[T1, …, TX] (With X between 3 and 5) Future[T] IOEither[T] IO[T] ols Code-Hex/go-generics-cache golobby/orm repeale/fp-go nikgalushko/fx OlegStotsky/go-monads mattn/go-generics-example barweiss/go-tuple ’ alt=‘OCR图片’/> samber/lo Filter Map FilterMap0 码力 | 52 页 | 3.09 MB | 1 月前3
Haskell 2010 Language ReportThe Monad class defines the basic operations over a monad. See Chapter 7 for more information about monads. “do” expressions provide a convenient syntax for writing monadic expressions (see Section 3.14) module provides the Functor, Monad and MonadPlus classes, together with some useful operations on monads. ### 13.1 Functor and monad classes ## class Functor f where The Functor class is used for types instance Monad [] instance Monad IO instance Monad Maybe ## class Monad m => MonadPlus m where Monads that also support choice and failure. ## Methods mzero :: m a the identity of mplus. It should0 码力 | 329 页 | 1.43 MB | 2 年前3
Back To Basics: Functional Programming in C++value using another I/O action We can write join that flattens nested io_action ## Those are all monads ## C++ Definition ## A monad is a type that implements the operations ☑ .transform ☐ .and_then operations ☑ .transform ☐ .and_then ☐ .join together with some way to build a monad from a value. ## Monads enable composition think-cell Join our team as a C++ Developer or Intern 












