It seems there is no Foldable instance for Set. It would be useful to have an instance. Also Haskell does have a Foldable instance for its set type. Or is there some technical reason that it can’t have an instance?
I don’t think there’s a technical reason. You can very easily add your own instance:
import DA.Set as S import DA.Foldable as F instance Foldable Set where foldr fn b xs = F.foldr fn b (S.toList xs)
Thanks for the suggestion! We just added this Add a Foldable instance for Set by cocreature · Pull Request #9860 · digital-asset/daml · GitHub and it will be included in tomorrow’s snapshot and the 1.14 release.
Thanks guys. Not hard to add my own but then it would be an orphan instance (at least in the Haskell world, I guess DAML has the same notion of orphan instances).