Skip to content

Instantly share code, notes, and snippets.

View nicuveo's full-sized avatar
🏳️‍⚧️

Antoine Leblanc nicuveo

🏳️‍⚧️
View GitHub Profile
@nicuveo
nicuveo / roll.bf
Created February 25, 2025 16:00
Brainfuck Roll
// this file is not valid Brainfuck as Brainfuck has no notion of comments
// and all symbols within comments would be interpreted as commands
// but let's pretend those are comments for the sake of this being readable
// given a stack of values [....,s06,s05,s04,s03,s02,s01,s00,d,n]
// this function rolls the stack `n` times at a depth `d`
// for instance:
// input: [5,4,3, 2,1,0, 3,2]
// output: [5,4,3, 1,0,2]
@nicuveo
nicuveo / example.html
Last active January 18, 2025 19:30
Vertical alignment bug repro case
<!DOCTYPE html>
<html>
<head>
<style>
table td {
vertical-align: baseline;
}
.left-column {
padding-top: 50px;
}
@nicuveo
nicuveo / README.md
Last active May 15, 2024 00:01
A transpiler from brainfuck to isomorphic languages and back.

transpiler

usage

The transpiler reads all of its input from the standard input. The eight first lines must contain the strings that represent each brainfuck instructions in the output, in this order:

  • <
  • >
  • +
  • -
@nicuveo
nicuveo / Unordered.hs
Last active August 30, 2023 02:28
Unordered parser
{-# LANGUAGE UndecidableInstances #-}
import Control.Applicative (liftA2)
import Data.Dependent.Map qualified as D
import Data.Foldable (foldlM)
import Data.List (permutations)
import GHC.Generics
import Text.Parsec
import Text.Parsec.Char
import Text.Parsec.String
@nicuveo
nicuveo / Accessors.hs
Last active August 1, 2023 09:59
Cursed natural accessors in Haskell
{-# LANGUAGE TemplateHaskell #-}
import Control.Lens
import Control.Lens.TH
--------------------------------------------------------------------------------
-- Characters
--
-- Some of the fields are only relevant to some characters, but are
@nicuveo
nicuveo / Main.hs
Last active July 14, 2023 21:19
Parsec with stacktraces
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE ImportQualifiedPost #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Data.Char
import Data.List (intercalate)
import Data.Map.Strict qualified as M
@nicuveo
nicuveo / RankNTypesIssue.hs
Created April 20, 2023 19:41
GHC2021 RankNTypes issue
-- {-# LANGUAGE Haskell2010 #-}
{-# LANGUAGE RankNTypes #-}
a :: m i
a = x y
x :: (i -> forall p. p f i) -> m i
x l = undefined
y :: i -> (forall p f. p f i)
@nicuveo
nicuveo / IndexedPlated.hs
Last active April 20, 2023 04:27
An indexed version of Plated
#! /usr/bin/env runhaskell
{-# LANGUAGE Haskell2010 #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RankNTypes #-}
import Control.Applicative
import Control.Lens
import Control.Monad
import Data.Tree
@nicuveo
nicuveo / .gitconfig
Created February 18, 2022 18:09
Git config
[alias]
st = status
ci = commit
co = checkout
br = branch
ff = merge --ff-only
fa = fetch --all
rh = reset --hard
cp = cherry-pick
d = diff --color
@nicuveo
nicuveo / oh_no.hs
Created May 27, 2021 17:02
TypeApplications bug?
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
module Foo where
import Control.Monad.Reader
import Data.Kind (Type)