Suppose we want to write a simple function f
to calculate the sum of the squares of the even numbers in a list. We can start by writing down some examples of expected inputs and outputs.
f [] == 0
f [2] == 4
f [3] == 0
f [4] == 16
f [2, 4] == 20
class (Monad m) => PureMonad m where | |
run :: m a -> a | |
instance PureMonad Maybe where | |
run = fromJust | |
instance PureMonad (Either a) where | |
run = fromRight | |
instance PureMonad [] where |
import Control.Monad.Trans.Cont | |
import GHC.Exts (IsString(..)) | |
instance (Num a) => Num (ContT r m a) where | |
fromInteger x = ContT (\k -> k (fromInteger x)) | |
{- | |
fromInteger = ContT . flip ($) . fromInteger | |
-} |
This is an annotated EBNF grammar of the latest rewrite of Kitten. Items marked with a dagger (†) are explained in the surrounding prose, not in EBNF.
The source column of a token is the offset to its first character within the line in which it appears. The indentation of a line is the source column of the first token in the line. Tab characters are illegal.
An expression beginning with a left arrow (<-
) inside a do
block statement is desugared to a monadic binding. This is syntactically a superset of existing Haskell, including extensions. It admits a clean notation that subsumes existing patterns and comes with few downsides.
do
f (<- x) (<- y)
-- ===
# cmake CMAKE_TOOLCHAIN_FILE=".../linux-i686.toolchain.cmake" .../rr | |
set(CMAKE_SYSTEM_NAME Linux) | |
set(CMAKE_SYSTEM_ARCHITECTURE i686) | |
set(CMAKE_C_COMPILER gcc -m32) | |
set(CMAKE_CXX_COMPILER g++ -m32) |
#include <iostream> | |
using namespace std; | |
#define CHECK_ASSUMPTIONS 0 | |
#if CHECK_ASSUMPTIONS | |
#define ASSUMING(...) __VA_ARGS__ | |
#else | |
#define ASSUMING(...) | |
#endif |
#!/usr/bin/env perl | |
# Usage: ./most-included.pl $(find mono -name '*.h') | |
use warnings; | |
use strict; | |
my %forward = (); | |
while (<>) { |
Building: Shared (Debug) | |
Building: XamarinAndroid (Debug) | |
Build started 2/24/2015 1:06:44 PM. | |
__________________________________________________ | |
Project "/Users/jonathanpurdy/Projects/Mobile-App-Performance/Xamarin/XamarinAndroid/XamarinAndroid.csproj" (Build target(s)): | |
Initial Properties: | |
__CF_USER_TEXT_ENCODING = 0x1F5:0:0 |
Git submodules updated successfully | |
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-recursive | |
Making all in po | |
Making all in mcs | |
make[3]: Nothing to be done for `all-am'. | |
Making all in libgc | |
Making all in m4 | |
make[3]: Nothing to be done for `all'. | |
Making all in include | |
Making all in private |