
#10592: Allow cycles in class declarations -------------------------------------+------------------------------------- Reporter: MikeIzbicki | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 7.10.1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by bgamari: Old description:
In particular, I would like to have a class hierarchy that looks like:
{{{ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE FlexibleContexts #-}
type family Scalar x
class Field (Scalar x) => Vector x
class Vector x => Field x }}}
It is the case that every field is a vector, and the scalar associated with every vector is a field. But we can't currently enforce that.
New description: In particular, I would like to have a class hierarchy that looks like: {{{#!hs {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE FlexibleContexts #-} type family Scalar x class Field (Scalar x) => Vector x class Vector x => Field x }}} It is the case that every field is a vector, and the scalar associated with every vector is a field. But we can't currently enforce that. -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10592#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler