Skip to content

Instantly share code, notes, and snippets.

View davesnx's full-sized avatar

David Sancho davesnx

View GitHub Profile
@davesnx
davesnx / Makefile-help
Last active September 26, 2022 18:22
Print other makefiles commands as help
.PHONY: help # Set default action to be help!
help:
@echo "List of available make commands";
@echo "";
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}';
@echo "";
# Add double ## comments on the same line as the dependencies and will be printed out when running help
# Don't add them if you don't want to appear on help!
@Hirrolot
Hirrolot / CoC.ml
Last active May 26, 2024 00:04
Barebones lambda cube in OCaml
(* The syntax of our calculus. Notice that types are represented in the same way
as terms, which is the essence of CoC. *)
type term =
| Var of string
| Appl of term * term
| Binder of binder * string * term * term
| Star
| Box
and binder = Lam | Pi
```
OCaml compilation pipeline
┌────────────────┐
│ │
│ Source code │
@Hirrolot
Hirrolot / CoC.ml
Last active May 24, 2024 23:57
How to implement dependent types in 80 lines of code
type term =
| Lam of (term -> term)
| Pi of term * (term -> term)
| Appl of term * term
| Ann of term * term
| FreeVar of int
| Star
| Box
let unfurl lvl f = f (FreeVar lvl)
@davesnx
davesnx / index.md
Last active December 4, 2023 14:03
Safer Tailwind with OCaml-derived languages

Safer Tailwind with OCaml-derived languages (OCaml, Reason, ReScript or Melange)

Tailwind is optimised to work with JavaScript/TypeScript ecosystems, but other languages might have good integrations also.

This is the case for OCaml-derived languages that are used to do Frontend development. For the most part, a tighter integration might not be needed and using the Tailwind setup guide and regular classNames with strings is good enought.

let make = (~text) => {
  <h1 className="text-3xl font-bold underline">{React.string(text)}<h1>