Colin Paul Adams wrote:
I'm getting these errors (ghc 6.10.4 on Linux x86_64):

Building chp-plus-1.1.0...
[1 of 9] Compiling Control.Concurrent.CHP.Test ( 
Control/Concurrent/CHP/Test.hs, dist/build/Control/Concurrent/CHP/Test.o )
[2 of 9] Compiling Control.Concurrent.CHP.Console ( 
Control/Concurrent/CHP/Console.hs, dist/build/Control/Concurrent/CHP/Console.o )
[3 of 9] Compiling Control.Concurrent.CHP.Connect ( 
Control/Concurrent/CHP/Connect.hs, dist/build/Control/Concurrent/CHP/Connect.o )

Control/Concurrent/CHP/Connect.hs:146:67:
    Couldn't match expected type `ChanOpts a'
           against inferred type `ConnectableParam (Chanout a)'
    In the first argument of `oneToOneChannel'', namely `o'
    In the second argument of `(<$>)', namely `oneToOneChannel' o'
    In the first argument of `(>>=)', namely
        `((writer &&& reader) <$> oneToOneChannel' o)'
I don't immediately have a GHC 6.10.4 machine to hand, but that is an odd error. Here is the code in question:

instance ConnectableExtra (Chanout a) (Chanin a) where
 type ConnectableParam (Chanout a) = ChanOpts a
 connectExtra o = (>>=) ((writer &&& reader) <$> oneToOneChannel' o)

(based on the class:

class ConnectableExtra l r where
 type ConnectableParam l
 connectExtra :: ConnectableParam l -> ((l, r) -> CHP ()) -> CHP ()
)

So I don't see why there is a type mismatch; ConnectableParam (Chanout a) is ChanOpts a. I don't know if it's somehow confused by the recently added similar instance:

instance ConnectableExtra (Chanout a) (Shared Chanin a) where
 type ConnectableParam (Chanout a) = ChanOpts a
 connectExtra o = (>>=) ((writer &&& reader) <$> oneToAnyChannel' o)

There's no conflict between the two instances, though. I wonder if making ConnectableParam depend on "l" and "r" would fix it. I'll look further into this when I get onto a 6.10.4 machine.

Thanks,

Neil.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to