Compose effects in scala