[GHC] #16410: Order of declarations matters

GHC ghc-devs at haskell.org
Fri Mar 8 23:53:43 UTC 2019


#16410: Order of declarations matters
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:  (none)
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.7
      Resolution:  duplicate         |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #12088            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by RyanGlScott):

 * status:  new => closed
 * resolution:   => duplicate
 * related:   => #12088


Comment:

 Indeed, this is a duplicate of #12088. Note that the same workaround
 applies here: you can use a Template Haskell splice to force the
 dependency analysis to come to its senses. That is, the following
 typechecks (note the addition of the `$(pure [])` bit):

 {{{#!hs
 {-# Language DataKinds    #-}
 {-# Language GADTs        #-}
 {-# Language InstanceSigs #-}
 {-# Language PolyKinds    #-}
 {-# Language TypeFamilies #-}
 {-# LANGUAGE TemplateHaskell #-}

 import Data.Kind

 class Category (tag::Type) where
  type Strip tag :: Type

 class Category tag => Stripped tag where
  type Hom tag::Strip tag -> Strip tag -> Type

 instance Category () where
  type Strip () = ()
 instance Stripped () where
  type Hom () = Unit1

 data Unit1 :: () -> () -> Type where U1 :: Unit1 '() '()
 data Tag
 data Unit2 :: () -> () -> Type where U2 :: Unit2 '() '()

 instance Category Tag where
  type Strip Tag = ()

 $(pure [])

 instance Stripped Tag where
  type Hom Tag = Unit1
 }}}

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


More information about the ghc-tickets mailing list