FP /

Feldspar hacking session


Make sure to have GHC 7.0.* installed.

You also need to install Happy:

  cabal install happy

Download the files:

(These can only be accessed from within the Chalmers network.)

Next, run

  cabal unpack syntactic-0.8.tar.gz
  cabal unpack feldspar-language-
  cabal unpack feldspar-compiler-

First, install happy:

  cabal install happy

Then, go into each of the created directories and run

  cabal install

Quick start

API reference

The interesting modules are:


import qualified Prelude
import Feldspar
import Feldspar.Vector
import Feldspar.Compiler

revProd :: Vector (Data Float) -> Data Float
revProd a = sum $ zipWith (*) a (reverse a)
*Main> eval revProd [1..10]

*Main> drawAST revProd 
(prints out the resulting core language AST)

*Main> icompile revProd 
(prints out the C code)

*Main> compile revProd "code" "revProd" defaultOptions 
(creates the C function revProd in the file code.c)


One suggestion is to focus the hacking session on FFT algorithms. Some FFT resources:


It is also possible to try out the exercises in our CEFP summer school notes.