[GHC] #14042: Datatypes cannot use a type family in their return kind

GHC ghc-devs at haskell.org
Tue Aug 1 09:31:16 UTC 2017


#14042: Datatypes cannot use a type family in their return kind
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  8.0.1
  checker)                           |             Keywords:  TypeInType,
      Resolution:                    |  TypeFamilies
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 I'm not sure either.  But we do have worker/wrapper for ordinary data
 cons, so there is room to inject some coercions.  Eg
 {{{
 data T = MkT {-# UNPACK #-} !Int
 }}}
 We get a worker and a wrapper.
 {{{
 MkT :: Int# -> T   -- Worker
       -- No code; this is the real data constructor in Core

 $WMkT :: Int -> T  -- Wrapper
 $WMkT x = case x of I# y -> MkT y
 }}}
 Occurrences of `MkT` in terms are replaced by `$WMkT`.  In patterns we
 need some impedence matching.

 Can someone produce an example with some actual data constructors?  I'm a
 bit lost as to the actual goal.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14042#comment:14>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list