This does not appear to implement a monadic computation. A monadic computation can examine intermediate steps of the computation and perform flow control decisions, i.e. in Haskell:
showFlowControl :: Person -> Maybe County
showFlowControl p = do
country <- personCountry p
case country of
USA -> do
state <- state country
county state
SomethingElse -> do
province <- province country
provCounty province
_ -> Nothing
(The implied data structure is a bit bizarre, but, bear with me.)
Unless I am misreading the code, this is the rather frequent misunderstanding that monads are just fancy chained method calls, which does not suffice to capture the monadic behavior. Note merely trying to stuff "if" statements into the calls won't be sufficient, because you must actually affect the chain that is called; either you call "state" or you call "providence" but you must decide that "in" the monadic computation, not in a mere method chaining.
Mere method chaining is not monadic. There is, I believe, no clever way to implement monadic computations in Javascript without nested functions; every layer of the monadic computation nests, and in most languages this can not be hidden in any practical way. This is one of the major reasons monadic computations are impractical in most languages.
I think bind is essentially correct too, but the failure to use it properly tends to suggest a level of understanding too small to be writing Yet Another Monad Tutorial. I've seen real JS monads, and I believe they are irretrievably ugly to use, with the need for nested functions.
Helpful aside: "Province", not "providence". The former is an administrative division of a larger polity; the latter is the grace of God, which could lead to some confusion when mentioned in this context.
Oops. No idea where that came from; I know better. Perhaps the backwards state of SomethingElse believes not only in the divine right of Kings, but the divine right of Dukes and perhaps even other nobility as well...
Well, if you assume both a peerage and a divine-right monarchy, then the divine right of peers seems more or less implicit, since they're created as such by the Crown, and a monarch anointed and guided by God would not fail to recognize who among her subjects is worthy of elevation. Subordination doesn't seem hard to handle in such a system; a duke's word, for example, would be God-given law save where it happened to conflict with the dictates of the Queen, an earl's likewise in relation to a duke, and on down the line, and presumably such conflicts could be handled by any noble of higher rank than the one found to be in conflict -- an earl, for example, might censure an unruly baron.
…come to think about it, given a few global string replacements, haven't we just more or less reinvented both the British peerage and the Roman Catholic Church?
Unless I am misreading the code, this is the rather frequent misunderstanding that monads are just fancy chained method calls, which does not suffice to capture the monadic behavior. Note merely trying to stuff "if" statements into the calls won't be sufficient, because you must actually affect the chain that is called; either you call "state" or you call "providence" but you must decide that "in" the monadic computation, not in a mere method chaining.
Mere method chaining is not monadic. There is, I believe, no clever way to implement monadic computations in Javascript without nested functions; every layer of the monadic computation nests, and in most languages this can not be hidden in any practical way. This is one of the major reasons monadic computations are impractical in most languages.