Jason Segel, who stars in the CBS sitcom How I Met Your Mother is set to both write and star in the upcoming Universal comedy sitcom Forgetting Sarah Marshall, says Variety.

"The comedy is an amalgam of some of the bad relationships and breakups I've had in my life," Segel said. "It takes place in Hawaii, and it is hell in paradise."

Judd Apatow is producing the show, which was sold as a pitch by Segel. Apatow has cast Segel in Universal Pictures' upcoming comedy Knocked Up. Segel will immediately write the new project, then film Knocked Up this summer before returning to How I Met Your Mother in August.