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 DeriveFunctor #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
import Control.Monad | |
import Control.Monad.Identity | |
import Control.Monad.Writer | |
import Control.Monad.State | |
import Control.Arrow | |
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
testcase.js | |
/* | |
* Demo func | |
* @param {yes:function()} config | |
*/ | |
function foo(config){ | |
if(config.yes()){ | |
return true; | |
} else { |
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
var Unifier = (function(){ | |
function Unifier(){ | |
this.bindTable = {}; | |
} | |
/******************************************************************************* | |
* Unify two terms. | |
* |
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
//////////////////////////////////////////////////////////////////////////////// | |
// Simple logic demo, no point in it. But just 'cuz. | |
var Unifier = require('./unifier.js'); | |
var unify = Unifier.unify; | |
var parse = Unifier.parse; | |
/***************************************************************************** | |
* A simple logic language querier. |
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
//////////////////////////////////////////////////////////////////////////////// | |
// Simple unifier. | |
/******************************************************************************* | |
* Unifier two terms. | |
* term1: result of parse() | |
* term2: result of parse() | |
* frame: (optional) use an existing unification frame | |
*/ | |
var unify = exports.unify = function(config){ |
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
/******************************************************************************* | |
* Main entry point. | |
*/ | |
$(document).ready(function(){ | |
setupErrors(); | |
setupDates(); | |
setupAutoHide(); | |
setupManageItems(); | |
setupConfirms(); | |
}); |
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 Data.AttoLisp | |
import Language.Haskell.Exts | |
main = interact (result (error . show) (encode . transform) . parseExp) | |
result _ g (ParseOk o) = g o | |
result f _ fail@ParseFailed{} = f fail | |
transform = undefined |
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 Data.Aeson | |
import Data.Attoparsec.Number | |
import Data.ByteString.Lazy (ByteString) | |
import qualified Data.ByteString.Lazy as Bytes | |
import qualified Data.ByteString as Strict | |
import Data.Function | |
import qualified Data.HashMap.Lazy as Map | |
import Data.Int | |
import Data.List | |
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
chris@midnight:~/Projects/me/fay$ dist/build/fay/fay src/Benchmarks.hs --no-ghc && node src/Benchmarks.js && echo "- With optimizations- " && echo && dist/build/fay/fay src/Benchmarks.hs --no-ghc -O && node src/Benchmarks.js | |
Running benchmark “sum 1000000 0” ... | |
Recording ... | |
Results: 534ms 535ms 534ms 535ms 566ms | |
Mean 540.8ms, Min 534ms, Max 566ms, Stddev 12.607934009979589 | |
Forcing the list ... | |
Running benchmark “length [1..1000000]” ... | |
Recording ... |
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 FlexibleInstances #-} | |
-- | Monoids with holes. The 'HoleyMonoid' allows building monoidal values of which certain components are to be filled in later. For example: | |
-- | |
-- > > let holey = now "x = " | |
-- > . later show | |
-- > . now ", y = " | |
-- > . later show | |
-- > > run holey 3 5 | |
-- > "x = 3, y = 5" | |
-- |