[GHC] #9112: data families with representational matching
GHC
ghc-devs at haskell.org
Thu May 15 23:34:30 UTC 2014
#9112: data families with representational matching
-------------------------------------+------------------------------------
Reporter: jwlato | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.8.2
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture: Unknown/Multiple
Type of failure: None/Unknown | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets:
-------------------------------------+------------------------------------
Comment (by jwlato):
Simon, it's possible that suggestion will work, with a few other
modifications to the way roles are currently handled. It doesn't work
with vector/ghc as currently released due to some other methods. For
example, if I add `basicUnsafeRead`
{{{
class MVectorClass (v :: * -> * -> *) a where
basicLength :: v s a -> Int
basicUnsafeRead :: PrimMonad m => v (PrimState m) a -> Int -> m a
}}}
It's not possible to coerce `basicUnsafeRead` because of the coercion from
`m Int` to `m Age`. There are a number of other methods that also can't
be coerced, but I think they're all because `m`s type parameter is at a
nominal role. If it were possible to express that `m`s parameter need
only be representationally equal, I think this would work. (maybe related
to the current issues with deriving and AMP?)
I'm not sure what's involved with making that coercion happen, but it
seems decidely less tricky than representationally-equal data families (I
have quite a bit more to say about that also, but I'll leave it for
another venue). I'm changing the title of this ticket to more closely
reflect the actual goal, e.g. deriving vector instances.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9112#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list