4 ms·
If I define this in c++ lingo words barely change. You take a c++ parent class with two virtual methods. These methods are "return" and "bind". In order to imp
by setra 10y ago
If I define this in c++ lingo words barely change.
You take a c++ parent class with two virtual methods. These methods are "return" and "bind". In order to implement a monad instance you must derive from this parents class and implement the virtual methods.
- jnordwick 10y agoWhat is bind and what is return? What do they do?
- setra 10y agoI was translating your quote to c++ lingo not defining functions. return takes a value and returns an instance of your template class containing the value. bind takes an instance of your (template class A) a function of (type a ) to (template class B) and produces a value of (template class B). If you don't care about the "laws" your definitions are expected to follow thats it. The idea bind is you take a value of a template class such as (std::vector<Int> type) the value {3}, then based on value either pass it to the next function or return it. one definition of bind would be if the vector is empty return it, if its not empty pass it to this function and return the result of that function. return is just a way of placing a value into your template container class.
- deleted 10y ago[deleted]