<div dir="ltr">Hi all,<br>I'd like to be able to constrain an associated type.<br><br>I used to have an instance that looked like:<br>class Dispatch a b c | a b -> c where<br>   runF :: a -> b -> c<br>instance (C a) => Dispatch D1 D2 ( a -> IO ()) where<br>   runF d1 d2 = (\_ -> return ())<br><br>Since I upgraded to 7.8 from 7.5 that instance declaration is no longer accepted is no longer accepted since it violates FD's.<br><br>I have been updating my code to use type families like so:<br>class Dispatch a b where<br>   type Impl a b :: *<br>   runF :: a -> b -> Impl a b<br>instance (C a) => Dispatch D1 D2 where<br>   type Impl D1 D2 = a -> IO ()<br>   runF d1 d2 = (\_ return ())<br><br>Unfortunately the `type Impl ...` line in the instance is rejected because it uses `a` on the RHS.<br><br>In this one case I could just package it up into a newtype or something but I would ideally like to be able to constrain any number of arguments like:<br>instance (C a, C b ... C z) => Dispatch D1 D2 where<br>   type Impl D1 D2 = a -> b -> ... -> z -> IO ()<br>   ...<br><br>This was something I could do in 7.6 (although I realize this is way safer). How do I go about getting that constraint back?<br><br>Thanks!<br>-deech<br></div>