withThriftHandle :: (Channels -> Types.Pathname -> IO Types.ThriftHandle) -> CloseChannelAction -> Channels -> Types.Pathname -> (Types.ThriftHandle -> IO result) -> IO result
withThriftHandle allocationMethod closeAction channels hdfsPath action = do
  thriftHandle <- allocationMethod channels hdfsPath
  res <- action thriftHandle
  _ <- closeAction channels thriftHandle
  return res
withThriftHandle :: (Channels -> Types.Pathname -> IO Types.ThriftHandle) -> CloseChannelAction -> Channels -> Types.Pathname -> (Types.ThriftHandle -> IO result) -> IO result
withThriftHandle allocationMethod closeAction channels hdfsPath action = do
  thriftHandle <- allocationMethod channels hdfsPath
  res <- action thriftHandle
  _ <- closeAction channels thriftHandle
  return res
withThriftHandle allocationMethod closeAction channels hdfsPath action = do
  thriftHandle <- allocationMethod channels hdfsPath
  res <- action thriftHandle
  _ <- closeAction channels thriftHandle
  return res