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
data Foo = Foo { foo :: Int } | |
x0 = Foo { foo = 3 } -- create | |
x1 = x0 { foo = 4 } -- replace | |
x2 = foo x1 -- access | |
x3 = x1 { foo = foo x1 + 1 } -- apply |
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/perl | |
use strict; | |
use warnings; | |
use lib './'; | |
use Contract; | |
use Contract::Predicate; | |
sub foo { |
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
(require scheme/foreign) | |
(unsafe!) | |
(define strlen_t | |
(_fun (s) :: (s : _string) -> _int)) | |
(define stdlib (ffi-lib #f)) | |
(define strlen | |
(get-ffi-obj "strlen" stdlib strlen_t |
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
foo1 :: Parser Foo | |
foo1 = do | |
bar <- int | |
baz <- int | |
-- This line is boring: | |
return Foo { bar = bar, baz = baz } |
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
-- The coloring is wrong because Github | |
-- doesn't understand TH's quoted names. | |
foo2 :: Parser Foo | |
foo2 = $(doRec 'Foo | |
[ 'bar :- [| int |] | |
, 'baz :- [| 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
#!/bin/sh | |
find ./ -name '*.dwi' \ | |
| xargs -n1 "-d\n" egrep -l 'SINGLE:MANIAC:1[123456789]' \ | |
| xargs -n1 "-d\n" dirname \ | |
| xargs -n1 "-d\n" dirname \ | |
| sort \ | |
| uniq -c \ | |
| sort -nk1 |
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
data Foo = Foo { x :: Int, y :: 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
record "" [d| data Foo = Foo { x :: Int, y :: 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
data IdField a b = IdField { getField :: a -> b, putField :: b -> a -> 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
git clone git://github.com/ktvoelker/state-record.git | |
cd state-record | |
cabal install |
OlderNewer