12345678910111213141516171819202122232425letcore_typet=letloc=t.Parsetree.ptyp_locinmatchtwith|[%type:[%t?itype]->[%t?otype]]->(matchMadcast.deriveitypeotypewith|[cast]->cast|[]->Ppx_deriving.(raise_errorf~loc"No cast found for %s -> %s"(string_of_core_typeitype)(string_of_core_typeotype))|_->Ppx_deriving.(raise_errorf~loc"Several casts found for %s -> %s"(string_of_core_typeitype)(string_of_core_typeotype)))|_->Ppx_deriving.(raise_errorf~loc"Expected an arrow type, got %s"(string_of_core_typet))let()=Ppx_deriving.(register(create"madcast"~core_type()))