Alex Rivera | Logout

Are there any special challenges for functional programming in an embedded environment?

Asked 2010-12-11T19:49:07.063
17

So I'm starting to get a feel for what sets functional programming apart from imperative programming. So like any good convert I'm looking at things with the Haskell hammer and trying to imagine how my embedded programming work could be shaped as appropriate nails for that tool.

So that got me thinking about this question. Is the embedded environment a special case of general computing in the eyes of functional programming or is it just another form of the general case? Is the challenge all in the IO? My embedded work usually entails about 90 - 95% peripheral IO work and the last little bit of stuff being what algorithm work I can fit onto it and still make it back to my IO in time. Does that sort of work make a functional program unsuited to my needs?

Finally, if there are any projects to embedded Haskell projects you could suggest, that'd be greatly appreciated. Thanks.

Edit
Report

1 Answer

13

There are a number of promising projects for bringing functional programming to the embedded programming world.

It seems like a common approach is to take advantage of the type safety and other correctness features of but to abandon heavyweight runtime like ghc. As a result of abandoning the run time, you give up features like garbage collection. Instead, embedded Haskell projects use embedded DSL languages that output real time C code.

Embedded projects using mix C, C++ and Haskell code, rather than being pure functional projects. The C code produced from the Haskell code is not idiomatic C code so collaborators on the project typically need to be familiar with Haskell syntax to participate.

Galois's Copilot project is one the mode extensively documented embedded Haskell projects.

http://corp.galois.com/blog/2010/9/22/copilot-a-dsl-for-monitoring-embedded-systems.html

Copilot uses the Atom DSL which seems popular

http://hackage.haskell.org/cgi-bin/hackage-scripts/package/atom-0.0.2

There is also a moderately active Google Group

https://groups.google.com/forum/#forum/fp-embedded

answered 2010-12-11T20:13:39.323

Your Answer