Can I get typeclass instance derivations (most notably Ord) from the DAML LF API Type Signature package?

I’m using the the DAML LF API Type Signature package and now I more or less understand how to extract type signatures.

I’m using the extracted info for Daml codegen, and I need to know somehow if I need to include a type class constraint.

In this case e.g. I have extracted from the DALF that the data type has a certain number of fields, but had to add the Ord constraints manually. I’d like to avoid this manuality and I’m wondering if I can get this info from the DALF as well.

instance (HasMigrate type_param0_old type_param0_new, HasMigrate type_param1_old type_param1_new, Ord type_param0_old, Ord type_param0_new, Ord type_param1_old, Ord type_param1_new) => HasMigrate (OldModels.Product.Product.SetOfPairs type_param0_old type_param1_old) (NewModels.Product.Product.SetOfPairs type_param0_new type_param1_new ) where
  migrate (OldModels.Product.Product.SetOfPairs field0 field1 field2 field3) = NewModels.Product.Product.SetOfPairs (migrate field0) (migrate field1) (migrate field2) (migrate field3)

Maybe @stefanobaghino-da or @Stephen can tell me the answer, or any of you who is using this library regularly.

Daml-LF doesn’t have a concept of typeclasses. You’ll see values of record types somewhere but I wouldn’t recommend trying to scrape them. That’s super brittle and easy to get wrong.

2 Likes

Ok, thanks, than I will keep track of data types which need Ord (Set a, Ma a) or just fix this manually.