Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a easier way to express appended Record types? #171

Open
billksun opened this issue Apr 28, 2023 · 0 comments
Open

Is there a easier way to express appended Record types? #171

billksun opened this issue Apr 28, 2023 · 0 comments

Comments

@billksun
Copy link

I am trying to append 2 Records together using rappend, where the 2 Records have the following type:

type MetaData = Record '[ MetaCol1, MetaCol2]
type SomeData = Record '[Col1, Col2]

I then have a function that prepends the columns from MetaData to SomeData:

AddMeta :: SomeData -> Record `[MetaCol1, MetaCol2, Col1, Col2]
AddMeta someData = metaCol1 &: metaCol2 &: RNil <+> someData 

My question is, is there a way to simplify AddMeta's type signature so I don't have to type out all the columns explicitly? This sample case only has 4 columns total, but this can quickly get unwieldy if I am trying to append 2 frames with large amounts of columns together.

I have seen the usage of ++ in the type signatures, and have tried to use AddMeta :: SomeData -> MetaData ++ SomeData but this results in the following compile error:

Expected kind ‘[k0]’, but ‘HpcUsage’ has kind ‘Type’
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant