Hi Pablo,

On Mon, Jul 7, 2008 at 10:07 AM, Pablo Nogueira
<[EMAIL PROTECTED]> wrote:
> GHCi infers it has type (up to renaming):
>
> (From a1 (s (a1 x)) x,  Bifunctor s,  To  a2 (s (a2 y)) y) => (x -> y)
> -> a1 x -> a2 y
>
> But if I cut and paste the type into the code I get type errors:
>
>   Could not deduce (From a1 (s1 (a11 x)) x) ...
>    Could not deduce (From a11 (s1 (a11 x)) x, To a21 (s1 (a21 y)) y) ...
>    Could not deduce (From a1 (s1 (a11 x)) x) ...

I myselft  don't understand why GHCi doesn't accept the type it
infered as an explicit signature ... but your problem seems to be
caused by a lack of functional dependencies.

Redefining To and From as ..

class From a c x | a -> c where
    from :: a x -> c x

class To a c y | c -> a where
    to :: c y -> a y

... hushes GHCi. The question now is, of course, if the new
dependencies are too restrictive for your problem.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to