[Haskell] ANNOUNCE: hmatrix-syntax

Reiner Pope reiner.pope at gmail.com
Wed Feb 15 12:42:48 CET 2012


Hi list,

I am pleased to announce the first release of hmatrix-syntax [1], which provides quasiquoters to provide a nice syntax for vectors and matrices in Alberto Ruiz's excellent matrix package[2].

Examples:

> {-# LANGUAGE QuasiQuotes, ViewPatterns #-}
>
> import Data.Packed
> import Data.Packed.Syntax
> import Foreign.Storable
>
> -- vectors can be constructed and deconstructed
> swap :: Storable a => Vector a -> Vector a
> swap [vec| x, y |] = [vec| y, x |]
>
> -- matrices can be constructed and deconstructed
> adjugateMat2 :: (Storable a, Num a) => Matrix a -> Matrix a
> adjugateMat2 [mat| a, b; c, d |] = [mat| d, -b; -c, a |]

These constructions and deconstructions are expanded into direct array accesses.

Regards,
Reiner

[1]: http://hackage.haskell.org/package/hmatrix-syntax
[2]: http://hackage.haskell.org/package/hmatrix
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell/attachments/20120215/e4ce4d6e/attachment.htm>


More information about the Haskell mailing list