getRemovalActions :: IPin -> PinMode -> Arduino [Request]
getRemovalActions p INPUT  = do -- This pin is no longer digital input
        bs <- gets boardState
        liftIO $ modifyMVar bs $ \bst -> do
                let dPins = p `S.delete` digitalReportingPins bst
                    port  = pinPort p
                    acts  = [DigitalReport port False | port `notElem` map pinPort (S.elems dPins)]   -- no need for a digital report on this port anymore
                    bst'  = bst { digitalReportingPins = dPins }
                return (bst', acts)
getRemovalActions :: IPin -> PinMode -> Arduino [Request]
getRemovalActions p INPUT  = do -- This pin is no longer digital input
        bs <- gets boardState
        liftIO $ modifyMVar bs $ \bst -> do
                let dPins = p `S.delete` digitalReportingPins bst
                    port  = pinPort p
                    acts  = [DigitalReport port False | port `notElem` map pinPort (S.elems dPins)]   -- no need for a digital report on this port anymore
                    bst'  = bst { digitalReportingPins = dPins }
                return (bst', acts)
getRemovalActions p INPUT  = do -- This pin is no longer digital input
        bs <- gets boardState
        liftIO $ modifyMVar bs $ \bst -> do
                let dPins = p `S.delete` digitalReportingPins bst
                    port  = pinPort p
                    acts  = [DigitalReport port False | port `notElem` map pinPort (S.elems dPins)]   -- no need for a digital report on this port anymore
                    bst'  = bst { digitalReportingPins = dPins }
                return (bst', acts)