-- | Exception-safe pin management.
--
-- 'withPin' opens a pin using 'openPin' and passes the handle to the
-- given GPIO computation. Upon completion of the computation, or an
-- exception occuring within the computation, 'withPin' closes the
-- handle using 'closePin' and then propagates the result, either by
-- returning the value of the computation or by re-raising the
-- exception.
withPin :: (MaskGpioM h m) => Pin -> (h -> m a) -> m a
withPin p = bracket (openPin p) closePin
withPin :: (MaskGpioM h m) => Pin -> (h -> m a) -> m a
withPin p = bracket (openPin p) closePin
withPin p = bracket (openPin p) closePin