Skip to content

Ability to specify a different type name when generating #50

Description

@Boscop

It would be useful to be able to specify a different type name when generating.
E.g. I have this:

use models::user::UserRole;
use views::user::UserView;
use views::truck::{RoutePointView, CargoView, TruckView as TruckViewWithRoute};
use views::journal_sales::View as JournalSaleView;
use views::client::ClientView;
use models::views::vats::View as VatView;
use models::views::tares::View as TareView;
use models::views::product_groups::View as ProductGroupView;
use models::views::operators::View as OperatorView;
use models::views::products::View as ProductView;
use models::views::containers::View as ContainerView;
use models::views::contained_products::View as ContainedProductView;
use models::views::trucks::View as TruckView;
use models::views::places::View as PlaceView;

let module = purs_module!("Waterslide".to_string();
	UserRole, UserView, TruckViewWithRoute, Location, RoutePointView, CargoView, Movement, MovingData,
	ContainedProductViewWithName, LoadingUnit, RoutePointPlan,
	VatView, TareView, ProductGroupView, OperatorView, ProductView, ContainerView, ContainedProductView, TruckView, PlaceView,
	ClientView,
);
let mut out = File::create("Waterslide.purs").unwrap();
write!(out, "{}", module).unwrap();

The problem is, all the renamed imports of types named View are not reflected in the generated code.
I want to be able to specify that they should be generated with a given name.
I can't rename the type definitions to be more heterogenic because they are all generated by macros, so the name for the generated type would have to be specified in the macro invokation, like:

purs_module!("Waterslide".to_string(); PlaceView as "PlaceView", ..);

It would be quite useful if the macro could accept this syntax.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions