Skip to content

Instantly share code, notes, and snippets.

View tscholak's full-sized avatar
🚵‍♂️
(>>=) :: m a -> (a -> m b) -> m b

Torsten Scholak tscholak

🚵‍♂️
(>>=) :: m a -> (a -> m b) -> m b
View GitHub Profile
@tscholak
tscholak / jekyll.py
Last active August 29, 2015 14:16 — forked from terencezl/jekyll.py
try:
from urllib.parse import quote # Py 3
except ImportError:
from urllib2 import quote # Py 2
import os
import sys
try:
BLOG_DIR = os.environ['BLOG_DIR']
except KeyError:
cat >local-fix-resolved-bz1353536.te <<'EOF'
module local-fix-resolved-bz1353536 1.0;
require {
type systemd_resolved_t;
type system_dbusd_t;
type chronyd_t;
type unconfined_t;
class dbus { acquire_svc send_msg };
@tscholak
tscholak / typeError.py
Last active April 15, 2017 14:37
`TypeError` when initializing HMC for `ParamMixture` model
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from time import time
import edward as ed
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
@tscholak
tscholak / eff_poop.scala
Last active June 13, 2017 02:38
eff poop
import _root_.cats.data.{Reader, Writer}
import org.atnos.eff._
import org.atnos.eff.all._
import org.atnos.eff.syntax.all._
object poop {
case class T1(s: String)
case class T2(s: String)
case class T3(s: String)
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE GADTs #-}
module Main (main) where

First some boilerplate:

def side_effecty_id(x):
        print(x)
        return x

Now, consider:

lambdas_0 = tuple((lambda x: x >= side_effecty_id(i)) for i in range(10))
tuple(l(5) for l in lambdas_0)
@tscholak
tscholak / constraint_existentials.hs
Created June 16, 2020 13:02
little exercise in constrained existential types
data E (c :: k -> Constraint) (f :: k -> Type) = forall a . c a => E { unE :: f a }
runE :: forall b c f . (forall a . c a => f a -> b) -> E c f -> b
runE g (E a) = g a
-- this says that when I have a value of type 'E c f' where 'c' is a type-level function from kinds to constraints
-- and 'f' is a data type with one kind parameter, then I can apply any function
--
-- @
-- g :: forall a . c a => f a -> b
@tscholak
tscholak / resume.json
Last active September 13, 2020 18:47
{
"$schema": "https://json.schemastore.org/resume",
"meta": { "theme": "stackoverflow" },
"basics": {
"name": "Torsten Scholak",
"label": "Applied research scientist, NLP researcher and project lead at Element AI",
"image": "https://avatars3.githubusercontent.com/u/1568873?s=460&u=65ed466c5b8c624ff7523315b76f56ac40c44696&v=4",
"email": "torsten.scholak@googlemail.com",
"summary": "I'm a researcher, tech and research lead, mentor, developer, and innovator who can drive and guide product-focussed research projects from inception to conclusion.",
"location": {