<br><br><div class="gmail_quote">On Wed, Jul 2, 2008 at 11:52 AM, Daniel Fischer <<a href="mailto:daniel.is.fischer@web.de">daniel.is.fischer@web.de</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>Perhaps<br>
<br>
class (Ix i) => UArrClass i e where ...<br>
<br>
would work?<br>
<div><div></div><div class="Wj3C7c"><br>
</div></div></blockquote></div><br>class Ix i => UArrClass i e where<br> data UArr i e<br> unsafeAt_ :: UArr i e -> Int -> e<br><br>instance <br> ( IArray UArray e <br> , IArray UArray f <br> , Ix i<br>
) => UArrClass i (e,f) <br> where<br> newtype UArr i (e,f) = UArrPair (UArray i e) (UArray i f)<br> unsafeAt_ (UArrPair ea fa) i = (unsafeAt ea i , unsafeAt fa i)<br><br>instance <br> ( IArray UArray e <br>
, IArray UArray f <br> , UArrClass i (e,f)<br> , Ix i<br> ) => IArray UArr (e,f) <br> where<br> unsafeAt = unsafeAt_ <br><br>test1 :: UArr Int (Int,Int) -> (Int,Int)<br>test1 a = unsafeAt a 5 --this is line 77<br>
<br>--------------------<br>Array.hs:77:10:<br> Ambiguous type variable `i' in the constraint:<br> `Ix i' arising from a use of `unsafeAt' at Array.hs:77:10-21<br> Probable fix: add a type signature that fixes these type variable(s)<br>
<br>I think the 'i' there is the one from the method context of IArray,<br><br>class IArray a e where<br> unsafeAt :: Ix i => a i e -> Int -> e<br><br>But that 'i' does not escape to the class context, so I have no way to address it. I think I need to leave it free, but I can't do that with my associated type.<br>
<br>Scott<br>