This file contains hidden or 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 : Text.JSON.Parsec | |
-- Copyright : (c) Galois, Inc. 2007-2009 | |
-- | |
-- Maintainer: Sigbjorn Finne <[email protected]> | |
-- Stability : provisional | |
-- Portability: portable | |
-- | |
-- Parse JSON values using the Parsec combinators. |
This file contains hidden or 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 Automata where | |
import Control.Applicative | |
import Control.Monad.Trans | |
import qualified Data.ByteString as BS | |
import qualified Data.ByteString.Char8 as C | |
import qualified Data.Map as M | |
import Data.List | |
import Data.Word | |
import System.Environment |
This file contains hidden or 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 Automata where | |
import Prelude hiding (id, (.)) | |
import Control.Category | |
import Control.Arrow | |
import qualified Data.Map as M | |
import Data.List (sort) | |
data Automaton b c = Automaton (b -> (c, Automaton b c)) |
This file contains hidden or 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 Visualiser where | |
import Numeric.FFT | |
import Data.Complex | |
test :: [Complex Double] | |
test = concat $ replicate 16 (replicate 8 1.0 ++ replicate 8 (-1.0)) | |
freqs :: [Complex Double] -> [Double] | |
freqs samples = take (n `div` 2) . map (/ fromIntegral n) . map magnitude $ fft samples |
This file contains hidden or 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 Sound.Pulse.Simple | |
main=do | |
s<-simpleNew Nothing "example" Play Nothing "this is an example application" | |
(SampleSpec (F32 LittleEndian) 44100 1) Nothing Nothing | |
simpleWrite s (take 44100 (test 440) ++ take 44100 (test 330) ) | |
simpleDrain s | |
simpleFree s |
This file contains hidden or 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 Text.JSON | |
import Data.Maybe | |
data JSZipper = JSZipper { | |
parent :: Maybe JSZipper, | |
lefts :: [JSValue], | |
hole :: JSValue, | |
rights :: [JSValue] | |
} |
This file contains hidden or 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
<html><head> | |
<title>WebSocket Chat</title> | |
<script type='text/javascript'> | |
if (!window.WebSocket) | |
alert("WebSocket not supported by this browser"); | |
function $() { return document.getElementById(arguments[0]); } | |
function $F() { return document.getElementById(arguments[0]).value; } |
This file contains hidden or 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 program solves the Theme Park Google CodeJam problem at | |
-- http://code.google.com/codejam/contest/dashboard?c=433101#s=p2 | |
-- | |
-- I've tried to make the code clear whilst employing a selection of Haskell library | |
-- functions and idioms. I've also gone for efficiency, probably over optimizing in | |
-- places in order to demonstrate some techniques. | |
module Main where | |
import Data.List |
This file contains hidden or 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 Text.Printf | |
profit :: Integer -> Integer -> [Integer] -> Integer | |
profit cap rides groups | |
| sum groups <= cap = rides * sum groups | |
| otherwise = profit' cap rides (cycle groups) | |
where |
This file contains hidden or 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 Control.Arrow | |
import Data.Array | |
import Data.Char | |
import Data.Bits | |
import Data.Function | |
import Data.List | |
import Data.Maybe | |
type Bark = Array (Int, Int) Bool |