Then we get the problem when we use difST in distString.
I no such problem.
The Glorious Glasgow Haskell Compilation System, version 6.3
ghc -H32m -Wall -O2 -fvia-C -optc-O2 -optc-march=pentium3 -optc-mfpmath=sse
-fexcess-precision -fliberate-case-threshold100 -funbox-strict-fields -threaded
On Wed, 2004-06-30 at 12:00, MR K P SCHUPKE wrote:
Ahh.. I see whats happening:
MArray (STUArray s) a (ST s) = String - String - ST s (UArray (Int,Int) a)
IArray UArray a = String - String - a
nothing here is specifying a... you cannot leave a polymorphic in this case.
You need to
Here's a small bit of code that involves some fairly hairy class
overloadings (ghc's mutable unboxed array classes)
The code builds an array in the ST monad by creating a mutable array
then assigning to each element and finally freezing the array and
returning an immutable array.
Firstly the bit
Erm, something I remember about needing MArrays... Here's something
which does the same thing (cooks and MArray then freezes it - also using
STUArray... The neat thing is MArray is a class, so you can swap between
STUArray and STArray implementations without changing code.
This is the classic
On Tue, 2004-06-29 at 18:42, MR K P SCHUPKE wrote:
Erm, something I remember about needing MArrays... Here's something
which does the same thing (cooks and MArray then freezes it - also using
STUArray... The neat thing is MArray is a class, so you can swap between
STUArray and STArray
Try this:
distString :: String - String - Int
distString s0 s1 = let a = runST (difST s0 s1)
in a!(1,1)
difST :: MArray (STUArray s) Int (ST s) = String - String - ST s (UArray (Int,Int)
Int)
difST s0 s1 = do
b@(_,br) - return $ (\x1 y1 - ((0,0),(x1,y1))) (length s0) (length s1)
d -