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.Monad.Aff.AVar.Select | |
( Select | |
, put | |
, take | |
, select | |
) where | |
import Prelude | |
import Control.Monad.Aff (Aff) |
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 Grammar where | |
import Prelude | |
import Control.Applicative.Free (FreeAp, liftFreeAp, foldFreeAp) | |
import Control.Alt (class Alt, (<|>)) | |
import Control.Alternative (class Alternative) | |
import Control.Monad.Eff (Eff) | |
import Control.Monad.Eff.Console (log, CONSOLE) | |
import Control.Plus (class Plus, empty) |
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 Main where | |
import Prelude | |
import Control.Monad.Eff (Eff) | |
import Control.Monad.Eff.Class | |
import Control.Monad.Aff (launchAff, Aff, makeAff, attempt) | |
import Control.Monad.Aff.Console (CONSOLE, log) | |
import Control.Monad.Eff.Exception (Error, try) | |
import Control.Monad.Except.Trans (ExceptT(..), runExceptT) | |
import Network.HTTP.Affjax as Ajax |
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 Main where | |
import Prelude | |
class Thunked a | |
instance thunkedAll :: Thunked a | |
type Thunk b = forall a. Thunked a => b |
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 Main where | |
import Prelude | |
import Control.Monad.Eff (Eff) | |
import Data.List (List(..), (:)) | |
import Data.Maybe (Maybe(..)) | |
import Halogen (ParentState, parentState, ParentQuery, Component, parentComponent, ParentHTML, Natural, ParentDSL, HalogenEffects, runUI) | |
import Halogen.HTML as H | |
import Halogen.Util (runHalogenAff, awaitBody) | |
import Unsafe.Coerce (unsafeCoerce) |
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
arg |> foo[0].bar(42) | |
|> baz("hello", "there") | |
|> quux.foo().bar() | |
|> new Foo() | |
// Expands to: | |
// new Foo(quux.foo().bar(baz('hello', 'there', foo[0].bar(42, arg)))); | |
arg |> foo() |> bar | |
// SyntaxError: [|>] Expected function call | |
// 31: arg |> foo() |> bar |
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
macro constexpr { | |
rule { ($e:expr) } => { | |
(function() { | |
macro cexpr { | |
case { _ } => { | |
return [makeValue($e, #{ here })]; | |
} | |
} | |
return cexpr; | |
}()) |
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
test = map ((*) 2) >>> filter ((>) 15) >>> drop 3 >>> map show | |
src1 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] | |
src2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | |
res1 = transduce' test src1 :: [String] | |
res2 = transduce' test src2 :: List String |
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.Global (importLib) where | |
foreign import importLib | |
"function importLib(node) {\ | |
\ return function(global) {\ | |
\ if (typeof require !== 'undefined' && typeof process !== 'undefined') {\ | |
\ return require(node);\ | |
\ } else {\ | |
\ return window[global];\ | |
\ }\ |
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
macro protocol { | |
case { _ $name:ident { $fn:protocol_fn ... } } => { | |
// Probably not a good idea to rely on `__fresh`. Sweet.js should provide | |
// some sort of blessed gensym capability. | |
letstx $id = [makeValue(__fresh(), #{ here })]; | |
return #{ | |
function $name(proto, impl) { | |
if (!impl) { | |
impl = proto; | |
proto = {}; |