Skip to content
This repository
Browse code

Merge branch 'master' into dev

  • Loading branch information...
commit 8ff7a717ed7517aa700dd46fafdc3f05f627fb8b 2 parents dde19fa + 3b46e0c
Ryan Newton rrnewton authored

Showing 1 changed file with 21 additions and 5 deletions. Show diff stats Hide diff stats

  1. +21 5 Data/Array/Accelerate/Array/Sugar.hs
26 Data/Array/Accelerate/Array/Sugar.hs
@@ -52,26 +52,42 @@ import qualified Data.Array.Accelerate.Array.Representation as Repr
52 52 -- Surface types representing array indices and slices
53 53 -- ---------------------------------------------------
54 54
55   --- |Array indices are snoc type lists.
56   --- For example, the type of a rank-2 array index is @Z :.Int :. Int@.
  55 +-- |Array indices are snoc type lists. That is, they're backwards --
  56 +-- the end-of-list token, `Z`, occurs first. For example, the type of a
  57 +-- rank-2 array index is @Z :. Int :. Int@.
  58 +--
  59 +-- In Accelerate the rightmost dimension is the /fastest varying/ or innermost.
57 60
58 61 -- |Rank-0 index
59 62 --
60 63 data Z = Z
61 64 deriving (Typeable, Show, Eq)
62 65
63   --- |Increase an index rank by one dimension
  66 +-- |Increase an index rank by one dimension. The `:.` operator is
  67 +-- used to construct both values and types.
64 68 --
65 69 infixl 3 :.
66 70 data tail :. head = tail :. head
67 71 deriving (Typeable, Show, Eq)
68 72
69   --- |Marker for entire dimensions in slice descriptors
  73 +-- |Marker for entire dimensions in slice descriptors.
  74 +--
  75 +-- For example, when used in slices passed to `replicate`, the
  76 +-- occurrences of `All` indicate the dimensions into which the array's
  77 +-- existing extent will be placed, rather than the new dimensions
  78 +-- introduced by replication.
70 79 --
71 80 data All = All
72 81 deriving (Typeable, Show, Eq)
73 82
74   --- |Marker for arbitrary shapes in slice descriptors
  83 +-- |Marker for arbitrary shapes (including an unknown number of dimensions) in slice descriptors.
  84 +--
  85 +-- `Any` can be used in the leftmost position of a `:.` chain instead
  86 +-- of `Z`. For example, in the following definition `Any` is used to
  87 +-- match against whatever shape the type variable `sh` takes:
  88 +--
  89 +-- > repN :: (Shape sh, Elt e) => Int -> Acc (Array sh e) -> Acc (Array (sh:.Int) e)
  90 +-- > repN n a = replicate (constant$ Any :. n) a
75 91 --
76 92 data Any sh = Any
77 93 deriving (Typeable, Show, Eq)

0 comments on commit 8ff7a71

Please sign in to comment.
Something went wrong with that request. Please try again.