Questions tagged [threepenny-gui]

Threepenny is a Haskell GUI framework that uses the web browser as a display. It is designed for easy setup across different operating systems. Threepenny includes built-in support for functional reactive programming (FRP).

55 questions
2
votes
0 answers

Running code with threepenny-gui

I installed threepenny-gui by setting up a cabal sandbox and running cabal install threepenny-gui -fbuildExamples which seemed to work fine. The examples were found in the .cabal-sandbox/bin-folder and they worked perfectly. After that I looked at…
655321
  • 195
  • 6
2
votes
0 answers

Bad performance of Threepenny-gui canvas

I tried to draw 100 animated circles with threepennt-gui. It felt kind of strange, so I made it 1000 and the problems were obvious: I could see the drawing (ie the canvas was black and then the circles appeared, then it went black again, etc It…
some idiot
  • 191
  • 13
2
votes
1 answer

Haskell Threepenny Gui: Reading Color from Canvas at specific Point?

Is there a way to read the Color of a specific Point of a Canvas? Something like: getColor :: Canvas -> Point -> Color I checked the Documentation at Graphics.UI.Threepenny.Canvas, but couldn't find any function for that. Maybe I just didn't see…
clem niem
  • 35
  • 5
2
votes
1 answer

Function (Behavior a ) -> (a -> IO b ) -> Behavior b. Is it semantically sound?

I want to map an IO action over a Behavior but there is no such function in (threepenny-gui) Is there some way of building it with the exposed API. Is it semantically sound? I've implemented this inside threepenny, in my use case works fine. --…
Massudaw
  • 31
  • 5
2
votes
1 answer

Mixing Threepenny-Gui and StateT

I have a question on the interaction of Threepenny-Gui with StateT. Consider this toy program that, every time the button is clicked, adds a "Hi" item in the list: import Control.Monad import Control.Monad.State import qualified…
meditans
  • 586
  • 3
  • 11
2
votes
1 answer

How to run threepenny-gui samples on windows

I was testing out the threepenny-gui package for Haskell gui programming. Following instructions here, I did: $ cd threepenny-gui-0.4.1.0/samples/ $ runhaskell.exe Chat.hs and got: Listening on http://0.0.0.0:8023/ [29/Apr/2014:11:37:44 -0400]…
thor
  • 21,418
  • 31
  • 87
  • 173
2
votes
1 answer

Turn a textfield and button clicks into `UI (Event String)`

I'm trying to use threepenny to learn about FRP. I'd like to generate events that contain the user's input, and fire each time a button is clicked. You can see the code on github. I've tried to do so with a function submitEvents :: Element ->…
Theo Belaire
  • 2,980
  • 2
  • 22
  • 33
2
votes
1 answer

Trying to render fields in threepenny-gui with special behaviour

What I want to do is set up fields which show detail when they're in focus, but summary when they're not. eg. a). when it loses focus (gets blur?), I save the value in a (State?) Map and then change the value to a function of the old value (ie. the…
b1g3ar5
  • 335
  • 2
  • 9
1
vote
0 answers

Threepenny GUI build fail

So I've been trying to install Threepenny GUI for a Haskell college assignment the last few hours without any avail. When stack attemps to build the 'snap-core' dependency, I get the following error: snap-core > configure snap-core >…
1
vote
2 answers

How to change button layout and position in Threepenny GUI?

How do I change the size and position of buttons or other UI elements in a GUI created with the threepenny-gui package? The documentation of Graphics.UI.Threepenny.Attributes lists some functions which are probably useful, such as coords ::…
AR1981
  • 11
  • 2
1
vote
0 answers

Haskell - can't generate and use Image file in threepenny

I will try to be as specific as possible. I am trying to make a graph visualization GUI using Haskell, Threepenny and DOT I have created buttons that modify the graph, and I am trying to save the modified graph in the image and load that image Every…
Tim Bill
  • 23
  • 1
  • 5
1
vote
1 answer

Threepenny-gui: get file path via 'file' input

I am going to write simple frontend for my console tool. Generally, it takes a few parameters and input file path for further opening and processing. My idea was to place something like UI.input # set (attr "type") "file" # set UI.text "input…
Triostrong
  • 107
  • 8
1
vote
1 answer

Remove UI monad with ThreepennyGUI

I'm really new to using the threepenny gui and I want to do something like this: on UI.click button $ const $ do element reverseArea # set UI.text (reverse (get value area)) So when i click a certain button on the page i get the text from a…
1
vote
1 answer

How to return JSObject from JSFunction?

I'd like to return a reference to a Javascript object from an FFI function definition in order to be able to manipulate the object later on: import Data.Aeson import Foreign.JavaScript (JSObject, NewJSObject,…
1
vote
0 answers

How to terminate a threepenny gui process on windows?

I'm trying Threepenny gui in Haskell with ghc-8.0.1, running in cygwin on Windows 10, using Chrome. But I can get only one of the sample programs to work. I launched the Buttons example from the Threepenny gui samples (runhaskell Buttons.hs), and…
John O'D
  • 81
  • 3