
--- Hal Daume III
You need -fglasgow-exts to get the type signatures. you can get around it with:
instance MArray IOUArray Foo IO where unsafeRead arr = do arr2 <- myCast ... where myCast :: IOUArray i Foo -> IO (IOUArray i Int) myCast = unsafeCastIOUArray
There is only a small problem: there is no such function as unsafeRead or unsaferead, at at least not in GHC (I saw unsafeThaw, but that also didn't work).
oh come on, do you really believe that?
Prelude Data.Array.MArray> :info MArray -- MArray is a class class (HasBounds a, Monad m) => MArray a :: (* -> * -> *) e m :: (*
-> *) where { newArray :: forall i. (Ix i) => (i, i) -> e -> m (a i e) {- has default method -}; newArray_ :: forall i. (Ix i) => (i, i) -> m (a i e) {- has default method -}; Data.Array.Base.unsafeRead :: forall i. (Ix i) => a i e -> Int -> m e; Data.Array.Base.unsafeWrite :: forall i. (Ix i) => a i e -> Int -> e -> m (); }
perhaps importing Data.Arary.Base might help :)
- hal
It's true when you type that in, it seems there is such a function, but I can't find it anywhere in the documentation (or is there some reason for this). It probably has to do with the forall keyword, that I just looked up in the GHC usermanual. What I think the forall keyword essentially does is defining within a dataconstructor what types of values there can be in certain places, dependant of each other (so it's like a kind of multi-container), but that doesn't explain why unsafeRead is nowhere to be found in the documentation and unsafeRead is a function. P.S. I think you meant Data.Base.Array(minor detail). Greets Ron __________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo. http://search.yahoo.com