Well, I pared and whittled and cut away until I was left with
remarkably little code! In the code below, when I replace the `Matrix'
context in the `amap2' function with `IArray', the file compiles
without a warning. Perhaps I'm still too much the novice to see an
error on my part, but the code seems to be valid Haskell to me. I also
have ghc 4.08 installed on my Windows NT machine at work, and the
results were the same as on my Debian Gnu/Linux machine. This is my
code:

> module Matrix
> where
> 
> import IArray
> import Ix
> 
> class (IArray a e) => Matrix a e where
> 
>   amap2  :: (Ix ix, Matrix a d) =>
>             (e -> d -> e) -> a ix e -> a ix d -> a ix e


And this is the output of a compiler run:

> ~/projects/hs/mtx.2$ ghc -Wall -v -fglasgow-exts -c MatrixB.hs
> The Glorious Glasgow Haskell Compilation System, version 4.08
> 
> Effective command line: -Wall -v -fglasgow-exts -c
> 
> Ineffective C pre-processor:
>       echo '{-# LINE 1 "MatrixB.hs" -}' > /tmp/ghc743.cpp && cat MatrixB.hs >> 
>/tmp/ghc743.cpp
> 
> real  0m0.001s
> user  0m0.010s
> sys   0m0.000s
> ghc:compile:Output file MatrixB.o doesn't exist
> ghc:compile:Interface file MatrixB.hi doesn't exist
> ghc:recompile:Input file MatrixB.hs newer than MatrixB.o
> 
> Haskell compiler:
>       /usr/lib/ghc-4.08/hsc /tmp/ghc743.cpp  -fwarn-overlapping-patterns 
>-fwarn-missing-methods -fwarn-missing-fields -fwarn-deprecations 
>-fwarn-duplicate-exports -fwarn-unused-binds -fwarn-unused-matches 
>-fwarn-incomplete-patterns -fwarn-unused-imports -fwarn-type-defaults 
>-fwarn-name-shadowing -fwarn-missing-signatures -fglasgow-exts 
>-fignore-interface-pragmas -fomit-interface-pragmas -fsimplify [ 
>-fmax-simplifier-iterations4 ]   -fwarn-overlapping-patterns -fwarn-missing-methods 
>-fwarn-missing-fields -fwarn-deprecations -fwarn-duplicate-exports -fhi-version=408 
>-static 
>"-himap=.%.hi:/usr/lib/ghc-4.08/imports/lang%.hi:/usr/lib/ghc-4.08/imports/lang%.hi:/usr/lib/ghc-4.08/imports/std%.hi"
> "-himap-sep=:"    -v -hifile=/tmp/ghc743.hi -olang=asm -ofile=/tmp/ghc743.s 
>-F=/tmp/ghc743_stb.c -FH=/tmp/ghc743_stb.h +RTS -H6000000 -K1000000
> Glasgow Haskell Compiler, version 4.08, for Haskell 98, compiled by GHC version 4.08
> 
> AClass
> 
> real  0m7.321s
> user  0m3.840s
> sys   0m0.160s
> deleting... /tmp/ghc743.cpp /tmp/ghc743.hi /tmp/ghc743.s /tmp/ghc743_stb.c 
>/tmp/ghc743_stb.h

I hope this helps.
-- 
Martin Pokorny
mailto:[EMAIL PROTECTED]

Reply via email to