Skip to content

Instantly share code, notes, and snippets.

View kvverti's full-sized avatar

Thalia Nero kvverti

View GitHub Profile
@kvverti
kvverti / korou-syntax-quickstop.hs
Last active April 16, 2022 02:56
Korou Syntax Quick-Stop
-- functions are defined like so
fn add(a: Int, b: Int) -> Int {
a + b
}
-- effects can be declared like so
effect fail[E] {
fn fail(ctx: E)
}
@kvverti
kvverti / transformers.md
Created September 18, 2021 04:00
What in the Absolute Flying Spaghetti are Monad Transformers, Anyway?

What in the Absolute Flying Spaghetti are Monad Transformers, Anyway?

Part 1: A Monadic Overview

Before we jump fully into monad transformers, let's briefly overview monads.

Intro

Overview of monads

@kvverti
kvverti / callCC.md
Last active May 12, 2021 02:51
What the Heck is CallCC, Anyway?

What the Heck is CallCC, Anyway?

"Call with current continuation", abbreviated to call/CC or callCC, is an operator popularized by Scheme and often used to implement or emulate nonlocal control transfer in functional languages. However, how call/CC even works is really confusing. It exists at the intersection of higher order functions, continuation passing, and monadic composition; three concepts considered difficult to understand.

Todo: Type signature of callCC, trying to implement callCC, what the b parameter is for.

Part 0: The Type of Call/CC

@kvverti
kvverti / monads.md
Last active September 22, 2024 18:26
What the heck are monads anyway?

What the Heck is a Monad, Anyway?

Querying one's favorite search engine with the text "a monad is" yields this answer on StackOverflow, which explains, in excruciating mathematical symbology, what a monad in fact is. But, don't worry. Understanding monads doesn't require you to learn the nuances of such concepts as moirails and eigenfunctors. I would suggest that the concept of monads can be distilled into a clearer single sentence.

A monad is a control abstraction that defines a composition of effectful functions.

Let's unpack.

@kvverti
kvverti / TernarySurfaceConfigMixin.java
Created October 18, 2020 19:26
Extending Codecs with Mixin
package robosky.uplands.mixin;
import java.util.function.Function;
import com.mojang.datafixers.kinds.App;
import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import org.spongepowered.asm.mixin.Dynamic;
import org.spongepowered.asm.mixin.Mixin;
@kvverti
kvverti / module.md
Last active June 24, 2023 01:48
The Fabric API Problem

Fabric API

Fabric API is supposed to be modular. This means that mod devs should be able to pick and choose which Fabric API modules to depend on in their mods, both in the development environment and in production.

Fabric API is also supposed to be just another mod. Fabric API should not have special support in Fabric tooling, nor should it be a required install for players. Basically, Fabric API is simply a collection of mostly independent modules that happen to be maintained by the same organization that maintains Fabric tooling.

The Problem

The fabric example mod contains a hard dependency on the entire Fabric API. Since most mod devs do not remove this dependency, most players have to download an additional mod (Fabric API) in order to play a Fabric mod, which many players do not expect. This means mod devs often assume that players have installed Fabric API in the production evnironment.

@kvverti
kvverti / config-meanderings.md
Last active April 12, 2020 06:20
A brainstorm of Fabric Config schema and behavior

Config categories (environments?)

  • Prelaunch, for configuring mixin plugins (immutable)
  • Instance, for configuring registration and other things that happen at load time (immutable)
  • Server, for things that control server-side behavior (mutable)
  • Client, for client side behavior (mutable)

Config Schema

  • Defined in mod root
  • Version flagged (in case more types or constraints are added)
  • Config value types and constraints are likely locked down
@kvverti
kvverti / AccessTest.java
Created February 26, 2020 06:16
Java Access Control
package access;
public class AccessTest {
public static void main(String[] args) {
UseM.use(new q.Sub()); // prints "Subclass"
// new q.Sub().m(); // compiler error - cannot access protected method m
((p.Super)new q.Sub()).m(); // prints "Subclass"
}
}
/*********************************************************************************************************************************************************************************************************************/
/* SpongePowered MIXIN */
/*********************************************************************************************************************************************************************************************************************/
/* Code source : file:/home/.gradle/caches/modules-2/files-2.1/net.fabricmc/sponge-mixin/0.7.11.36/b0d9944f2b77f1ce952a1179e595037332910a82/sponge-mixin-0.7.11.36.jar */
/* Internal Version : 0.7.11
@kvverti
kvverti / crash.txt
Last active May 11, 2019 03:10
Structure Crash
---- Minecraft Crash Report ----
// Why is it breaking :(
Time: 5/10/19, 10:55 PM
Description: Exception generating new chunk
java.util.ConcurrentModificationException
at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1134)
at net.minecraft.structure.StructureManager.getStructure(StructureManager.java:58)
at net.minecraft.structure.StructureManager.getStructureOrBlank(StructureManager.java:47)