Real World Haskell: Code You Can Believe In by Bryan O'Sullivan
Author:Bryan O'Sullivan [O'Sullivan, Bryan]
Language: eng
Format: azw3
Tags: COMPUTERS / Programming Languages / General
ISBN: 9780596156923
Publisher: O'Reilly Media
Published: 2008-11-15T05:00:00+00:00
Controlled Escape
The Monad typeclass doesn’t provide any means for values to escape their monadic shackles. We can inject a value into a monad using return. We can extract a value from a monad using (>>=) but the function on the right, which can see an unwrapped value, has to wrap its own result back up again.
Most monads have one or more runLogger-like functions. The notable exception is of course IO, which we usually escape from simply by exiting a program.
A monad execution function runs the code inside the monad and unwraps its result. Such functions are usually the only means provided for a value to escape from its monadic wrapper. The author of a monad thus has complete control over how whatever happens inside the monad gets out.
Some monads have several execution functions. In our case, we can imagine a few alternatives to runLogger: one might return only the log messages, whereas another might return just the result and drop the log messages.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Deep Learning with Python by François Chollet(12571)
Hello! Python by Anthony Briggs(9916)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9796)
The Mikado Method by Ola Ellnestam Daniel Brolund(9779)
Dependency Injection in .NET by Mark Seemann(9340)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8300)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7763)
Grails in Action by Glen Smith Peter Ledbrook(7696)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7557)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(7084)
Microservices with Go by Alexander Shuiskov(6854)
Practical Design Patterns for Java Developers by Miroslav Wengner(6772)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6711)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6419)
Angular Projects - Third Edition by Aristeidis Bampakos(6118)
The Art of Crafting User Stories by The Art of Crafting User Stories(5647)
NetSuite for Consultants - Second Edition by Peter Ries(5580)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5385)
Kotlin in Action by Dmitry Jemerov(5065)
