[Haskell-cafe] Associated types

Andrew Coppin andrewcoppin at btinternet.com
Thu Jul 1 14:09:36 EDT 2010

Consider the following:

  class Path p where ...

  class Path p => CompletePath p where ...

  class Path p => IncompletePath p where
    type CompletedPath p :: *

Obviously, the idea is that CompletedPath Foo (where Foo is an 
IncompletePath) should yield some type which is a CompletePath. However, 
the source code does not actually state this, so GHC (rightly) complains 
that it was unable to deduce this constraint from the actual code written.

Is it possible to state this constraint? If so, how? (And if not, the 
answer, presumably, is to fundamentally redesign the whole thing...)

More information about the Haskell-Cafe mailing list