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).
Questions tagged [threepenny-gui]
55 questions
9
votes
1 answer
Pattern matching in do notation vs let
I recently encountered an error while using
threepenny-gui and it was solved by changing the code from pattern match in the do notation with <- to pattern matching with the let notation.
Is there any reasons why I should expect a change in behavior…

Davorak
- 7,362
- 1
- 38
- 48
8
votes
3 answers
Haskell do clause with multiple monad types
I'm using a graphic library in Haskell called Threepenny-GUI. In this library the main function returns a UI monad object. This causes me much headache as when I attempt to unpack IO values into local variables I receive errors complaining of…

vondip
- 13,809
- 27
- 100
- 156
7
votes
2 answers
Why do some of threepenny-gui FRP combinators operate on a MonadIO monad instead of being pure?
First of all a disclaimer, I might have misunderstood completely the way threepenny-gui works due to my not so advanced knowledge of Haskell, so take my assertions with a grain of salt. :-)
It seems to me that some combinators are not pure…

miguel.negrao
- 949
- 5
- 13
6
votes
1 answer
Is it possible to manually update the value of a Behaviour? (Functional Reactive Programming, Threepenny)
I really hope I haven't gone down a dead-end here. I have a Behaviour that gives the currently selected Color, and the current mouse coordinates, then carries out a task when the mouse is clicked. That task involves looking at a list and then…

NukPan
- 249
- 2
- 8
5
votes
1 answer
Why does changing my FRP implementation to be more reactive lag?
I got a version of snake working with the threepenny-gui library, but I didn't like the fact that I was explicitly calling newEvent and addStateUpdate manually instead of defining the behavior completely based on events, e.g. this:
(updates,…

brandonchinn178
- 519
- 3
- 20
5
votes
2 answers
Dynamic Elements based on Behaviour in threepenny-gui
To put it simple, I am looking for a way to display a Behaviour (UI Element).
My actual use-case is displaying a table, which can be filtered. So I have a function tableElement :: String -> UI Element (the String parameter being the filter…

ipsec
- 680
- 4
- 11
4
votes
1 answer
“Unable to load package `regex-posix` … unknown symbol ‘regerror’”
For a new project, I have been trying to build the threepenny-gui package, something which I have done many times in the past without any trouble. This time however, I ran into an unusual error message:
> stack build
threepenny-gui >…

bradrn
- 8,337
- 2
- 22
- 51
4
votes
1 answer
Threenpenny gui - capturing mouse coordinates on click and using them to construct some state
What I'd like to achieve:
Each time the user clicks a canvas, take the mouse coordinates from that click to construct a Point x y and store this state in a [Point] such that at a later point in time when the user clicks a button I can use that…

Thomas Cook
- 4,371
- 2
- 25
- 42
4
votes
1 answer
Drawing an image onto a threepenny-gui Canvas
I'm having an issue with canvases. I have modified the Canvas.hs example program to draw an image onto the canvas with
canvas # drawImg
right after the canvas setup code; here it is for reference:
canvas <- UI.canvas
# set UI.height…

zcleghern
- 827
- 7
- 21
4
votes
1 answer
Threepenny-GUI: Drag'n'Drop - Access DragData
I am currently struggling with getting access to the DragData of the dragged element when the on UI.drop is called. I have something like this:
tile <- UI.new
# set UI.draggable True
# set UI.dragData (show player)
field <- UI.new
# set…

m0.o
- 115
- 1
- 10
4
votes
1 answer
Click button on "Enter" keypress
I would like something like this:
on UI.keydown textfield $ \c -> when (c == 13) $ void $ do
trigger UI.click button
Namely, is there something that acts like the trigger function I just inserted?

allidoiswin
- 2,543
- 1
- 20
- 23
4
votes
3 answers
Changes in other elements based on listbox selections in threepenny-gui
So I have a simple example layout with a listbox, a button and a textarea, where clicking the button changes the text in the textarea:
import Control.Applicative
import Control.Monad
import Data.Maybe
import qualified Graphics.UI.Threepenny as…

655321
- 195
- 6
4
votes
1 answer
threepenny-gui: how to get text?
With 'set text' in Threepenny-gui you can, given an element and an string, set the text of that element:
Prelude Graphics.UI.Threepenny.Core> :t set
set :: ReadWriteAttr x i o -> i -> UI x -> UI x
Prelude Graphics.UI.Threepenny.Core> :t set text
set…

Maarten Faddegon
- 775
- 5
- 11
4
votes
1 answer
threepenny-gui - opening files
Dear Haskell community I have written my first gui application and decided to use
threepenny-gui to do so.
The task is the following search the files in a given folder for matches and provide links to open those files. In addition I made nice parse…

epsilonhalbe
- 15,637
- 5
- 46
- 74
3
votes
2 answers
How to recreate an element in Threepenny GUI?
If I use the delete function on some Elements, how can I then recreate them (as in make them appear again)?
I have looked around the examples and documentation, but I couldn't find any function that would allow me to do this except maybe mkElement…

The Red Fox
- 810
- 6
- 12