[GHC] #8712: Data.Ix missing info on row/column major indexing

#8712: Data.Ix missing info on row/column major indexing -------------------------------------+------------------------------------- Reporter: mirpa | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: libraries/base | Version: 7.6.3 Keywords: row, column, | Operating System: Unknown/Multiple major, Ix | Type of failure: Documentation Architecture: Unknown/Multiple | bug Difficulty: Easy (less than 1 | Test Case: hour) | Blocking: Blocked By: | Related Tickets: | -------------------------------------+------------------------------------- I've tried to use {{{Data.Ix}}} with {{{Data.Vector}}} for image manipulations and I confused column with row-major indexing. I expected than {{{Data.Ix.index ((0,0),(3,3)) (1,0) == 1}}} while it is actually equal to 4. Documentation for {{{Data.Ix}}} should explicitly state that it is row- major indexing and function {{{Data.Ix.index}}} might be accompanied by example like: {{{index ((0,0),(3,3)) (1,0) == 4}}} which should be obvious. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8712 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8712: Data.Ix missing info on row/column major indexing -------------------------------------+------------------------------------- Reporter: mirpa | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: libraries/base | Version: 7.6.3 Resolution: | Keywords: row, column, Operating System: Unknown/Multiple | major, Ix Type of failure: Documentation | Architecture: Unknown/Multiple bug | Difficulty: Easy (less than 1 Test Case: | hour) Blocking: | Blocked By: | Related Tickets: -------------------------------------+------------------------------------- Comment (by carter): Hey Mirpa, i warmly recommend not using Ix and Array types from base when indexing into multidimensional arrays, juicy pixels has some decent bare bones facilities that should be easier to use http://hackage.haskell.org/package/JuicyPixels-3.1.3.2/docs/Codec- Picture.html likewise, I have some work in progress apis for multi dimensional arrays i hope to release soon. alternatively, REPA, YARR and/or ACCELERATE are all nice libs that can really shine on image related work loads. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8712#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8712: Data.Ix missing info on row/column major indexing -------------------------------------+------------------------------------- Reporter: mirpa | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: libraries/base | Version: 7.6.3 Resolution: | Keywords: row, column, Operating System: Unknown/Multiple | major, Ix Type of failure: Documentation | Architecture: Unknown/Multiple bug | Difficulty: Easy (less than 1 Test Case: | hour) Blocking: | Blocked By: | Related Tickets: -------------------------------------+------------------------------------- Comment (by rwbarton): Um, there's absolutely nothing wrong with using Ix and Array with multidimensional arrays (though the poster is not using Array anyways). Anyways, the Haskell 2010 (or 98) Report does specify that the Ix instance for `(a,b)` uses row-major order (though the wording is awkward: an instance for a built-in type is normally not called "derived"), so I agree that information should appear in the haddocks for Data.Ix somewhere. Incidentally there is a broken link at the end of http://hackage.haskell.org/package/base-4.6.0.1/docs/Data-Ix.html which ought to point to the relevant part of the Report, but as I mentioned "Deriving Instances of Ix" is not an intuitive section to look at for the instance `(a,b)`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8712#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8712: Data.Ix missing info on row/column major indexing -------------------------------------+------------------------------------- Reporter: mirpa | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: libraries/base | Version: 7.6.3 Resolution: | Keywords: row, column, Operating System: Unknown/Multiple | major, Ix Type of failure: Documentation | Architecture: Unknown/Multiple bug | Difficulty: Easy (less than 1 Test Case: | hour) Blocking: | Blocked By: | Related Tickets: -------------------------------------+------------------------------------- Comment (by mirpa): Thank you for recommendations on libraries. I've heard about Repa. For info: I use {{{FreeType}}} binding to render monochromatic glyphs which gives me {{{ByteString}}} with rows-width-pitch. I convert {{{ByteString}}} into {{{Data.Vector}}} for some number crunching (filtering) and save it as grey scale image with {{{JuicyPixels}}}. {{{Data.Ix}}} is used to address {{{Vector}}} as 2D array. It took me a while before I figured out why there is tearing and/or rotation in my image. I think that appropriate note in documentation could give a vital clue. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8712#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8712: Data.Ix missing info on row/column major indexing -------------------------------------+------------------------------------- Reporter: mirpa | Owner: Type: bug | Status: patch Priority: normal | Milestone: Component: libraries/base | Version: 7.6.3 Resolution: | Keywords: row, column, Operating System: Unknown/Multiple | major, Ix Type of failure: Documentation | Architecture: Unknown/Multiple bug | Difficulty: Easy (less than 1 Test Case: | hour) Blocking: | Blocked By: | Related Tickets: -------------------------------------+------------------------------------- Changes (by bernalex): * cc: hvr, ekmett (added) * status: new => patch -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8712#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8712: Data.Ix missing info on row/column major indexing -------------------------------------+------------------------------------- Reporter: mirpa | Owner: Type: bug | Status: patch Priority: normal | Milestone: Component: libraries/base | Version: 7.6.3 Resolution: | Keywords: row, column, Operating System: Unknown/Multiple | major, Ix Type of failure: Documentation | Architecture: Unknown/Multiple bug | Difficulty: Easy (less than 1 Test Case: | hour) Blocking: | Blocked By: | Related Tickets: -------------------------------------+------------------------------------- Comment (by ekmett): Sounds good to me. It is better to be explicit about these things and hurts nothing to add these few words on the topic. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8712#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8712: Data.Ix missing info on row/column major indexing
-------------------------------------+-------------------------------------
Reporter: mirpa | Owner:
Type: bug | Status: patch
Priority: normal | Milestone:
Component: libraries/base | Version: 7.6.3
Resolution: | Keywords: row, column,
Operating System: Unknown/Multiple | major, Ix
Type of failure: Documentation | Architecture: Unknown/Multiple
bug | Difficulty: Easy (less than 1
Test Case: | hour)
Blocking: | Blocked By:
| Related Tickets:
-------------------------------------+-------------------------------------
Comment (by Austin Seipp

#8712: Data.Ix missing info on row/column major indexing -------------------------------------+------------------------------------- Reporter: mirpa | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: | Version: 7.6.3 libraries/base | Keywords: row, column, Resolution: fixed | major, Ix Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Easy (less than 1 Type of failure: | hour) Documentation bug | Blocked By: Test Case: | Related Tickets: Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by thoughtpolice): * status: patch => closed * resolution: => fixed Comment: Merged. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8712#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8712: Data.Ix missing info on row/column major indexing -------------------------------------+------------------------------------- Reporter: mirpa | Owner: Type: bug | Status: closed Priority: normal | Milestone: 7.10.1 Component: | Version: 7.6.3 libraries/base | Keywords: row, column, Resolution: fixed | major, Ix Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Easy (less than 1 Type of failure: | hour) Documentation bug | Blocked By: Test Case: | Related Tickets: Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by thoughtpolice): * milestone: => 7.10.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8712#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC