On Thu, Jul 1, 2010 at 2:09 PM, Andrew Coppin
<andrewcop...@btinternet.com> wrote:
> 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...)

Something like this should work:

class (Path p, CompletePath (CompletedPath p)) => IncompletePath p where
    type CompletedPath p :: *

-- 
Dave Menendez <d...@zednenem.com>
<http://www.eyrie.org/~zednenem/>
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to