Frames icon indicating copy to clipboard operation
Frames copied to clipboard

Is there a easier way to express appended Record types?

Open billksun opened this issue 2 years ago • 0 comments

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’

billksun avatar Apr 28 '23 17:04 billksun