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
Using cabal to install quickcheck: | |
Make a directory to work in. | |
Inside the directory: “cabal sandbox init” | |
Then: “cabal install quickcheck” | |
You can open the GHCI repl in the sandbox: | |
"cabal repl" | |
And use normal commands like ":load filename.hs" |
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 IObservable<T> ExecuteQuery<T>(TableQuery<T> query, TableRequestOptions requestOptions = null, OperationContext operationContext = null) where T : ITableEntity, new() | |
{ | |
return Observable.Create<T>( | |
async (observer, ct) => | |
{ | |
var tableToken = new TableContinuationToken(); | |
while (tableToken != null) | |
{ | |
var results = await ExecuteQuerySegmented(query, tableToken, requestOptions, operationContext, ct); | |
foreach (var result in results) |
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
listContainers :: HTTP.Manager -> AccountName -> P.Producer ByteString IO () | |
listContainers manager account = do | |
req <- P.lift $ fillOutTemplate template -- does some IO to fill out the request | |
let req' = Auth.signRequest account req | |
join $ P.lift $ HTTP.withHTTP req' manager $ \resp -> | |
return (P.for (HTTP.responseBody resp) P.yield) |
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 ConstraintKinds #-} | |
{-# LANGUAGE ExistentialQuantification #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE KindSignatures #-} | |
import GHC.Exts (Constraint) | |
data Exists (t :: * -> Constraint) = forall a. t a => Exists a |
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
using System; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace AsyncCLI | |
{ | |
public sealed class Program | |
{ | |
// Main handles command line parsing and invocation | |
// of strongly-typed main method. |
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
-- from https://gist.github.com/anonymous/83b1f8d2da6ee35d172b | |
import Data.Bits ((.&.), shiftR) | |
import Data.Char (chr) | |
import Data.Ratio ((%), Ratio, numerator) | |
import Data.Word (Word32) | |
poly :: Ratio Integer -> Ratio Integer | |
poly x = | |
- 74101463560860539810482394216134472786413399%404009590666424903383979388988167534591844018460526499864038804741201731572423877094984692537474105135297393596654648304117684895744000000000000000000000*x^99 |
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
#include "stdafx.h" | |
#include <atomic> | |
#include <iostream> | |
#include <mutex> | |
#include <typeindex> | |
#include <typeinfo> | |
#include <unordered_map> | |
// here is the global mapping of type -> counts: |
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
using System; | |
namespace Foob | |
{ | |
interface IEater | |
{ | |
void Eat(); | |
bool CanEat { get; } | |
} |
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
open System | |
module IOMonad = | |
// wooh, naming conventions! | |
// this is the interface for our IO implementations | |
type IIO = | |
abstract member printLineImpl : string -> unit | |
abstract member getLineImpl : unit -> 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
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE TypeOperators #-} | |
data HList :: [*] -> * where | |
HNil :: HList '[] | |
HCons :: a -> HList k -> HList (a ': k) |