--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
foreign import jsevent "fftEvents" (fromList [])fft : Signal (JSArray JSNumber)
port fft : Signal (JSArray JSNumber)port fft <- fromList []
port fft : Signal (JSArray JSNumber)
port fft <- (fromList <~ constant [])
What if I don't want a conversion and would rather just work with JSValue? Can I use 'id' ?
--
Sent from Gmail Mobile
"using" is trendy :-) I say go for it, it's not a difficult thing for folks to patch.
module Foouses JavaScript as JS
--
I'm also getting behind Alex's proposal, unless someone wants to make a case for my old favorite, include.
--
A couple of questions:a) would import and export be restricted to the top level module, just like main is?
b) can you post some examples of how you imagine the JS side of the interface for static values and exported functions?
import Foo (bar) as (barAlias)
or alternatively like this:import JavaScript (toFloat) as (toFloatJS)myFunction = toFloat someElmValue / toFloatJS someJSvalue
import JavaScript as JSmyFunction = toFloat someElmValue / JS.toFloat someJSvalue
--
I can answer the question about initial values: it's a well-known (to veterans) quirk that initial values are not treated as events. So foldp (\_ _ -> 5) 2 (constant 0) stays at the initial value 2 rather than receiving a 0 and changing to 5. I'm starting to think we may need a "send the initial value of this signal as an event at program start" keyword.Evan can say more about node, but the new repl is node-based so there may be a lot in common.
--
I'm starting to think we may need a "send the initial value of this signal as an event at program start" keyword.
data Connection = Serial String | TCPIP String | Interactive
connectionToString : Connection -> String
connectionToString c = case c of
Serial s -> "serial " ++ s
TCPIP s -> "tcpip " ++ s
Interactive -> "interactive"
port connection_ : Signal JS.JSString
port connection_ <- constant (JS.fromString (connectionToString connection))
connection = TCPIP "127.0.0.1:10020"
I'm pleasantly surprised the reaction to the import/export idea is so positive :)A couple of questions:a) would import and export be restricted to the top level module, just like main is?Laszlo has recommended that it is restricted in that way, at least in the first draft. It's currently implemented without this restriction, but I think adding the restriction is a good plan because it's not very clear what the implications of this decision will be.
If you left the restriction out, would it be possible to implement modules like Native.Signal using import/export? Then we'd be able to completely separate "elm the pure functional language" from "elm the frp system" which would really help on the node integration/testing front.
Though it seems like you intentionally left out "importing javascript functions"
above so I assume you don't want to (effects and such). If you are leaving that out, does that mean you can only export first-order functions? I think exporting higher-order functions would be semantics-breaking:
If you left the restriction out, would it be possible to implement modules like Native.Signal using import/export? Then we'd be able to completely separate "elm the pure functional language" from "elm the frp system" which would really help on the node integration/testing front.
Yeah, I think a bunch of "inputs" could be implemented without corresponding Native implementations if that was allowed (Mouse, Touch, Window, and maybe some others). I don't know if I understand the testing aspect of this though. Is the idea that you could more easily mock out Mouse inputs?
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.