Skip to content

Instantly share code, notes, and snippets.

View masaeedu's full-sized avatar

Asad Saeeduddin masaeedu

  • Montreal, QC, Canada
View GitHub Profile
@sjoerdvisscher
sjoerdvisscher / Endofunctors.hs
Last active December 28, 2023 01:54
Another go at implementing polynomial functors a la David Spivak
{-# LANGUAGE GHC2021, GADTs, DataKinds #-}
module Endofunctors where
import Control.Comonad (Comonad(..))
import Control.Comonad.Cofree (Cofree(..))
import Control.Monad (join, ap, void)
import Control.Monad.Free (Free(..))
import Data.Bifunctor (first, second, bimap)
import Data.Functor.Day
import GHC.Generics
@vivshaw
vivshaw / OOOOOoooOOooOoOoo.d.ts
Created October 18, 2021 15:36
👻 Haunted TypeScript 👻
declare namespace ⵔ {
type Ѻ
=never;type ⵔ
= "ⵔ"
type 〇
= "〇"
type O
= 〇
| ⵔ
type o <
@wmertens
wmertens / nix-store-in-git.md
Last active September 7, 2022 19:57
Store Nix store in git

Store Nix store in git

The Nix store is an immutable file tree store, addressed by output hashes ($outhash-$name or $out), but could also be tweaked to be addressed by the content hash of the file tree ($cas).

Git is a content-addressed immutable object store. It is optimized for storing files as blobs and directories as tree objects.

Here we consider using a git repository for deduplicating, compressing and distributing the Nix store. We want to achieve maximum deduplication so we extract small changes from files before storing, so they become more similar.

Method

title author date datePretty description tags
Intro to FP Through λ-Calc Part 1. - Motivating Laziness
Jonathan Lorimer
19/03/2020
Mar 19, 2020
Introduction to Functional Programming Through Lambda Calculus gave a thorough explanation of evaluation in lambda calculus, I found this helped motivate a better understanding of evaluation in haskell!
lambda-calculus

Table of Contents

Parameter m w : Type -> Type.
Parameter fmap_w : forall {a b}, (a -> b) -> w a -> w b.
Parameter fmap_m : forall {a b}, (a -> b) -> m a -> m b.
Parameter pure : forall {a}, a -> m a.
Parameter subst : forall {a b}, (a -> m b) -> m a -> m b.
(* subst = flip (>>=) *)
Parameter extract : forall {a}, w a -> a.
@TOTBWF
TOTBWF / MTLDerivingVia.hs
Last active November 6, 2021 16:59
Deriving MTL classes using -XDerivingVia
-- |
-- Module : Lift
-- Copyright : (c) Reed Mullanix 2019
-- License : BSD-style
-- Maintainer : reedmullanix@gmail.com
--
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE KindSignatures #-}
@Lysxia
Lysxia / F.hs
Created November 20, 2018 22:55
Replay with Freer
{-# LANGUAGE
RankNTypes,
ScopedTypeVariables,
KindSignatures,
GADTs
#-}
import Data.Foldable (for_)
import System.IO (hFlush, stdout)
@Brainiarc7
Brainiarc7 / clevo-p75xdm2-g-linux-install.md
Last active December 1, 2022 21:02
How to set up Ubuntu 18.04LTS on the Clevo P751/2DM2-G DTRs and workarounds to issues you may face.

Running Linux on the Clevo P750/1DM2-G DTR

Hello, brethren.

This post will detail how to successfully run Linux on the aforementioned notebook, with common traps and exceptions explained.

An overview:

This is an Intel Skylake-based laptop (upgradeable to a Kabylake-grade Desktop processor) with a desktop-class Pascal GPU, the GTX 1070. Switchable graphics (Optimus) is absent, which eliminates a significant burden of running Linux on this machine.

@gabejohnson
gabejohnson / infix.js
Last active December 19, 2018 16:52
Because I'm lazy and mixfix w/ proxies is slow
var isWrapper = Symbol('isWrapper');
function _(arg, args=[], ops=[]) {
const myArgs = args.concat([arg]);
const myOps = ops.slice(0);
const f = ([op]) => (
myOps.push(op),
wrap(arg2 => _(arg2, myArgs, myOps), myArgs, myOps)
);
// see also https://www.npmjs.com/package/subtractiontype.ts
// for literal unions
type Sub0<
O extends string,
D extends string,
> = {[K in O]: (Record<D, never> & Record<string, K>)[K]}
type Sub<