Skip to content

Instantly share code, notes, and snippets.

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

Antoine Leblanc nicuveo

🏳️‍⚧️
View GitHub Profile
@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)
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
@nicuveo
nicuveo / Makefile
Created January 27, 2021 14:37
Repro case for redundant constraint bug.
all:
ghc --version
ghc -Wredundant-constraints -Werror -O0 Main.hs
ghc -Wredundant-constraints -Werror -O2 Main.hs