Skip to content

Instantly share code, notes, and snippets.

View KirinDave's full-sized avatar

Dave Fayram KirinDave

View GitHub Profile
package stupid
import (
"fmt"
"reflect"
"unsafe"
)
type iptr struct {
data SomeThing = SomeThing { name :: Text, age :: Int }
makeSomeThing :: (Monad m) => m Text -> m Int -> m SomeThing
makeSomeThing nameE ageE = do
name <- nameE
age <- ageE
return $ SomeThing name age
@KirinDave
KirinDave / DictTrick.hs
Created May 25, 2018 17:35 — forked from jship/DictTrick.hs
Small example showing the Dict trick to discover available instances from a GADT
#!/usr/bin/env stack
-- stack --resolver lts-10.8 --install-ghc exec ghci
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE LambdaCase #-}
-- A key type for pretend use in looking up a doggo in a database.
newtype Key a = Key { unKey :: String }
{-# Language DeriveFunctor, FlexibleInstances #-}
module Lib where
newtype Mu f = Mu (f (Mu f))
data ArithF f =
ALit Int |
AAdd f f |
ASub f f deriving Functor
@KirinDave
KirinDave / stack-shell.bash
Created June 22, 2018 15:16
How to make stack manage ghc for you
stack exec --no-ghc-package-path --resolver ghc-8.4.3 --package cabal-install zsh
@KirinDave
KirinDave / copyfile.sh
Created February 21, 2019 02:47
OSC 52 CopyFile Script
#!/bin/bash
# Convenient when you're using lots of in-browser terminals.
set -eu
MAXLEN=74994
TARGET=$1
if [ -f $TARGET ]; then
@KirinDave
KirinDave / crash.txt
Created August 15, 2020 20:02
Crash log, ATM5
---- Minecraft Crash Report ----
// Daisy, daisy...
Time: 8/15/20 12:52 PM
Description: Unexpected error
java.lang.NullPointerException: Registry Object not present: mahoutsukai:murky_flow
at java.util.Objects.requireNonNull(Unknown Source) ~[?:1.8.0_171] {}
at net.minecraftforge.fml.RegistryObject.get(RegistryObject.java:120) ~[?:?] {re:classloading}
at stepsword.mahoutsukai.util.Utils.isInMurkyWater(Utils.java:158) ~[?:1.15.2-v1.21.6] {re:classloading}