Constructing a n-ary product with all the values of a simple sum type
问题 I'm working with the generics-sop library. I want to write a value with the following type: values :: forall r. IsEnumType r => NP (K r) (Code r) That is, for sum types whose constructors don't have any arguments (IsEnumType) I want to produce an n-ary product (NP) which contains the corresponding constructor value at each point. For example, for the type {-# LANGUAGE DeriveGeneric #-} import qualified GHC.Generics as GHC import Generics.SOP data Foo = Bar | Baz deriving (GHC.Generic)