Tag: purescript

How to generate Pux actions from a foreign module?

I’m trying to write an application using purescript-pux and CodeMirror, a static code editor. CodeMirror makes an editor from a text-area, but the events are handled differently, therefore I cannot use the onChange function from Pux.Html.Events. To handle input changes in a CodeMirror editor, one should do it this way: CodemirrorInstance.on(‘change’,function(cMirror){ // get value right […]

How do I create a foreign constant in PureScript?

I’m trying to create a foreign constant in PureScript but it doesn’t seem to call the function. I have in PureScript: module Test where foreign import test :: String foreign import test2 :: String -> String and in JavaScript: “use strict”; // module Test exports.test = function() { return “A”; }; exports.test2 = function(x) { […]

PureScript does not compose `trace` and `show`

So the following works main = do trace $ show $ 5 but this does not main = do (trace . show) 5 in psci the type of trace is forall r. Prim.String -> Control.Monad.Eff.Eff (trace :: Debug.Trace.Trace | r) Prelude.Unit and the type of show is forall a. (Prelude.Show a) => a -> Prim.String […]

converting from Purescript Record to a JS object

I am trying to convert a Record to a vanilla JS object module MyModule where data Author = Author { name :: String, interests :: Array String } phil :: Author phil = Author { name: “Phil”, interests: [“Functional Programming”, “JavaScript”] } when I access the object from JS MyModule.phil it contains other properties that […]