Re: #16410: Order of declarations matters
"GHC" <[email protected]> Fri, 08 Mar 2019 23:53:43 -0000
| Newsgroups | gmane.comp.lang.haskell.glasgow.bugs |
|---|---|
| Message-ID | <[email protected]> |
--===============4279239084236908353==
Content-Type: multipart/related;
boundary="===============8216872247179355350=="
--===============8216872247179355350==
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
#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>