Why do we need to do this - how can `Nothing` ever come back from `getNodeStats` since we're using `receiveWait`? Surely it's better to wait indefinitely and just return?

I suspect your line of thinking here is "what if we call this on a remote node and it takes forever or the remote dies?", am I right? That's a good question. Note that `sendCtrlMsg` *expects* that you pass `Nothing` for the local node, so I think it would be better to simply share the receive block and make the interaction explicit. That way, you can monitor if calling a remote node and deal with its death, whereas for a local node you'll never see `Nothing` so there's actually a point to doing this verification (whereas at the moment, it **can** never happen). I also think that the remote case should return `Either DiedReason NodeStats` instead of using `Maybe`, since we're not using a timeout here.

e.g.,

```haskell
getLocalNodeStats :: Process NodeStats
getLocalNodeStats = do
  stats <- getSelfNode >>= getNodeStatsAux
  case stats of
    -- How can we loose contact with the local nc? It's not possible,
    -- since local nc death will terminate this thread. Still, we need
    -- to keep the compiler happy....
    Left err  -> die "getLocalNodeStats: the impossible happened!"
    Right st -> return st

getNodeStats :: NodeId -> Process (Either DiedReason NodeStats)
getNodeStats nid = do
  nid' <- getSelfNode
  if nid == nid'
    then getLocalNodeStats >>= return . Right -- optimisation
    else getNodeStatsAux (Just nid)

getNodeStatsAux :: Maybe NodeId -> Process (Either DiedReason NodeStats)
getNodeStatsAux nid = do
  sendCtrlMsg nid $ GetNodeStats nid
  listenStats' nid
  where
    listenStats' Nothing = receiveWait [ matchStats ]
    listenStats' (Just nid') = do
      mRef <- bracket (monitorNode nid') unmonitor $ \_ -> do
        receiveWait [ matchStats
                            , matchIf (\(NodeMonitorNotification ref _ _) -> ref == mRef)
                                           (\(NodeMonitorNotification _ _ dr) -> return $ Left dr)

    matchStats = match (\(stats :: NodeStats) -> return $ Right stats)
```