Implementing either and writer correctly