Types and Effects for Resource Usage Analysis