[Haskell-cafe] Typeable state map

Vladimir Matveev dpx.infinity at gmail.com
Wed Nov 10 08:10:33 EST 2010


Hi,
I want to use something like (Control.Monad.StateT (Data.Map.Map
String Dynamic) m). So I wrote VarStateT datatype and corresponding
classes (Control/Monad/VarState.hs in [1]). Then I tried to use it in
my program (Math/Eigenvalues.hs in [1]). But compiler refused to
compile it with many type errors. I thought that it would be
sufficient to use ScopedTypeVariables and write all type annotations.
It helped slightly, many messages were gone, but now compiler throws
an error I don't know how to solve.

ghc --make  -o out/eigenvalues -outputdir build Main.hs
[3 of 4] Compiling Math.Eigenvalues ( Math/Eigenvalues.hs,
build/Math/Eigenvalues.o )

Math/Eigenvalues.hs:14:30:
    Could not deduce (MutableMatrix a e m)
      from the context (MutableMatrix a2 e2 m,
                        Typeable a2,
                        Typeable e2,
                        Floating e2,
                        Ord e2)
      arising from a use of `getPhi' at Math/Eigenvalues.hs:14:30-35
    Possible fix:
      add (MutableMatrix a e m) to the context of
        the type signature for `compute'
    In the second argument of `(>>)', namely `getPhi'
    In the first argument of `(>>)', namely `maxElem a >> getPhi'
    In the first argument of `(>>)', namely
        `maxElem a >> getPhi >> buildB'

Math/Eigenvalues.hs:14:40:
    Could not deduce (MutableMatrix a1 e1 m)
      from the context (MutableMatrix a2 e2 m,
                        Typeable a2,
                        Typeable e2,
                        Floating e2,
                        Ord e2)
      arising from a use of `buildB' at Math/Eigenvalues.hs:14:40-45
    Possible fix:
      add (MutableMatrix a1 e1 m) to the context of
        the type signature for `compute'
    In the second argument of `(>>)', namely `buildB'
    In the first argument of `(>>)', namely
        `maxElem a >> getPhi >> buildB'
    In the first argument of `(>>=)', namely
        `maxElem a >> getPhi >> buildB >> buildA'

How to sort this out?

[1] http://dl.dropbox.com/u/1415321/prog/eigenvalues.tar.gz


More information about the Haskell-Cafe mailing list