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 NoMonomorphismRestriction #-} | |
module Main where | |
import Debug.Trace (traceShow) | |
import Data.List (minimumBy, sortBy, genericLength) | |
import Control.Monad ((=<<), liftM, liftM2) | |
import Data.Maybe (fromJust, isJust) | |
import System.IO (hPutStrLn, stderr) | |
import Control.Parallel (par, pseq) |
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 NoMonomorphismRestriction #-} | |
module Main where | |
import Debug.Trace (traceShow) | |
import Data.List (minimumBy, sortBy, genericLength) | |
import Control.Monad ((=<<), liftM, liftM2) | |
import Data.Maybe (fromJust) | |
trace1 x = traceShow x x |
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
/*jsl:option explicit*/ | |
"use strict"; | |
// ///////////////////////////////////////////////////////////////////// | |
// // JQUERY EXTENSIONS | |
/* Removed this part.. */ | |
///////////////////////////////////////////////////////////////////// | |
// STRING FORMATTING |
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 ExistentialQuantification #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE StandaloneDeriving #-} | |
-- | | |
module Main where | |
import Control.Applicative (Alternative(..), (<|>)) | |
import Data.List (foldl', intercalate) | |
import Data.Monoid ((<>)) |
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
// foo :: { 0: Num, 1: Maybe Num } -> Num | |
function foo(a, opt_b) { | |
var b = opt_b == undefined ? 3 : opt_b; | |
return a + b; | |
} | |
// foo here inferred to have this type: | |
// RowFields r Maybe => { 0: Num | r } -> b | |
foo(3); // translated to: foo { 0 = 3 | .. } |
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
foo :: +{ Num : Number, Str : String | r } -> Number | |
function foo(x) { | |
if (typeof x == Number) { .. x is a number here! ...; return 0 } | |
else if (typeof x == String) { .. a string here ..; return 1 } | |
else { .. } | |
} | |
\case x of | |
Num n -> ... ; 0 | |
Str s -> ... ; 1 |
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
;; This buffer is for notes you don't want to save, and for Lisp evaluation. | |
;; If you want to create a file, visit that file with C-x C-f, | |
;; then enter the text in that file's own buffer. | |
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 Bidirectional where | |
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 MagicHash #-} | |
module Main where | |
import Control.Monad | |
import Data.Word (Word64) | |
import qualified Data.ByteString.Char8 as BS8 | |
import Control.DeepSeq | |
import qualified Data.Text.Array as A | |
import GHC.Prim | |
import GHC.Base (Int(..)) |
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
# Next-generation IDE for functional programming | |
# Run it, and press any key to start writing code. | |
# It will automatically exit when you're done writing your function. | |
# Work in progress, currently supports factorial | |
import sys | |
factorial = 'fac n = if n > 1 then n * (fac (n - 1)) else 1'.split() |