
Forgot to mention that no error arises if I explicitly give the type
signature of fstSY
fstSY :: Signal (a,b) -> Signal a
On 1/29/07, Alfonso Acosta
Hi all,
Sorry if this is too GHC-specific. I'm getting this strange instantiation error when compiling the following code with GHC 6.6:
No instance for (Synchronous s ((a, b) -> a) (a, b) a) arising from use of `mapSY' at SynchronousLib.lhs:342:8-16 Possible fix: add an instance declaration for (Synchronous s ((a, b) -> a) (a, b) a) In the expression: mapSY fst In the definition of `fstSY': fstSY = mapSY fst
--- data Signal a = NullS | a :- Signal a deriving (Eq)
class Synchronous s f1 a b | f1 -> a , f1 -> b where mapSY :: f1 -> s a -> s b delaySY :: a -> s a -> s a
instance Synchronous Signal (a->b) a b where mapSY _ NullS = NullS mapSY f (x:-xs) = f x :- (mapSY f xs) delaySY e es = e:-es
fstSY = mapSY fst
{-- No instance for (Synchronous s ((a, b) -> a) (a, b) a) arising from use of `mapSY' at SynchronousLib.lhs:342:8-16 Possible fix: add an instance declaration for (Synchronous s ((a, b) -> a) (a, b) a) In the expression: mapSY fst In the definition of `fstSY': fstSY = mapSY fst Failed, modules loaded: AbsentExt, Vector, Queue, Signal. --} --
No error arises if fstSY is declared as
fstSY a = mapSY fst a
Is it GHC bug or am I supposed to declare it like that to assist type inference?
Thanks in advance,
Alfonso Acosta