Trevor McDonell trevor.mcdonell at gmail.com
Tue Sep 1 11:50:04 UTC 2020

```Hi all,

On behalf of the Accelerate team, I'm happy to announce the release of
version 1.3 of Accelerate:

This release includes many quality-of-life improvements for defining and
using your own data types in embedded code. A summary of these new features
is included in this release announcement.
Generic

Instances of Elt and Arrays are now derivable via Generic for simple

data Point = Point Float Float Float
deriving (Generic, Elt)

At the scalar level we now also support *sum* data types:

data Object = Sphere Point Float | Triangle Point Point Point
deriving (Generic, Elt)

Pattern synonyms

Pattern synonyms for creating and accessing data types can now be defined
and used, which in practice makes GHC's type checker far less angry than
the old method of lift and unlift (which still exists). Pattern synonyms
are used in the same way as you would a regular data constructor.

Included are synonyms for tuples up to 16-tuples (T2, T3...) as well as
indices (Z_, ::., I1, I2...) and other standard data types (Just_, True_,
etc.)

Defining your own pattern synonyms for product types can be done via the
overloaded Pattern synonym at both the scalar:

pattern Point_ :: Exp Float -> Exp Float -> Exp Float -> Exp Point
pattern Point_ x y z = Pattern (x, y, z)

...and array levels:

data State = State (Vector Point) (Vector Float)
deriving (Generic, Arrays)

pattern State_ :: Acc (Vector Point) -> Acc (Vector Float) -> Acc State
pattern State_ { positions, masses } = Pattern (positions, masses)

Note the syntax of the last example, which also generates the two accessor
functions positions :: Acc State -> Acc (Vector Point) and masses :: Acc
State -> Acc (Vector Float). This syntax is of course also available for
use in Exp patterns.

Defining pattern synonyms can also be achieved with the following
TemplateHaskell splice (which is required for sum data types):

mkPattern ''Object

Embedded pattern matching

This release also introduces support for *embedded pattern matching* via
the new match operator, which allows us to reuse Haskell's case syntax in
embedded code:

intersect :: Exp Ray -> Exp Object -> Exp Bool
intersect ray = match \case
Sphere_ c r     -> ...
Triangle_ a b c -> ...

Packages

This release consists of the following packages:

- accelerate-1.3.0.0
- accelerate-llvm-1.3.0.0
- accelerate-llvm-native-1.3.0.0
- accelerate-llvm-ptx-1.3.0.0
- accelerate-fft-1.3.0.0
- accelerate-examples-1.3.0.0
- accelerate-blas-0.3.0.0
- accelerate-bignum-0.3.0.0
- accelerate-io-1.3.0.0
- accelerate-io-array-0.1.0.0
- accelerate-io-bmp-0.1.0.0
- accelerate-io-bytestring-0.1.0.0
- accelerate-io-cereal-0.1.0.0
- accelerate-io-JuicyPixels-0.1.0.0
- accelerate-io-repa-0.1.0.0
- accelerate-io-vector-0.1.0.0
- colour-accelerate-0.4.0.0
- containers-accelerate-0.1.0.0
- hashable-accelerate-0.1.0.0
- gloss-accelerate-2.1.0.0
- gloss-raster-accelerate-2.1.0.0
- lens-accelerate-0.3.0.0
- linear-accelerate-0.7.0.0
- mwc-random-accelerate-0.2.0.0
- cuda-0.10.2.0
- cufft-0.10.0.0
- cublas-0.6.0.0
- cusparse-0.3.0.0
- cusolver-0.3.0.0
- nvvm-0.10.0.0

Contributors

Special thanks to those who contributed to this release:

- Trevor L. McDonell (@tmcdonell <https://github.com/tmcdonell>)
- Joshua Meredith (@JoshMeredith <https://github.com/JoshMeredith>)
- Ivo Gabe de Wolff (@ivogabe <https://github.com/ivogabe>)
- David van Balen (@dpvanbalen <https://github.com/dpvanbalen>)
- Jaro Reinders (@noughtmare <https://github.com/noughtmare>)
- Alex Lang (@alang9 <https://github.com/alang9>)
- Paul Wilson (@statusfailed <https://github.com/statusfailed>)
- @lennonhill <https://github.com/lennonhill>
- Travis Whitaker (@TravisWhitaker <https://github.com/TravisWhitaker>)
- Roger Bosman (@rogerbosman <https://github.com/rogerbosman>)
- Robbert van der Helm (@robbert-vdh <https://github.com/robbert-vdh>)
- Sam (@sam-340453 <https://github.com/sam-340453>)
- Lars van den Haak (@sakehl <https://github.com/sakehl>)