Skip to content

Instantly share code, notes, and snippets.

View masaeedu's full-sized avatar

Asad Saeeduddin masaeedu

  • Montreal, QC, Canada
View GitHub Profile

Thank you for the helpful response and pointers. I think I need to take my time to sort this out, thanks a lot and I'll come back with a better understanding, hopefully!

I did my homework. Now I'm not so certain about everything, so please take this with a grain of salt.

Typescript's generic functions seem to act like they're contravariant over the type parameter's type bound. I'm not entirely sure though.

Playground Link

// Assignment succeeds with F<unknown> -> F<string>
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedLists #-}
{-# OPTIONS_GHC -Wall #-}
module Lib where
import Control.Category ((<<<))
import Data.Function (fix)
import Data.Map (Map)
import qualified Data.Map.Lazy as Map
// Utils
const range = n => [...Array(n).keys()];
const add = ([x0, y0]) => ([x1, y1]) => [x0 + x1, y0 + y1];
const rotate = θ => ([x, y]) => [
Math.round(x * Math.cos(θ) - y * Math.sin(θ)),
Math.round(x * Math.sin(θ) + y * Math.cos(θ))
];
const map = f => g =>
function*() {
for (const v of g()) {
@masaeedu
masaeedu / init-haskell.sh
Last active May 20, 2021 15:24
Basic nix haskell setup
#!/usr/bin/env bash
set -Eeuxo pipefail
# Set up git
git init
gitignore haskell
echo '*.cabal' >> .gitignore
# Set up niv
niv init
type AccessorAndId<D> =
| {accessor: keyof D}
| {id: string; accessor: AccessorFunction<D>}
export type Column<D = any> = Partial<Column.Basics> &
Partial<
Column.CellProps & Column.FilterProps & Column.FooterProps & Column.HeaderProps
> &
AccessorAndId<D> & {
/**
* Property name as string or Accessor
@masaeedu
masaeedu / shittyvariadics.cs
Last active November 30, 2020 13:53
Variadic experiments
using System;
using System.Linq.Expressions;
using VMware.Vim;
namespace AgentAutomation.VimExtensions
{
class Foo
{
static void Main()
{

Keybase proof

I hereby claim:

  • I am masaeedu on github.
  • I am masaeedu (https://keybase.io/masaeedu) on keybase.
  • I have a public key ASBe0DwlBA8JuW1EKQW4eiCL4MVe9K-N9w8IXcVi0PlfSgo

To claim this, I am signing this object:

module Categories where
open import Level
open import Function hiding (id; _∘_)
open import Data.List
open import Data.Bool
open import Data.Product
@masaeedu
masaeedu / multicategory.agda
Last active August 23, 2020 01:16
multicategory.agda
module multicategory where
open import Level
open import Data.List
open import Data.Product
open import Function
open import Agda.Builtin.Equality
data Pullback {ℓ} {a b c : Set ℓ} (f : a → c) (g : b → c) : Set ℓ
where