40 years is nothing. Back in the good old days Cristian hermits spent many decades by themselves.
Not in a small box they didn’t. I won’t even speculate on the mental state or moral state of these men after 40 years, however, human beings were not meant to be locked up with nothing to do, at all. I’d much prefer a penal colony where they worked and could repay something to society, instead of being forced to pay for them to do nothing (and many would prefer to die), at the tune of tens of thousands a year, to fill a police state quota.