This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Reflex.Dom | |
main :: IO () | |
main = mainWidget $ el "div" $ display =<< count =<< button "Click Me!" | |
-- Cf: https://github.com/ghcjs/ghcjs-examples/blob/master/weblog/counter/counter.hs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- http://stackoverflow.com/questions/30885883/why-does-this-reflex-code-result-in-dynamics-firing-indefinitely-with-the-same-v | |
{-# LANGUAGE RecursiveDo, ScopedTypeVariables #-} | |
import Reflex | |
import Reflex.Dom | |
import qualified Data.Map as Map | |
dynButton | |
:: MonadWidget t m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<!-- Add leaflet css --> | |
<link | |
rel="stylesheet" href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css" | |
integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ==" | |
crossorigin="" | |
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE ScopedTypeVariables, RecursiveDo #-} | |
import Control.Monad | |
import Reflex.Dom | |
import qualified Data.Map as Map | |
import Data.Map (Map) | |
main :: IO () | |
main = mainWidget test | |
test :: MonadWidget t m => m () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Reflex.Dom | |
import Data.Monoid | |
main :: IO () | |
main = mainWidgetWithHead headWidget bodyWidget | |
headWidget = do | |
elAttr "link" ("href" =: "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" <> "rel" =: "stylesheet" <> "type" =: "text/css") $ return () | |
bodyWidget = do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE RecursiveDo #-} | |
import Reflex | |
import Reflex.Dom | |
import qualified Data.Map as Map | |
import Safe (readMay) | |
import Control.Applicative ((<*>), (<$>)) | |
main = mainWidget $ el "div" $ do | |
nx <- numberInput | |
d <- dropdown "*" (constDyn ops) def |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE RecursiveDo #-} | |
import Reflex.Dom | |
main :: IO () | |
main = mainWidget $ el "div" $ do | |
rec _ <- dynText $ _textInput_value t | |
t <- textInput def | |
return () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE JavaScriptFFI #-} | |
import Reflex.Dom | |
import qualified Data.Text as T | |
import Data.Monoid | |
import GHCJS.Types | |
import GHCJS.Foreign | |
import Control.Monad.IO.Class | |
import Control.Monad | |
import Data.Maybe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE ScopedTypeVariables #-} | |
import Reflex.Dom | |
import GHCJS.DOM.CanvasRenderingContext2D (putImageData, setFillStyle, fillRect) | |
import GHCJS.DOM.HTMLCanvasElement (getContext) | |
import GHCJS.DOM.ImageData (newImageData') | |
import Control.Monad.IO.Class (liftIO) | |
import GHCJS.DOM.Types (CanvasStyle(..), CanvasRenderingContext2D(..), toJSString, castToHTMLCanvasElement) | |
import GHCJS.Marshal (toJSVal) | |
import Data.Time (getCurrentTime) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE TypeFamilies, RecursiveDo, OverloadedStrings #-} | |
import qualified Data.Map as Map | |
import Data.Monoid | |
import Data.Text (Text) | |
import qualified Data.Text as T | |
import Reflex.Dom | |
main :: IO () | |
main = mainWidgetWithHead headWidget bodyWidget |
OlderNewer