[polyml] Type inference issue with phantom types