Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Taine Zhao thautwarm

🎯
Focusing
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
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
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
thautwarm / test.fs
Last active Nov 17, 2018
compelling variable sized struct in LLVM IR
View test.fs
[<Fact>]
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
View macro_esc_failed.md

no macro leads to success:

struct A end
struct B end
function f()
enum1 = A()
enum2 = B()
begin
    let enum_test = enum1
        begin
View no nightly
https://play.rust-lang.org/?gist=36c36edf00f2c903727ce881bd4e7ae9&version=stable&mode=debug&edition=2015
@thautwarm
thautwarm / llvm-exc.md
Last active Jul 1, 2018
LLVM Exception handling
View llvm-exc.md
#include <stdio.h>
#include <stdlib.h>

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