Questions tagged [reflex]

Reflex is a Haskell library, providing high-performance, deterministic, higher-order Functional Reactive Programming system

Reflex is a Haskell library, providing high-performance, deterministic, higher-order Functional Reactive Programming system

74 questions
11
votes
2 answers

Creating a Behavior for a continuously measurable phenomenon

I would like to create a Behavior t a from an IO a, with the intended semantics that the IO action would be run every time the behavior is sampled: {- language FlexibleContexts #-} import Reflex.Dom import Control.Monad.Trans onDemand ::…
Cactus
  • 27,075
  • 9
  • 69
  • 149
7
votes
1 answer

Turning requestAnimationFrame into an Event t ()

Using Reflex-DOM, I'd like to make an Event t () that fires when the browser is ready to paint the next frame, i.e. when requestAnimationFrame fires. I tried it like this: {-# LANGUAGE RecursiveDo, TypeFamilies #-} import Reflex.Dom import…
Cactus
  • 27,075
  • 9
  • 69
  • 149
7
votes
2 answers

XhrRequest with reflex/reflex-dom

I want to perform a basic Ajax request, that's all. I use reflex for the frontend and Scotty for the backend. The Firefox Web Console tells me the request was a success and I see the expected result there. But the website switches from Just…
somesoaccount
  • 1,267
  • 15
  • 37
6
votes
1 answer

Type inference - could not deduce Monad

I am building a way to display a dialog to users. data DialogConfig t m b e = DialogConfig { _dialogConfig_title :: Dynamic t T.Text , _dialogConfig_content :: b -> m (Dynamic t (Maybe b)) , _dialogConfig_footer ::…
ondra
  • 9,122
  • 1
  • 25
  • 34
5
votes
1 answer

Creating an event that fires only once

I find myself in desire of a function with the signature: -- VtyWidget is from https://github.com/reflex-frp/reflex-vty now :: a -> VtyWidget t m (Event t a) For some m. This function would take an element and produce a widget which fires an event…
Wheat Wizard
  • 3,982
  • 14
  • 34
5
votes
1 answer

Reflex: Create a resettable delayed event

I'm using Reflex within Haskell, and am trying to create an event which fires (for question purposes) a set period of time after another, let's say 2 seconds. However, the counter should reset whenever the original event fires, so that if the…
Stephen Morgan
  • 327
  • 1
  • 9
5
votes
1 answer

In reflex-dom, how to pass a value from a dynamic to a foreign javascript function (FFI)

I am new to Haskell and reflex-dom, but really like the language. I've been using https://github.com/hansroland/reflex-dom-inbits/blob/master/tutorial.md to learn, and it's been very helpful. I am currently trying to create a function that takes in…
Thanacles
  • 75
  • 4
5
votes
0 answers

Accessing a web server from a webkit client written in haskell reflex-dom

This is a follow up question to Acess a servant server with a reflex-dom client: If I run the client code in a web browser everything works fine. However if I run the client code in webkit under gtk3 (and Debian), I can see the request in the…
Jogger
  • 1,617
  • 2
  • 12
  • 22
5
votes
1 answer

Structuring a dynamic list of reflex-dom widgets/events according to numeric user input

I'm trying to create a dynamic list of widgets with the number of widgets determined by a numeric value from user input. Furthermore, each widget returns a click event. Here's what I'm using to get the user input: settings :: MonadWidget t m => m…
James
  • 4,599
  • 2
  • 19
  • 27
5
votes
1 answer

Why does this Reflex code result in Dynamics firing indefinitely with the same value?

The intent of this small program is to show three buttons, with the third button's label initially being "0" and afterwards being the index of the last-clicked button. For now the number of buttons and the labels of the other buttons are…
ajp
  • 1,723
  • 14
  • 22
4
votes
1 answer

How to set input value to current day in reflex?

I am using reflex-platform with obelisk. This is my frontend code to get the current date pb <- getPostBuild postBuildTime <- performEvent $ pb $> liftIO getCurrentTime let today = Text.pack . formatTime defaultTimeLocale "%F" <$> postBuildTime I…
ruben.moor
  • 1,876
  • 15
  • 27
4
votes
1 answer

How to properly do nested routing in Obelisk?

I have been searching for examples, however most examples do a RouteSomething -> PathSegment "firstpath" $ unitEncoder mempty and not a single nested route. There are some examples that use Cat.id to pass the whole URI as a Text such…
Fabián Heredia Montiel
  • 1,687
  • 1
  • 16
  • 30
4
votes
1 answer

a single svg element with reflex frp

I am trying to write a single SVG element within reflex FRP import Reflex.Dom import qualified Data.Map as Map main = mainWidget $ myDiv myDiv = el "svg" $ do elAttr "circle" $ Map.fromList [ ("cx" , "50") , ("cy", "50"), ("r" , "40"),…
john mangual
  • 7,718
  • 13
  • 56
  • 95
4
votes
2 answers

Detect a closed server connection via websockets in reflex-dom?

I've been using reflex and reflex-dom to recreate a web version of a boardgame, and I quite like it so far, but I require a websocket to alert a player when the other player has made a move. Everything works great but if the server goes down, I…
David McHealy
  • 2,471
  • 18
  • 34
4
votes
1 answer

What is the proper way in reflex-dom to handle a modal dialog?

I am just starting with the reflex-dom library and I cannot quite figure out the proper and convenient way to work with dialogs. Showing a dialog generally means adding a few elements to the end of and removing it when the user clicks on some…
ondra
  • 9,122
  • 1
  • 25
  • 34
1
2 3 4 5