[GHC] #10748: Associated type families regression

#10748: Associated type families regression -------------------------------------+------------------------------------- Reporter: slyfox | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Revisions: | -------------------------------------+------------------------------------- The original code snippet is taken from synthesizer-core-0.7.1 from hackage: http://code.haskell.org/synthesizer/core/src/Synthesizer/Causal/Class.hs Here is the minimal example: {{{#!hs {-# LANGUAGE TypeFamilies #-} module M where class ProcessOf (SignalOf process) ~ process => C process where type SignalOf process :: * -> * type ProcessOf (signal :: * -> *) :: * -> * -> * }}} {{{ $ ghc -c M.hs M.hs:4:1: The associated type ‘ProcessOf’ mentions none of the type or kind variables of the class ‘C process’ In the class declaration for ‘C’ }}} ghc-7.8.4 was able to compile this. Is it a known new restriction of ghc or a regression? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10748 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10748: Associated type families regression -------------------------------------+------------------------------------- Reporter: slyfox | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: invalid | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by rwbarton): * status: new => closed * resolution: => invalid Comment: It is an intentional change. See #10300 for another example. `ProcessOf` has no direct relation to `C`, so it should be declared as a standalone type family, outside the class. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10748#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10748: Associated type families regression -------------------------------------+------------------------------------- Reporter: slyfox | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: invalid | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by slyfox): Aha, I see. Ported as: {{{#!diff diff --git a/src/Synthesizer/Causal/Class.hs b/src/Synthesizer/Causal/Class.hs index 358dd85..89c9c71 100644 --- a/src/Synthesizer/Causal/Class.hs +++ b/src/Synthesizer/Causal/Class.hs @@ -12,7 +12,8 @@ import Control.Arrow (Arrow, arr, (<<<), (&&&), ) +type family ProcessOf (signal :: * -> *) :: * -> * -> * + class (Arrow process, ProcessOf (SignalOf process) ~ process) => C process where type SignalOf process :: * -> * - type ProcessOf (signal :: * -> *) :: * -> * -> * toSignal :: process () a -> SignalOf process a fromSignal :: SignalOf process b -> process a b diff --git a/src/Synthesizer/Causal/Process.hs b/src/Synthesizer/Causal/Process.hs index e64afcd..33027ef 100644 --- a/src/Synthesizer/Causal/Process.hs +++ b/src/Synthesizer/Causal/Process.hs @@ -175,8 +175,8 @@ instance ArrowLoop T where loop = liftKleisli loop +type instance Class.ProcessOf Sig.T = T instance Class.C T where type SignalOf T = Sig.T - type ProcessOf Sig.T = T toSignal = flip applyConst () fromSignal sig = const () ^>> feed sig }}} Thank you! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10748#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC