[Haskell-cafe] [ANN] Accelerate v1.3

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.

Instances of Elt and Arrays are now derivable via Generic for simple
(non-recursive Haskell'98) data types:

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_,

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 -> ...


This release consists of the following packages:

   - accelerate-
   - accelerate-llvm-
   - accelerate-llvm-native-
   - accelerate-llvm-ptx-
   - accelerate-fft-
   - accelerate-examples-
   - accelerate-blas-
   - accelerate-bignum-
   - accelerate-io-
   - accelerate-io-array-
   - accelerate-io-bmp-
   - accelerate-io-bytestring-
   - accelerate-io-cereal-
   - accelerate-io-JuicyPixels-
   - accelerate-io-repa-
   - accelerate-io-vector-
   - colour-accelerate-
   - containers-accelerate-
   - hashable-accelerate-
   - gloss-accelerate-
   - gloss-raster-accelerate-
   - lens-accelerate-
   - linear-accelerate-
   - mwc-random-accelerate-
   - cuda-
   - cufft-
   - cublas-
   - cusparse-
   - cusolver-
   - nvvm-


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>)
   - Rinat Striungis (@Haskell-mouse <https://github.com/Haskell-mouse>)
   - Viktor Kronvall (@considerate <https://github.com/considerate>)
   - Tom Smeding (@tomsmeding <https://github.com/tomsmeding>)
   - Ryan Scott (@RyanGlScott <https://github.com/RyanGlScott>)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20200901/8a809f2f/attachment.html>

More information about the Haskell-Cafe mailing list