Skip to content

Instantly share code, notes, and snippets.

View CAIMEOX's full-sized avatar
💭
🎲

CAIMEO CAIMEOX

💭
🎲
View GitHub Profile
@CAIMEOX
CAIMEOX / knapsack.md
Last active October 11, 2025 13:59
Scoped effects and data types a la carte
knapsack 3 [1,2,3]
image
@CAIMEOX
CAIMEOX / braille.mbt
Created March 22, 2025 15:27
MoonBit Braille from positions
///|
fn braille_from_pos(pos : Array[(Int, Int)]) -> Char {
let places = pos
.map(fn {
(1, 4) => 7
(2, 4) => 8
(1, n) => n
(2, n) => n + 3
_ => abort("invalid position")
})
@CAIMEOX
CAIMEOX / effect.hs
Created January 19, 2025 08:48
Higher Order Effect
{-# LANGUAGE QuantifiedConstraints #-}
import Data.Kind (Type)
type f ~> g = forall a. f a -> g a
class (forall f. (Functor f) => Functor (t f)) => HFunctor t where
hmap :: (Functor f, Functor g) => (f ~> g) -> (t f ~> t g)
data FreeH (k :: (Type -> Type) -> (Type -> Type)) a where