[Haskell-cafe] Atom - help.
tomahawkins at gmail.com
Sat Jun 13 11:39:07 EDT 2009
Calling foreign functions that return values is problematic for the
compiler -- I haven't invested enough time to come up with a good
The work around is to assign the result to an external variable. The
drawback is the result will not be available until the rule executing
the action has completed.
results <- bool' "result" -- Global, external variable to capture result.
action (\ [a, b, c] -> printf "result = function(%s, %s %s)" a b c) [a, b, c]
On Sat, Jun 13, 2009 at 5:03 AM, Radamés Ajna<radamajna at gmail.com> wrote:
> hi there,
> I've been working with haskell and atom dsl, however I'm new to haskell..
> John Van Enk inspired me with programming arduino->atmegas , with haskell,
> So here is my problem.
> With an action , action :: ([String] -> String) -> [UE] -> Atom () ,
> it's possible make calls to some precoded C functions like,
> setLED v = action (\[x] -> "setLED(" ++ x ++ ")") [v']
> where v' = ue . value $ v
> where setLed is a precode function.
> I want call a precoded C function that returns some value, but action
> always give me Atom () ,
> that's I would like to do but I don't know how ..
> Atom (V Int8) < ---- "int read()"
> related links
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe