Re: [Haskell-cafe] C functional programming techniques?

2010-01-30 Thread Sean Leather
2010/1/29 Maurí­cio CA:

 Sorry if this looks weird, but do you know of experiences with
 functional programming, or type programming, with C? Using macro
 tricks or just good specifications?


This is probably not what you're looking for, but it's related:
Single-Assignment C (Functional Array Programming for High-Performance
Computing)

http://www.sac-home.org/

From the website: SaC is an array programming language predominantly suited
for application areas such as numerically intensive applications and signal
processing. Its distinctive feature is that it combines high-level program
specifications with runtime efficiency similar to that of hand-optimized
low-level specifications. Key to the optimization process that facilitates
these runtimes is the underlying functional model which also constitutes the
basis for implicit parallelization. This makes SaC ideally suited for
utilizing the full potential of modern CMP architectures such as multi-cores
or the Cell processor.

Regards,
Sean
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] C functional programming techniques?

2010-01-30 Thread Alexander Solla


On Jan 29, 2010, at 9:11 AM, Maurí cio CA wrote:


Sorry if this looks weird, but do you know of experiences with
functional programming, or type programming, with C? Using macro
tricks or just good specifications?



I know this is not absurd to a small extent. I've heard of proof
tool certificated C code on the net (although I don't understand
that theory), and I was also able to use what I learned from
Haskell in a few C-like tasks. [*]


I would use a higher level language to emit valid C.  Basically, use a  
strongly typed macro language.  All you will have to prove is that  
your emitter produces type safe code, which you can do by induction  
and is straight forward.  You can build up a small library of  
combinators for type safe units of C code.  Haskell might be a good  
choice for writing your C pre-processor, but there are plenty of  
choices.  Using something like ehaskell (or eruby) might be a good  
approach.


http://hackage.haskell.org/package/ehaskell

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] C functional programming techniques?

2010-01-29 Thread Maurí­cio CA

Hi, all,

Sorry if this looks weird, but do you know of experiences with
functional programming, or type programming, with C? Using macro
tricks or just good specifications?

I know this is not absurd to a small extent. I've heard of proof
tool certificated C code on the net (although I don't understand
that theory), and I was also able to use what I learned from
Haskell in a few C-like tasks. [*]

So, I imagine if someone has done such kind of experiment
seriously, like others have done with object-oriented programming
(gobject etc.). Google told me nothing.

Thanks,

Maurício

[*] This may actually be interesting. I had to use a proprietary
script language mixing the worst of FORTRAN and C to drive an
application, and I tried to use what I learned from Haskell by,
say, prohibiting side effects out of some isolated code areas that
got well specified input and gave well specified output -- even
if the inside of the block itself was a huge mess. The result
was actually fun to use, and after two years without looking at
that code I was asked to adapt the application to be used inside
another, which I could do in half a day! Maybe I should write a
Why functional programming matters - 2 on that :) It's easy to
show FP is cool with abstract problems, but it's far more cool
when we can show it can save even programmers with no CS theory
background from huge headaches.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] C functional programming techniques?

2010-01-29 Thread Erik de Castro Lopo
Maurí­cio CA wrote:

 Hi, all,
 
 Sorry if this looks weird, but do you know of experiences with
 functional programming, or type programming, with C? Using macro
 tricks or just good specifications?

I know there is some type level programming (not strictly functional)
in CCAN:

http://ccan.ozlabs.org/

Not sure if this is what you're after though.

Erik
-- 
--
Erik de Castro Lopo
http://www.mega-nerd.com/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe