On 05/30/2011 10:33 PM, Carter Schonwald wrote:
this is actually a bug in the type of cmap, a fix is due in the next
release (at least thats what Alberto indicated to me when I asked about
this a monthish ago) (note how you have the container type c e, but we
want c a and c b ). Instead  use the vector map or matrix map ops directly

cheers
-Carter schonwald

I have just uploaded to Hackage the bug-fixed version.

Thanks,
Alberto

On Mon, May 30, 2011 at 3:27 PM, Mats Klingberg <maklingb...@gmail.com
<mailto:maklingb...@gmail.com>> wrote:

    Hello,

    I'm playing around a bit with the hmatrix package
    (http://hackage.haskell.org/package/hmatrix) but can't quite figure
    out how to make the cmap function in Numeric.Container work.

    An example:

    ghci> import Numeric.LinearAlgebra
    ghci> let v = fromList [1.0,2.0,3.0]
    ghci> v
    fromList [1.0,2.0,3.0] :: Data.Vector.Storable.Vector
    ghci> :t v
    v :: Vector Double
    ghci> cmap sqrt v

    <interactive>:1:1:
        No instance for (Container Vector e0)
          arising from a use of `cmap'
        Possible fix: add an instance declaration for (Container Vector e0)
        In the expression: cmap sqrt v
        In an equation for `it': it = cmap sqrt v

    ghci> :t cmap
    cmap
      :: (Container c e, Element b, Element a) => (a -> b) -> c a -> c b

    There is an instance for (Container Vector Double) but I assume that
    since the signature of cmap doesn't mention the type variable 'e'
    GHCi can't infer it. Googling hasn't helped me so far, except for
    digging up another post to this list with the same (?) problem, but
    no answer:
    http://www.haskell.org/pipermail/haskell-cafe/2011-April/091390.html

    Is there a way to tell GHC what instance to use, or how should cmap
    be used?

    Thanks!
    Mats



    _______________________________________________
    Haskell-Cafe mailing list
    Haskell-Cafe@haskell.org <mailto:Haskell-Cafe@haskell.org>
    http://www.haskell.org/mailman/listinfo/haskell-cafe




_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to