Skip to content

Instantly share code, notes, and snippets.

View jhegedus42's full-sized avatar

jhegedus42

  • Helsinki
View GitHub Profile
import Reflex.Dom
main = mainWidget $ el "div" $ do
t <- textInput def
dynText $ _textInput_value t
[nix-shell:~/try-reflex]$ cat source.hs
import Reflex.Dom
import Data.Default
main = mainWidget $ el "div" $ do
t <- textInput def
dynText $ _textInput_value t
[nix-shell:~/try-reflex]$ ghcjs source.hs
[1 of 1] Compiling Main ( source.hs, source.js_o )
clear = FrameBuffer $ (DepthImage @1 1000, ColorImage @1 navy) -- ...
triangleRasterCtx = TriangleCtx CullNone PolygonFill NoOffset LastVertex
colorFragmentCtx = AccumulationContext (DepthOp Less True, ColorOp NoBlending (V4 True True True True))
rasterizeWith = Rasterize
triangles = triangleRasterCtx
cubeVertexStream = Fetch "stream4" Triangles (Attribute "position4" :: Vec 4 Float)
[nix-shell:~/try-reflex/reflex-todomvc]$ codex update
cabal: user error (Saved package config file seems to be corrupt. Try re-running the 'configure' command.)
codex: *warning* falling back on dependency resolution using hackage
Nothing to update.
This is available [here] as a .lhs file.
Let's just deal with the `MaybeT` transformer.
First some imports:
> import Control.Monad
> import Control.Monad.Trans
> import Control.Monad.Trans.Maybe
@js.native
trait Window extends js.Object {
def alert(message: String): Unit = js.native
}
@js.native
@JSName("window")
object W extends Window
In Scala:
@js.native
trait Props extends js.Object {
val value: String = js.native
val items: scala.collection.mutable.Seq[String] = js.native
}
@JSExport
val TestCompB: ReqProps[Props, Unit, Unit, TopNode] =
module Main where
import Prelude
import Data.Foldable (for_)
import Data.String (length, fromCharArray)
import Data.Unfoldable (replicate)
import Control.Monad.Eff
import Control.Monad.Eff.Console (log)
@js.native
trait Props extends js.Object {
var value: String = js.native
var index: Int = js.native
var key: String = js.native
}
case class ScalaProps(val value:String, val index:Int, val key:String)
// how do i convert ScalaProps to Props ?
@jhegedus42
jhegedus42 / Implicit.scala
Created April 8, 2017 20:08
playing around with implicits
import MyProducers.MapProducer
trait Entity
case class Ref[T](id: String)
case class IntEntity(int: Int)
case class StringEntity(s: String)
trait RefResolver {