3

In Haskell, a programming language, the concept of input/output monad is used to separate (or connect? (bind!)) the running software from its interaction with the hardware.

This makes me wonder if it is correct to think of me as a monad (software and hardware, mind and body). Or perhaps, am I inside an I/O monad? Or are we all, together with the cosmos a monad?

  • 3
    I'm not too familiar with Haskell but I/O monad and Leibniz's idea of monad seem pretty far apart insofar as a Leibniz monad does not interact with its environment, at least not in the take input from environment then do something sense. – virmaior Aug 6 '15 at 23:32
  • 2
    If you take any analogy seriously you would end up being anything - even a stackexchange question itself :) – Ankur Aug 7 '15 at 5:19
  • I'm not sure what the right definition of software is here, if you want to say the I/O monad seperates it from hardware. Or in which way input really relates to hardware - there is a relation if you think of a user pressing a number button while running the program, that I certainly grant you. Running code is hardware working according to software rules. I'd say that monad let's you encapsulate a running code to not be affected by further input. Is this a matter of software vs. hardware? – Nikolaj-K Aug 7 '15 at 11:15
  • 1
    Isn't this related? "Leibniz's theory is best known as a solution to the mind-body problem of how mind can interact with the body" en.wikipedia.org/wiki/Pre-established_harmony – Lay González Aug 15 '15 at 3:31
  • 2
    @LayGonzález I am sure that is the reason for the name. People who design computer languages and their related concepts are often quite fond of deep metaphors bordering on puns. And this would be an example of such. Monads would be the only way for interaction between independent processes, as well as the only way for a process to affect the world outside the computer. – jobermark Aug 28 '15 at 15:35
2

I would argue that there is some particular part of you that de-parallelizes your processing and binds your referents to externals.

That is the monad, the wrapper that allows you to safely have external referents upon which you can have predictable, lasting effects without being permanently bound to them or containing them.

That it is not all of you, much of you has other purposes. It is just the interface of consciousness.

So consciousness is the monad, most of your brain activity is a largely pure process. (Most thoughts only have effects within the brain, and not on anything else, the same way a pure process only affects processor state, not the outside world.)

Then you, as the application of a (somewhat) pure process via a monad, are a process with effects.

  • thoughts radiate heat. it has an effect on immediate air surroundings, which could cause dilatation and increased pressure in the room, which could be the deciding factor into the falling of a very very unstable piece of bauble on the shelf, if some vibrations is added to it from a neighbor walking for example. You could decide to go fit it back in place and miss an important phone call because you went too far away from it to pick it up in time.... – v.oddou Nov 18 '15 at 3:02
  • There is no perfect isolation, but this is an exceptionally silly example. The amount of heat the brain radiates has little to do with thinking. – jobermark Nov 18 '15 at 15:11
  • joke aside, I think I remember reading somewhere that it very much does ! There is a variation of 20 watts above a 20/30 watts baseline. – v.oddou Nov 19 '15 at 1:23
5

A monad is a mathematical construct. Generally speaking, it is not typical to assume humans are mathematical constructs.

However, it may be valid to argue that you are "well modeled as a monad." This would be to say that a great deal of explanatory value can come from modeling yourself as a monad.

Later, if you decide you are "perfectly modeled as a monad," then the next layer of ontology comes into play, as you ask "if I am perfectly modeled as a monad, am I, in fact, a monad?"

Personally, I find I am too imperfect to fit into such a crystal clear mathematical construct, so I would not say I am a monad. Maybe, on a good day, you could model me as one.

Whether you are sufficiently perfect to be a monad is up to you.

4

A monad m is a construction to encapsulate computation. You can think of a monad as a box with a function in it. Binding monad a to monad b is putting box B in box A. That way, you ensure function A is executed before function B: B cannot be executed before because it needs the result of A. This way it's possible to control evaluation order in a lazy programming language1.

In the case of the IO Monad the purpose is indeed to interconnect the program itself (which is purely functional) with the outside world (which is impure). This is not the same as connecting software and hardware. The program still runs on hardware (the processor). However, with the IO Monad a pure function may have side effects (for example, writing to a file). Monads itself are just constructions and may be used for anything, even simple arithmetic. So, the comparison with a human can only be made with the IO Monad.

What is important that with the IO Monad you somehow detach side effects from a pure function so that it remains pure. Does that look like a human? Well...

It depends.

If you think

  1. there is a clear distinction between mind and body
  2. the mind is purely mathematical
  3. a human is defined as that which allows the mind to remain purely mathematical while connecting to a body

then yes, you are kind of like the IO Monad. But, there are valid reasons for not agreeing with any of the three points above:

  1. Arguments against dualism
  2. What about emotions?
  3. Surely a human is more than this? Does a human not also exist of his mind and body themselves?

A better analogy

If I were to simulate humans in a functional programming language (and indeed I did this, simulating a soccer team in Clean some months ago), I would consider a human to be a function which takes a world and yields a new world: a human has senses with which he observes the world, processes them, and somehow changes the world by acting. Thus, we could write the type of a human as Human :: World -> World.

Now, it's important that we cannot write a function which applies the actions of two humans like

two_humans :: Human Human World -> (World, World)
two_humans h1 h2 world = (h1 world, h2 world)

After applying this function we have two worlds, which can never be the case. The pure and lazy functional programming language Clean uses uniqueness typing to avoid this problem. What you do is you say that World is unique, so that only one function can use it a time. That way, only one World will ever exist in the program.

Footnotes

1: What is controlling evaluation order?

In a lazy programming language, functions are executed when the result is needed, rather than when the processor reaches the point the function is written. Suppose there were a simple function output :: String -> Void which outputs the input string to the screen and yields nothing, one could write a function print:

print = (output "Hello ", output "world!")

When executed, this may show both Hello world! and world!Hello, because the order in which the functions are executed is undefined.

A monadic output function could look like output :: String -> (*World -> (Void, *World)). Here, *World is the unique outside world. output takes a string and yields a function from *World to nothing and a new *World: the function changes the world. The print function would be written as

print = output "world!" (snd (output "Hello " world))

Here, snd yields the second element of a tuple. Because the leftmost output needs the *World that is yielded by the rightmost output, it cannot be executed before the rightmost output. Therefore, the program always outputs Hello world!.

Note, that this syntax is confusing (it's right to left) and a lot of typing. Haskell has the bind function (>>=) to easily bind two monads together.

1

A monad is a concept in category theory - a theory in mathematics; it's named as such because it's a simple concept - being derived from the notion of a monoid - the most (usefully) simplest possible algebraic device.

This has very little to do with humans or indeed the cosmos.

What connects it with Liebnizs notion of a monad is this notion of simplicity, and very little else - but this has a great deal to do with humans, the cosmos and God; his text - the monadology - is all about them.

There monads are all simple substances - they cannot be broken down any further; they make up the world or cosmos: human souls, atoms of matter and spacetime, and God.

They do not directly interact, but act through a harmony established by God.

This can be usefully compared to a cosmology that has come down to us from Antiquity, and possibly an inspiration for it: this is Lucretious theory of atoms. For thesis three in the Monadology states:

Something that has no parts can't be extended, can't have a shape, and can't be split up. So monads are the true atoms of nature - the elements out of which everything is made.

The most notable difference between them, is that the Lucretian godhead is beyond this world - changeless, and permanent; he names no relationship between them; and that the mind of humans are made up of very fine atoms; whereas Liebniz replaces mind with soul (he's a Christian philosopher); and this is a single atom - or monad, in his terminology.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.