This file contains hidden or 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 TemplateHaskell #-} | |
module A where | |
import Language.Haskell.TH | |
makeType :: String -> DecsQ | |
makeType t = do | |
let name = mkName t | |
pure [DataD [] name [] Nothing [NormalC name []] []] |
This file contains hidden or 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
diff --git a/.gitignore b/.gitignore | |
index cdc3c4d..82f3a88 100644 | |
--- a/.gitignore | |
+++ b/.gitignore | |
@@ -1,4 +1,5 @@ | |
dist | |
+dist-* | |
cabal-dev | |
*.o | |
*.hi |
This file contains hidden or 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 <iostream> | |
#include <sstream> | |
#include <vector> | |
using namespace std; | |
#include <boost/range/algorithm_ext.hpp> | |
#include <boost/range/istream_range.hpp> | |
using namespace boost; | |
int main() { |
This file contains hidden or 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
-- stack --resolver=lts-10.5 script | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE Rank2Types #-} | |
module Write where | |
import Codec.Xlsx | |
import Control.Lens | |
import Control.Monad.State.Strict |
This file contains hidden or 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 <functional> | |
#include <iostream> | |
using namespace std; | |
using namespace std::placeholders; | |
template <typename A, typename B, typename C> | |
function<function<C(B)>(A)> curry(function<C(A, B)> f) { | |
return [=](A a){ return [=](B b){ return f(a, b); }; }; | |
} |
This file contains hidden or 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
{-# OPTIONS_GHC -Wall -Werror -Wno-orphans #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE RankNTypes #-} | |
import Prelude hiding (id, (.)) | |
import Control.Category | |
import Control.Monad.Except | |
import Control.Monad.Trans.Maybe |
This file contains hidden or 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/env stack | |
-- stack --resolver=lts-9.0 script --package=singletons | |
{-# OPTIONS_GHC -Wall -Werror #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE ExistentialQuantification #-} | |
{-# LANGUAGE LambdaCase #-} | |
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE Rank2Types #-} |
This file contains hidden or 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/env stack | |
-- stack --resolver=lts-9.0 script --package=lens --package=template-haskell | |
{-# OPTIONS -Wall -Werror -ddump-splices #-} | |
{-# LANGUAGE DuplicateRecordFields #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE FunctionalDependencies #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE TemplateHaskell #-} |
This file contains hidden or 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
true = lambda x, _: x | |
false = lambda _, y: y | |
lambda_bool = lambda b: [false, true][b] | |
force = lambda f: f() | |
enum = ( | |
lambda start, step, stop: | |
force( |
This file contains hidden or 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 <functional> | |
#include <iostream> | |
using namespace std; | |
void cond(bool condition, function<void()> ifTrue, function<void()> ifFalse) { | |
function<void()> branches[] = {ifFalse, ifTrue}; | |
branches[condition](); | |
} | |
template <typename T> |