MARK P. JONES
Pacific Software Research Center
Department of Computer Science and Engineering
Oregon Graduate Institute of Science and Technology
(previous Yoneda blog) (reddit) (twitter)
Let's explore the Yoneda lemma. You don't need to be an advanced Haskeller to understand this. In fact I claim you will understand the first section fine if you're comfortable with map
/fmap
and id
.
I am not out to motivate it, but we will explore Yoneda at the level of terms and at the level of types.
/* | |
* Parallel bitonic sort using CUDA. | |
* Compile with | |
* nvcc -arch=sm_11 bitonic_sort.cu | |
* Based on http://www.tools-of-computing.com/tc/CS/Sorts/bitonic_sort.htm | |
* License: BSD 3 | |
*/ | |
#include <stdlib.h> | |
#include <stdio.h> |
-- http://www.cs.ox.ac.uk/ralf.hinze/SSGIP10/AdjointFolds.pdf | |
-- http://www.cs.ox.ac.uk/ralf.hinze/publications/SCP-78-11.pdf | |
-- https://www.cs.ox.ac.uk/people/nicolas.wu/papers/URS.pdf | |
-- https://arxiv.org/pdf/2202.13633.pdf | |
{-# LANGUAGE | |
MultiParamTypeClasses | |
, FunctionalDependencies | |
, GADTs | |
, PolyKinds |
module Grothendieck where | |
open import Level using (_⊔_) | |
open import Function | |
open import Algebra | |
open import Algebra.Structures | |
open import Data.Product | |
import Relation.Binary.EqReasoning as EqReasoning | |
module Sorting where | |
-- See https://www.twanvl.nl/blog/agda/sorting | |
open import Level using () renaming (zero to ℓ₀;_⊔_ to lmax) | |
open import Data.List hiding (merge) | |
open import Data.List.Properties | |
open import Data.Nat hiding (_≟_;_≤?_) | |
open import Data.Nat.Properties hiding (_≟_;_≤?_;≤-refl;≤-trans) | |
open import Data.Nat.Logarithm | |
open import Data.Nat.Induction |
Inspired by "Parsing CSS with Parsec".
Just quick notes and code that you can play with in REPL.
By @kachayev
Ever wonder what happens when you save a file in vim? There's quite a lot more
happening than open
, write
, and close
. I found this out while working on
some code to monitor changed files using the node.js fs.watch
API, which abstracts
(or obscures) Mac OS X's kqueue API.
To find out exactly what vim
is doing when saving a file, we'll use a tool
included with DTrace that reports on another process's system calls. We need
the process ID of vim, which is already open and editing my file:
using System; | |
namespace PureIO { | |
/* | |
C# does not have proper sum types. They must be emulated. | |
This data type is one of 4 possible values: | |
- WriteOut, being a pair of a string and A | |
- WriteErr, being a pair of a string and A | |
- readLine, being a function from string to A |