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 BlockArguments #-} | |
{-# LANGUAGE Rank2Types #-} | |
{-# OPTIONS_GHC -Wall -Werror -Wextra -Wno-name-shadowing #-} | |
module HyperPhases where | |
import Control.Applicative (liftA2) | |
import Data.Functor ((<&>)) | |
newtype Phases f a = Phases |
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 BlockArguments #-} | |
{-# LANGUAGE Rank2Types #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# OPTIONS_GHC -Wall -Werror -Wextra -Wno-name-shadowing #-} | |
module HyperList where | |
import Data.Function ((&)) | |
newtype a -&> b = Hyp {invoke :: (b -&> a) -> b} |
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
// gcc -o try-catch-ex try-catch.c try-catch-ex.c | |
#include <stdio.h> | |
#include "try-catch.h" | |
// Example of use for try-catch.h | |
int main(int argc, char *argv[]) | |
{ | |
int i = 101; | |
printf("before try block...\n"); |
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
#![allow(incomplete_features)] | |
#![feature(generic_associated_types)] | |
use std::marker::PhantomData; | |
macro_rules! do_notation { | |
(| $ty:ty | pure $e:expr) => { | |
<$ty>::pure($e) | |
}; | |
(| $ty:ty | $e:expr) => { | |
$e |
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 BangPatterns #-} | |
{-# LANGUAGE BlockArguments #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE ImportQualifiedPost #-} | |
{-# LANGUAGE LambdaCase #-} | |
{-# LANGUAGE Rank2Types #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE StandaloneDeriving #-} | |
{-# LANGUAGE StandaloneKindSignatures #-} |
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 #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE StandaloneDeriving #-} | |
module RedBlackTree where | |
data Zero | |
data Succ n | |
type One = Succ Zero | |
data Black |
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 TypeOperators #-} | |
-- inspired by "Why concatenative programming matters." | |
-- (http://evincarofautumn.blogspot.com/2012/02/why-concatenative-programming-matters.html) | |
-- | |
-- playing with adapting row polymorphism to Haskell, because, hey, why not? | |
module RowPolymorphism.Primitives ( | |
(:>)(), Stack, | |
lift, quote, (!), | |
dip, dup, over, swap, drop, call | |
) where |
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
# clean up any backups not used in the past 7 days out of the ~/.backup directory | |
@daily find ~/.backup -type f -name '*;*' -not \( -atime 0 -or -atime 1 -or -atime 2 -or -atime 3 -or -atime 4 -or -atime 5 -or -atime 6 \) -delete |
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 TypeOperators #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
module HFilter where | |
data a :* b = a :* b | |
deriving (Show, Eq) | |
infixr 5 :* | |
hlist :: Int :* String :* Int :* Maybe Float :* () |
NewerOlder