Skip to content

Instantly share code, notes, and snippets.

View cideM's full-sized avatar

Florian Beeres cideM

View GitHub Profile
@cideM
cideM / foo
Created January 7, 2021 10:24
Nix Shell With Specific GHC Version
$ nix-env -f "<nixpkgs>" -qaP -A haskell.compiler
haskell.compiler.ghc8101 ghc-8.10.1
haskell.compiler.integer-simple.ghc8101 ghc-8.10.1
haskell.compiler.ghc8102 ghc-8.10.2
haskell.compiler.integer-simple.ghc8102 ghc-8.10.2
haskell.compiler.ghc8102Binary ghc-8.10.2-binary
haskell.compiler.ghc8102BinaryMinimal ghc-8.10.2-binary
haskell.compiler.integer-simple.ghc8103 ghc-8.10.3
haskell.compiler.ghc8103 ghc-8.10.3
haskell.compiler.native-bignum.ghcHEAD ghc-8.11.20200824
#! /usr/bin/env nix-shell
#! nix-shell -p "haskellPackages.ghcWithPackages (pkgs: with pkgs; [scotty text relude co-log])" -i "runghc -Wall"
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PatternSynonyms #-}
@cideM
cideM / example.hs
Created December 7, 2020 16:47
Problem with `fgl` in Haskell
#! /usr/bin/env nix-shell
#! nix-shell -p "haskellPackages.ghcWithPackages (pkgs: with pkgs; [fgl])" -i "runghc -Wall"
{-# LANGUAGE ScopedTypeVariables #-}
import qualified Data.Graph.Inductive.Graph as G
import qualified Data.Graph.Inductive.NodeMap as GM
import Data.Graph.Inductive.PatriciaTree (Gr)
type Graph = Gr String Integer
@cideM
cideM / Main.purs
Last active October 20, 2020 17:29
module Main where
import Prelude
import Effect (Effect)
import Control.Monad.Except.Trans (throwError)
import Effect.Console (log)
import Control.Alt ((<|>))
import Data.Generic.Rep as GR
import Foreign (Foreign, ForeignError(..), fail)
import Foreign as Foreign
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
{
description = "Nix. All. The. Things.";
inputs = {
home-manager = {
url = "github:rycee/home-manager";
inputs.nixpkgs.follows = "/unstable";
};
nixpkgs = {
@cideM
cideM / fuzzy.lua
Created September 10, 2020 18:49
Lua Neovim Fuzzy Finder Experiment
local a = vim.api
local test_data = { "foo", "bar", "bax" }
local test_options = {
height = 75,
width = 100,
relative = "editor",
anchor = "NW",
style = "minimal",
@cideM
cideM / gist:f5458f8b7aa95a5fa75970e0c8a7457b
Last active September 8, 2020 14:13
So you want diagnostics in Neovim
Maybe I'll turn this into a blog post at some point. Right now I just want some
clarity and peace of mind, so I'll dump my thoughts into this Gist.
Diagnostics information in Neovim can either come from one or several related
files, or the entire project. An example of the former would be the module
you're currently working on and all its dependencies. Regardless of which type
of diagnostics you prefer, I think it's safe to assume that you want to be able
to use both. Sometimes a change compiles in the scope of a single module but
not in the context of the entire project, since usages of the changed module
need to update their interface definitions or something like that.
@cideM
cideM / url_encode.sh
Created June 11, 2020 19:14
URL Encode a String with POSIX Shell
#!/bin/sh
# https://en.wikipedia.org/wiki/Percent-encoding
# https://stackoverflow.com/questions/38015239/url-encoding-a-string-in-shell-script-in-a-portable-way
# https://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-variable.html#The-LANGUAGE-variable
# "The variable LANGUAGE is ignored if the locale is set to ‘C’"
# Not entirely sure why this is done to be honest
LANG=C;
@cideM
cideM / shell.nix
Created May 16, 2020 11:15
Trying to build ocaml-lsp
let
pkgs = import <nixpkgs> {};
cinaps = pkgs.ocaml-ng.ocamlPackages_4_09.buildDunePackage rec {
pname = "cinaps";
version = "latest";
src = pkgs.fetchFromGitHub {
owner = "ocaml-ppx";
repo = "cinaps";
rev = "e3183c4733d0577d4d54211cafa4a52dfe5dd235";