Skip to content

Instantly share code, notes, and snippets.

View wavewave's full-sized avatar

Ian-Woo Kim wavewave

  • San Francisco, CA, USA
View GitHub Profile
@wavewave
wavewave / MyFailure.hs
Last active January 29, 2024 19:06
Segfault with profiledGHC
{-# LANGUAGE QuasiQuotes #-}
module MyFailure where
import Data.Text (Text, unpack)
import URI.ByteString
import URI.ByteString.QQ
-- | Query Parameter Representation
data OAuth2 = OAuth2
@wavewave
wavewave / build.sh
Created August 10, 2023 20:00
ghc-debug on HeapOverflow
#!/bin/bash
rm test.o
ghc -rtsopts -threaded test.hs
# run like the following
# GHC_DEBUG_SOCKET=/tmp/ghc-debug ./test +RTS -M1G
@wavewave
wavewave / A.hs
Created May 18, 2023 20:32
loading temp shared object failed in ghci
module A where
dep :: IO ()
dep = putStrLn "dep."
@wavewave
wavewave / A.hs
Created May 16, 2023 17:59
getDoc retrigger unnecessary recompilation with obscure message
module A where
irrelevant :: IO ()
irrelevant = putStrLn "irrelevant"
@wavewave
wavewave / graphApp.hs
Created June 25, 2020 19:50
HROOT graph drawing app
nix-shell ~/repo/src/HROOT/use.nix --arg "fficxxSrc" ~/repo/src/fficxx --run "ghc graphApp.hs"
./graphApp
@wavewave
wavewave / nixops-example.nix
Created June 13, 2020 16:25
kernel package examples
let
machine =
{ config, resources, pkgs, ... }:
let
kpkgs =
with pkgs;
let linux_4_19_80 = callPackage ../../nix/linux-4.19.80.nix {
kernelPatches =
@wavewave
wavewave / listtest.hs
Created December 25, 2011 10:33
gtk2hs: ListStore and TreeView example
module Main where
{- an example how to select from a list
not satisfactory yet:
- there should be a simpler way to render a simple list
- i could not convert the model i got back to a list
from which to get the value
- the interface offers a great number of functions
and it is very difficult to find which ones are
really needed for simple tasks
@wavewave
wavewave / xmonad.hs
Created February 25, 2019 18:39
my xmonad
import Control.Concurrent
import Data.Monoid ((<>))
import XMonad hiding ( (|||) )
import XMonad.Actions.CopyWindow
import XMonad.Actions.Navigation2D
import XMonad.Actions.UpdatePointer
import XMonad.Actions.WindowBringer
import XMonad.Config.Gnome
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.DynamicLog
@wavewave
wavewave / index.html
Last active October 14, 2018 16:47
ghcjs canvas example
<!DOCTYPE html>
<html>
<head>
<script language="javascript" src="lib.js"></script>
<script language="javascript" src="rts.js"></script>
<script language="javascript" src="lib1.js"></script>
<script language="javascript" src="out.js"></script>
</head>
<body>
<canvas id="mycanvas" width="600" height="400"></canvas>
module Foo where
import Foreign.C.Types (CInt(..))
import Foreign.Ptr (Ptr,FunPtr)
func :: CInt -> CInt -> CInt
func j i = j + i+1
foreign import ccall "wrapper" mkFPtr :: (CInt -> CInt) -> IO (FunPtr (CInt -> CInt))