
#8672: :browse and roles on typefamilies -------------------------------------------------+------------------------- Reporter: monoidal | Owner: Type: bug | goldfire Priority: low | Status: new Component: Compiler (Type checker) | Milestone: Resolution: | Version: 7.7 Operating System: Unknown/Multiple | Keywords: Type of failure: Incorrect warning at | Architecture: compile-time | Unknown/Multiple Test Case: | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: -------------------------------------------------+------------------------- Changes (by simonpj): * owner: => goldfire Comment: The reason this is happening is because `SNil` is defined, so GHC is showing the appropriate `data instance`. Then it tries to show the roles of the data instance, and does so badly. Richard, two questions. First in this case, can't the data instance have a representational role inferred? Eg this ought to work. The definition of `g` is currently rejected. {{{ data family T a data instance T [b] = MkT b newtype Age = MkAge Int g :: T [Age] -> T [Int] g x = coerce x }}} Second question. Are role annotations allowed on data family declarations, where they could indicate which parameters are the indices: {{{ type role T representational nominal -- Only second param can be an index data family T a b data instance T a Bool = ... -- Allowed data instance T Bool b = ... -- Rejected }}} (And similarly for type families.) Similarly are role annotations allowed on data instance declarations, where they would be useful in exactly the same way that they are on data decls {{{ data family T a type role T [a] (a:nominal) data instance T [a] = MkT a }}} Here we are running out of syntax! This isn't supported now because I think all parameters are automatically nominal (see point 1 for why they shouldn't be). Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8672#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler