|Version 1 (modified by goldfire, 17 months ago) (diff)|
Update to Roles
It has become (somewhat) clear that the Roles mechanism as implemented in GHC 7.8 is insufficient. (See examples below.) This page is dedicated to creating a new design for roles that might fix the problems.
We have three known examples of where current roles are failing us.
Adding join to Monad
As part of the Applicative-Monad Proposal, we wish to add join to Monad, thus:
class Applicative m => Monad m where ... join :: forall a. m (m a) -> m a
This is all well and good, and would work with GeneralizedNewtypeDeriving (GND) most of the time. But, consider this:
newtype T m a = T (m a) deriving (Functor, Applicative, Monad)