Skip to content

Instantly share code, notes, and snippets.

Tom therewillbecode

Block or report user

Report or block therewillbecode

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View next.config.js
const withTM = require('next-transpile-modules');
const withOffline = require('next-offline');
const withSass = require('@zeit/next-sass');
const isDev = process.env.NODE_ENV !== 'production';
const isProd = process.env.NODE_ENV === 'production';
const disableServerless = Boolean(process.env.DISABLE_SERVERLESS);
const baseTarget = disableServerless ? {} : { target: 'serverless' };
View gist:231910862f99db77b737d732769195ac
let
pkgs = import <nixpkgs> {};
overridez = fetchTarball {
patchFlags = [ "--binary" ];
url = "https://github.com/adetokunbo/haskell-overridez/archive/v0.10.3.0.tar.gz";
sha256 = "1mfnjksb0n3jbbsqi7g7jd3qn0c10s5q4dg1lqx3fhqw46yvr7j7";
};
in
import overridez { inherit pkgs; }
View default.nix
{ system ? builtins.currentSystem, compiler ? "ghc844" } :
let
overridez = import ./nix/haskell-overridez.nix;
overlays = [
(newPkgs: oldPkgs: {
haskellPackages = oldPkgs.haskellPackages.override {
overrides = overridez.allIn ./nix;
patchFlags = [ "--binary" ];
};
View gist:dd28ac7a03a3066886d69675c7b6ec5e
setting SOURCE_DATE_EPOCH to timestamp 1465036472 of file authenticate-oauth-1.6/Web/Authenticate/OAuth/IO.hs
patching sources
Replace Cabal file with edited version from http://hackage.haskell.org/package/authenticate-oauth-1.6/revision/1.cabal.
compileBuildDriverPhase
setupCompileFlags: -package-db=/build/setup-package.conf.d -j4 -threaded
[1 of 1] Compiling Main ( Setup.lhs, /build/Main.o )
unpacking sources
unpacking source archive /nix/store/vnan6xar42hf2pabl7apwscqnd9w75zr-beam-core-0.7.2.3.tar.gz
source root is beam-core-0.7.2.3
setting SOURCE_DATE_EPOCH to timestamp 1549648350 of file beam-core-0.7.2.3/test/Database/Beam/Test/Schema.hs
View typePoker.hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE KindSignatures #-}
@therewillbecode
therewillbecode / Poker.hs
Last active May 13, 2019
typelevel stuff
View Poker.hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE KindSignatures #-}
import GHC.TypeLits (Symbol)
View Interpreter.hs
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
module Interpreter where
import Control.Monad
@therewillbecode
therewillbecode / array_ptr.wat
Last active Apr 18, 2019
Array with Pointer in Webassembly
View array_ptr.wat
(module
;; Requires that we have at least 1 page of memory available (64kb)
(import "env" "memory" (memory $mem 1))
;; Declare a global variable representing a pointer initalised to index 0 -
;; each element is a 32bit integer and thus 4 bytes wide
(global $ptr (mut i32) (i32.const 0))
(func $get_ptr (result i32)
get_global $ptr
@therewillbecode
therewillbecode / array.wat
Created Apr 14, 2019
Webassembly 32 bit Int Array Example
View array.wat
(module
(memory 1)
(func $load_num (param $index i32) (result i32)
(i32.mul (get_local $index) (i32.const 4))
i32.load
)
(func $store_num (param $index i32) (param $num i32)
(i32.mul (get_local $index) (i32.const 4))
get_local $num ;; value to store
i32.store
@therewillbecode
therewillbecode / adts.md
Last active Dec 11, 2017
Haskell Types
View adts.md

Introduction to Algebraic Data Types in Haskell

Constructor Functions vs Normal Functions

Constructor functions are the kinds of functions used to create types and values.

Constructor functions are different from normal functions in the sense that once they have had their arguments applied they are fully evaluated.

They have no equation or body so to speak. For example the value constructor Just 5 is a value just like 5 is except it has a different type.

You can’t perform that action at this time.