Jump to content

Category:Monads: Difference between revisions

m
no edit summary
(Slight reorganisation of the overview text)
mNo edit summary
Line 4:
Functions of this type can not be directly nested with each other, because their output type (wrapped) does not match their input type (raw and unwrapped).
 
The monad pattern consists of writing two higher-order functions which allowsolve this problem, allowing the programmer to easily nest the application of such functions, by abstracting out the mechanics, and making sure that a function does not choke on an unexpected input type (a wrapped type, when it was expected a raw type).
 
More specifically, the two higher-order functions of the monad pattern handle the details of: 1. wrapping data in a particular kind of envelope, and 2. Providing other functions with direct access to the contents of an enclosing envelope.
9,655

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.