[Haskell] Help in understanding a type error involving forall and class constraints

MR K P SCHUPKE k.schupke at imperial.ac.uk
Wed Jun 30 03:35:06 EDT 2004


> 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  -c Diff.hs -i../.. -syslib net +RTS -K100000000

Diff.hs:
    Warning: Module `Data.Array.MArray' is imported, but nothing from it is used
             (except perhaps instances visible in `Data.Array.MArray')

Diff.hs:159:13: Warning: Defined but not used: br

...??...

Of course the obvious way to have somewhere to put the class is
to turn the let into a function:

for example like:

distString :: String -> String -> Int
distString s0 s1 = f (runST (difST s0 s1))

f :: IArray a Int => a (Int,Int) Int -> Int
f a = a!(1,1)

... or a non polymorphic version:

f :: UArray (Int,Int) Int -> Int
f a = a!(1,1)

	Keean.


More information about the Haskell mailing list