Encode-decode for directed higher inductive types