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
module Control.Coroutine.Aff.Utils where | |
import Prelude | |
import Control.Coroutine (Producer, consumer, runProcess, ($$)) | |
import Control.Coroutine.Aff (close, emit, produceAff) | |
import Control.Monad.Trans.Class (lift) | |
import Data.Maybe (Maybe(..)) | |
import Effect.Aff (Aff, forkAff, parallel, sequential) | |
import Effect.Aff.AVar as AV |
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
ticker :: Aff _ Unit | |
ticker = do | |
v1 <- makeEmptyVar | |
_ <- forkAff $ forever $ delay (Milliseconds 1000.0) *> putVar unit v1 | |
v2 <- makeEmptyVar | |
_ <- forkAff $ forever $ delay (Milliseconds 1000.0) *> putVar unit v2 | |
v3 <- liftAff makeEmptyVar |
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
module Concur.VDom where | |
import Prelude | |
import Control.Alt (alt) | |
import Control.Alternative (class Alternative, (<|>)) | |
import Control.Monad.Aff (forkAff, launchAff_) | |
import Control.Monad.Aff.AVar (makeEmptyVar, makeVar, putVar, takeVar) | |
import Control.Monad.Aff.Class (class MonadAff, liftAff) | |
import Control.Monad.Eff (Eff) |
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
#lang typed/racket | |
(provide (all-defined-out)) | |
(define-type Stream (Listof Char)) | |
(struct: Success ([match : Any] [rest : Stream]) #:transparent) | |
(struct: Fail () #:transparent) | |
(define-type Result (U Success Fail)) |
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
toHtml = (x) -> | |
if $.isArray x | |
if typeof x[0] is not \string then return map(toHtml, x).join('') | |
switch x.length | |
case 3 | |
"<#{x[0]} #{objToAttrs(x[1])}>#{toHtml(x[2])}</#{x[0]}>" | |
case 2 | |
"<#{x[0]}>#{toHtml(x[1])}</#{x[0]}>" | |
case 1 | |
"<#{x[0]}/>" |
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
(context | |
(lambda (test) | |
(test "hello"))) | |
;; I would like this to transform to the above | |
(group | |
(test "hello")) |
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
# I'd like the inner object's methods to have access to Module's `inside` slot. | |
# The new lexicalDo won't cut it since the proto is long gone when the | |
# block/method gets called. | |
Module := Object clone do( | |
inside := 2 | |
Test := Object clone lexicalDo( | |
num := method(inside) | |
numblock := block(inside) setIsActivatable(true) |
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
Protos AssertionException := Exception clone | |
Object do( | |
assert := method(v, m, | |
if(true != v, | |
m ifNil(m = "true != (#{ call argAt(0) })" interpolate) | |
AssertionException raise(m) | |
) | |
) |
NewerOlder