Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View bluescreen303's full-sized avatar

Mathijs Kwik bluescreen303

  • Uithoorn, Netherlands
View GitHub Profile
;; This buffer is for notes you don't want to save, and for Lisp evaluation.
;; If you want to create a file, visit that file with C-x C-f,
;; then enter the text in that file's own buffer.
@bluescreen303
bluescreen303 / TenStrings.idr
Last active August 29, 2015 14:00
auto/default proof search
module TenStrings
import Decidable.Order
%default total
-----------------------------------------------
-- Copied from tpsinnem/libs-misc
-----------------------------------------------
mathijs@bluebook xorg% cd /home/mathijs/Repositories/nix/nixpkgs/pkgs/servers/x11/xorg next 0
mathijs@bluebook ~% cd tmp /home/mathijs 0
mathijs@bluebook tmp% ls -l /home/mathijs/tmp 0
total 6840
drwxr-xr-x 1 mathijs users 14 24 feb 23:17 agda
-rw-r--r-- 1 mathijs users 4905 29 apr 13:59 bla2.js.gz
-rw-r--r-- 1 mathijs users 113719 4 mei 13:11 bla.bc
-rw-r--r-- 1 mathijs users 164560 4 mei 13:13 bla.c
-rw-r--r-- 1 mathijs users 137972 4 mei 13:22 bla.js
drwxr-xr-x 1 mathijs users 18 20 mei 23:58 channel
!function() {
var count = 0;
$(document).ajaxSend(function() { count++; report(); });
$(document).ajaxComplete(function() { count--; report(); });
function report() { if (count > 1) { console.warn('' + count + ' simultaneous ajax calls!'); }}
}();
@bluescreen303
bluescreen303 / hello2.agda
Created February 13, 2013 19:46
First steps with agda
module hello2 where
data ℕ : Set where
zero : ℕ
suc : ℕ → ℕ
one : ℕ
one = suc zero
mathijs@bluebook uhc-stuff% ls -l
total 12
drwxr-xr-x 3 mathijs users 4096 13 aug 18:22 platforms
-rw-r--r-- 1 mathijs users 79 15 aug 07:26 Test.hs
drwxr-xr-x 3 mathijs users 4096 15 aug 07:31 vendor
mathijs@bluebook uhc-stuff% cd vendor
mathijs@bluebook vendor% ./fetchdeps
diff --git a/reactive-banana/src/Reactive/Banana/Internal/CompileModel.hs b/reactive-banana/src/Reactive/Banana/Internal/CompileModel.hs
index a9b78df..c3e07e8 100644
--- a/reactive-banana/src/Reactive/Banana/Internal/CompileModel.hs
+++ b/reactive-banana/src/Reactive/Banana/Internal/CompileModel.hs
@@ -27,12 +27,15 @@ import Reactive.Banana.Model
data InputToEvent = InputToEvent (forall a. InputChannel a -> Event a)
type Compile a b = (InputToEvent -> IO (Event a,b)) -> IO (Automaton a,b)
+
+data Box a = Box { unBox :: a }
@bluescreen303
bluescreen303 / gist:2295402
Created April 3, 2012 20:49
event-depending behaviors
once :: Event t a -> Event t a
once e = let b = stepper True (False <$ e)
in whenE b e
changes' :: Eq a => Event t (a, a) -> Event t a
changes' e = fst <$> filterE (uncurry (/=)) e
stepperP :: a -> Event t a -> (Event t (a, a), Behavior t a)
stepperP acc e = mapAccum acc (withPrev <$> e)
where withPrev x acc = ((x, acc), x)
@bluescreen303
bluescreen303 / gist:2292308
Created April 3, 2012 14:13
wrapping reactive banana
interpretModel :: (forall t. Event t a -> Event t b) -> [[a]] -> [[b]]
interpretModel f xs = map toList $ (unE . f . E) (map Just xs)
where toList :: Maybe [a] -> [a]
toList Nothing = []
toList (Just xs) = xs
runner :: (forall t. Event t a -> Event t b) -> IO ([a] -> IO [[b]])
runner network = do inbox <- newIORef [] -- ref to write events into
outbox <- newIORef . interpretModel network =<< toEvents inbox
return $ step inbox outbox
@bluescreen303
bluescreen303 / config.nix
Created January 19, 2012 21:22
~/.nixpkgs/config.nix
{
packageOverrides = pkgs:
let
haskell = pkgs.haskellPackages_ghc704;
emacs = pkgs.emacs23Packages;
lowPrio = pkgs.lib.lowPrio;
hiPrio = pkgs.lib.hiPrio;
# uhc = haskell.uhc.override {useJSBackend = true; };
uhc = haskell.uhc; # js backend is enabled by default nowadays