haskell - Indexing images read with with repa-devil -


i'm trying examine rgb components of pixels in image, can't figure out how it.

import data.array.repa import data.array.repa.io.devil import data.word (word8)  main =   (rgb ps) <- runil $ readimage "test.jpeg"   let k = (z :. 142) :. 212 :. 0 :: dim3   print $ ps ! k 

the error is:

[1 of 1] compiling main             ( amy.hs, interpreted )  amy.hs:8:15:     couldn't match expected type `array r0 dim3 a0'                 actual type `repa-3.2.3.1:data.array.repa.base.array                                     repa-3.2.3.1:data.array.repa.repr.foreignptr.f                                     repa-3.2.3.1:data.array.repa.index.dim3                                     word8'     in first argument of `(!)', namely `ps'     in second argument of `($)', namely `ps ! k'     in stmt of 'do' block: print $ ps ! k failed, modules loaded: none. 

for starters, don't understand message. looked compiler expected array dim3 something, , got array f dim3 word8. why don't these types match up? i've read repa tutorial on haskell wiki, still don't see how make work.

i think may have 2 different versions of repa in play. check saying

ghc-pkg list repa 

and see how many versions show up. suspect you're importing data.array.repa 1 instance, data.array.repa.io.devil depends on other. hint in error message:

couldn't match expected type `array r0 dim3 a0'             actual type `repa-3.2.3.1:data.array.repa.base.array 

once, ghc says array, , once, says repa-3.2.3.1:data.array.repa.base.array. means explicitly wants make difference between 2 occurrences of type array here.

if suspicion correct, can either hide 1 version of repa (the 1 that's not version 3.2.3.1 , being used repa-devil) passing

-hide-package repa-<version> 

(with correct version number filled in) ghc, or can hide package via

ghc-pkg hide repa-<version> 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -