But what stops the user from defining their own instances if they in fact did not derive it?The explicit "False" in Pedro's formulation seems to serve this purpose.On Mon, Oct 14, 2013 at 11:20 PM, Nicolas Frisby <nicolas.frisby@gmail.com> wrote:
The formulation as a type family seems to conflict with the open-world principle. Would a class-based encoding instead be sufficient?-- the proposed, special wired-in class
class Derives (t :: k1) (c :: k2)-- GHC would infer these from Pedro's example's declarationsinstance Derives MyData Eqinstance Derives MyData Genericinstance Derives MyData Show
NB that there is no instance Derives MyData Ord, but standalone deriving could yield one "later"
On Mon, Oct 14, 2013 at 10:02 PM, Ryan Newton <rrnewton@gmail.com> wrote:Hey, that's an awesome formulation! Thanks Pedro.Any idea how much work this would be to implement in GHC, if it did garner approval?On Tue, Oct 8, 2013 at 3:48 AM, José Pedro Magalhães <dreixel@gmail.com> wrote:
Hi,Would this be something Ryan could use for detecting safe instances for LVish?On Mon, Oct 7, 2013 at 10:32 AM, Dag Odenhall <dag.odenhall@gmail.com> wrote:
Here‘s a thought: doesn’t
Generic
already have an unused phantom type that's only there “just in case we need to add something in the future”?No, it doesn't.Just a thought: what if we had a type familytype family Derives (t :: k1) (c :: k2) :: Bool
which would automatically be instantiated by GHC appropriately? E.g., if the user had the following code:data MyData = MyData deriving (Eq, Generic)
deriving instance Show MyDatainstance Ord MyDataGHC would automatically instantiate:
type instance Derives MyData Eq = True
type instance Derives MyData Generic = True
type instance Derives MyData Show = True
type instance Derives MyData Ord = False
Cheers,
Pedro_______________________________________________
ghc-devs mailing list
ghc-devs@haskell.org
http://www.haskell.org/mailman/listinfo/ghc-devs
_______________________________________________
ghc-devs mailing list
ghc-devs@haskell.org
http://www.haskell.org/mailman/listinfo/ghc-devs
_______________________________________________
ghc-devs mailing list
ghc-devs@haskell.org
http://www.haskell.org/mailman/listinfo/ghc-devs