Skip to content

Instantly share code, notes, and snippets.


Taine Zhao thautwarm

Block or report user

Report or block thautwarm

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
thautwarm / HKT.hs
Created Jul 24, 2019
HKTs via type classes
View HKT.hs
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE RankNTypes #-}
import Unsafe.Coerce
import Prelude hiding ((>>=))
data App a b
class TypeApp cons k0 k1 | k1 -> cons k0, cons k0 -> k1 where
inj :: k1 -> App cons k0
thautwarm / hkt.ts
Created Dec 12, 2018
higher kinded types implementation
View hkt.ts
interface HKT<K, T>{
interface Monad<M> {
bind: <A, B>(m: HKT<M, A>, k: (a: A) => HKT<M, B>) => HKT<M, B>
return: <A>(a: A) => HKT<M, A>
// ret$: <A>(m: (a: A) => HKT<M, A>) => HKT<M, A>
class Maybe implements Monad<Maybe> {
thautwarm / test.fs
Last active Nov 17, 2018
compelling variable sized struct in LLVM IR
View test.fs
let ``nested push32`` () =
let var = ref None
let var2 = ref None
let var3 = ref None
let arg1 = ref <| Some "arg1"
let arg2 = ref <| Some "arg2"
let type_here = Push32 <| I 32

no macro leads to success:

struct A end
struct B end
function f()
enum1 = A()
enum2 = B()
    let enum_test = enum1
View no nightly
thautwarm /
Last active Jul 1, 2018
LLVM Exception handling
#include <stdio.h>
#include <stdlib.h>

class Object {
  virtual ~Object() {}
You can’t perform that action at this time.