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.SBV | |
import Control.Applicative ((<$>)) | |
import Prelude hiding (sum, count) | |
------------------------------------------------------------------------ | |
main :: IO () | |
main = do | |
x <- satWith z3 { timing = True, smtFile = Just "smt.txt" } program |
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
#!/usr/bin/env runghc | |
import Data.List | |
import System.Environment | |
import System.Process | |
import System.Random | |
main :: IO () | |
main = do | |
args <- getArgs |
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 Collect | |
export value collectInit : Nat# -> Unit; | |
export value collectHeap : Addr# -> Addr# -> Addr# -> Addr# -> Unit; | |
import foreign c value | |
malloc : Nat# -> Addr#; | |
import foreign c value | |
formatOfObject : [r : Region].Ptr# r Obj -> Nat#; | |
import foreign c value |
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 GADTs | |
, FlexibleInstances | |
, RebindableSyntax | |
, DeriveFunctor | |
, RebindableSyntax | |
, OverloadedStrings #-} | |
import Control.Monad.Free | |
import Control.Monad | |
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
-- Solve for the maximum/minimum number of menu items adding up to $15.05 | |
-- http://xkcd.com/287/ | |
xkcd :: Direction -> Program String String IntDouble | |
xkcd dir = program dir | |
( z1 mf .+. | |
z1 ff .+. | |
z1 ss .+. | |
z1 hw .+. | |
z1 ms .+. | |
z1 sp ) |
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
getVarInt32 :: Unpacking Word32 | |
getVarInt32 = go step (stepLast "getVarInt32: varint was larger than 32-bits") 0 | |
where | |
go :: (Int -> b -> b) -> (Int -> b) -> b | |
go !s !sl = s 0 . s 7 . s 14 . s 21 $ sl 28 | |
{-# INLINE go #-} | |
{-# INLINE getVarInt32 #-} | |
getVarInt64 :: Unpacking Word64 | |
getVarInt64 = go step (stepLast "getVarInt64: varint was larger than 64-bits") 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
#!/bin/bash | |
# Options / Usage | |
# put this script in the same directory as your *.cabal file | |
# it will use the first line of "cabal info ." to determine the package name | |
# custom options for "cabal haddock" (cabal haddock --help, | |
# http://www.haskell.org/haddock/doc/html/invoking.html) | |
CUSTOM_OPTIONS=(--haddock-options='-q aliased') | |
# hackage server to upload to (and to search uploaded versions for) |
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
<?xml version="1.0" encoding="utf-16"?> | |
<kml xmlns="http://www.opengis.net/kml/2.2"> | |
<Document> | |
<Placemark><name>Crosses itself</name><styleUrl>#S6</styleUrl> | |
<Polygon> | |
<outerBoundaryIs> | |
<LinearRing> | |
<coordinates> | |
-92.3941429892949,29.443662005645,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
public sealed class ImmutableList<T> : IList<T>, IList | |
{ | |
private readonly T[] m_Items; | |
public ImmutableList(IEnumerable<T> source) | |
{ | |
m_Items = source.ToArray(); | |
} | |
public T[] ToArray() |
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
// *** First of all the Favicon.js *** | |
// Favicon.js - Change favicon dynamically [http://ajaxify.com/run/favicon]. | |
// Copyright (c) 2006 Michael Mahemoff. Only works in Firefox and Opera. | |
// Background and MIT License notice at end of file, see the homepage for more. | |
// USAGE: | |
// * favicon.change("/icon/active.ico"); (Optional 2nd arg is new title.) | |
// * favicon.animate(new Array("icon1.ico", "icon2.ico", ...)); | |
// Tip: Use "" as the last element to make an empty icon between cycles. |