Skip to content

Instantly share code, notes, and snippets.

@purefunctor
purefunctor / racket-chez.rb
Created September 22, 2022 11:38
Homebrew formula for building Chez Scheme on Apple Silicon
class RacketChez < Formula
desc "Implementation of the Chez Scheme language"
homepage "https://cisco.github.io/ChezScheme/"
url "https://github.com/racket/ChezScheme", :using => :git, :tag => "racket-v8.6"
sha256 "a344c46c9b40d8f4695bdbe82b7802da05ffe7ad2c8ffc16747dd84f02c38964"
license "Apache-2.0"
depends_on "ncurses"
def install
@purefunctor
purefunctor / Main.purs
Created November 4, 2021 15:02
Collecting instantiated type class methods into an array.
module Main where
import Prelude
import Data.Array
import Debug
import Type.Prelude
import Type.Row
import Type.RowList
import Unsafe.Coerce
import Partial.Unsafe
@purefunctor
purefunctor / ToU.idr
Last active October 15, 2021 11:46
ToU.idr
module Infer
data Foo : (xs : List (String, Type)) -> Type where
MkFoo : Foo xs
mkFoo : {xs : List (String, Type)} -> Foo xs
mkFoo = MkFoo
foo : ? -- Foo ?xs
foo = mkFoo {xs = [("Foo", Int), ("Bar", Nat)]}
@purefunctor
purefunctor / Main.purs
Created September 18, 2021 04:06
`cata` and `transCata`
module Main where
import Prelude
import Matryoshka
import Effect (Effect)
import Effect.Console (logShow)
import Data.Functor.Mu (Mu(..))
data ListF a n = NilF | ConsF a n
@purefunctor
purefunctor / Main.purs
Created August 15, 2021 19:54
PureScript Module Shadowing
module Main where
import Prelude
import Effect (Effect)
import Effect.Console (log)
data Effect_Console = Effect_Console
main :: Effect Unit
@purefunctor
purefunctor / Main.purs
Created July 27, 2021 03:50
PureScript `waitFor` combinator for Aff
module Main where
import Prelude
import Data.Either (Either)
import Data.Int (round)
import Effect (Effect)
import Effect.Aff (Aff, Milliseconds(..), attempt, delay, error, forkAff, joinFiber, killFiber, launchAff_)
import Effect.Class (liftEffect)
import Effect.Class.Console (logShow)
from typing import Generic, overload, Literal, TypeVar, Union
_Head = TypeVar("_Head")
_Tail = TypeVar("_Tail")
class HeadTuple(Generic[_Head, _Tail]):
def __init__(self, head: _Head, *tail: _Tail) -> None:
self._head = head

Keybase proof

I hereby claim:

  • I am purefunctor on github.
  • I am purefunctor (https://keybase.io/purefunctor) on keybase.
  • I have a public key ASCMMHUzQ7cIe7K2p0_1VjvWVyy4hUo1ky916apWPEJh3wo

To claim this, I am signing this object:

@purefunctor
purefunctor / config.el
Last active December 24, 2020 16:55
Doom Emacs bodge for zsh/oh-my-zsh and emacs-libvterm
;; Terrible code, I know
;; Reference: https://github.com/akermu/emacs-libvterm/issues/24
(after! vterm (progn (defun vterm--kill-vterm-buffer-and-window (process _)
"Kill buffer and window on vterm process termination."
(when (not (process-live-p process))
(let ((buf (process-buffer process)))
(when (buffer-live-p buf)
(with-current-buffer buf
(kill-buffer)
(ignore-errors (delete-window))
@purefunctor
purefunctor / init.vim
Created November 22, 2020 06:41
Activate Pipenv or Poetry environments when using `pyright` in `nvim-lspconfig`
let g:old_path = ""
function CheckPoetry()
let s:poetry = system("poetry env list --full-path")
if v:shell_error
return ""
else
return substitute(s:poetry, " (Activated)\n", "", "") . "/bin:"
endif