Skip to content

Instantly share code, notes, and snippets.

View nrnrnr's full-sized avatar

Norman Ramsey nrnrnr

View GitHub Profile
@nrnrnr
nrnrnr / Indentable.hs
Created August 9, 2022 21:01
Simple substitute for Outputable
{-# LANGUAGE OverloadedStrings #-}
module GHC.Utils.Indentable
( IndentedBuilder
, Indentation
, newline
, indentBy
, indent
, (<+>)
)
@nrnrnr
nrnrnr / clang-errors.txt
Created August 3, 2022 18:35
Transcript of trying to run clang on tweag builder 01
[nr@nixos:~]$ clang --target=wasm32-wasi -o evil.o -c evil.s
clang-14: warning: argument unused during compilation: '-fstack-protector-strong' [-Wunused-command-line-argument]
clang-14: warning: argument unused during compilation: '--param ssp-buffer-size=4' [-Wunused-command-line-argument]
clang-14: warning: argument unused during compilation: '-D _FORTIFY_SOURCE=2' [-Wunused-command-line-argument]
clang-14: warning: argument unused during compilation: '-fno-strict-overflow' [-Wunused-command-line-argument]
clang-14: warning: argument unused during compilation: '-idirafter /nix/store/b3pqkywjwzqpq4vi5yffncdbywwpbrmk-glibc-2.33-117-dev/include' [-Wunused-command-line-argument]
clang-14: warning: argument unused during compilation: '-frandom-seed=0wq5q21c7f' [-Wunused-command-line-argument]
clang-14: warning: argument unused during compilation: '-isystem /nix/store/jg2hvh556ppf0xz47iszgbl79fsng2d1-compiler-rt-libc-14.0.0-rc4-dev/include' [-Wunused-command-line-argument]
clang-14: warning: argument unused durin
@nrnrnr
nrnrnr / altered.wat
Created August 2, 2022 19:10
type error corrected (but feels a bit bogus)
(module
(type (;0;) (func (result i32)))
(import "env" "__linear_memory" (memory (;0;) 0))
(func $foo (type 0) (result i32)
nop
i32.const 42
if (result i32) ;; label = @1
nop
i32.const 42
return
@nrnrnr
nrnrnr / assoc.lua
Created February 18, 2022 21:53
Lua code for association lists on the command line (for use with fish)
#!/usr/bin/env lua5.1
-- assocation list on the command line
--
-- rep is: key1 val1 key2 val2 ...
--
local function succeed(s)
if s ~= true then
io.stdout:write(s, '\n')
nr@homedog ~/a/sandbox> cabal haddock -v
this build was affected by the following (project) config files:
- /home/nr/asterius/sandbox/cabal.project.local
cabal: renderBuildTargetProblem: unexpected status (TargetDisabledByUser,Nothing)
CallStack (from HasCallStack):
error, called at src/Distribution/Client/CmdErrorMessages.hs:356:14 in main:Distribution.Client.CmdErrorMessages
nr@homedog ~/a/sandbox> cat cabal.project.local
ignore-project: False
nr@homedog ~/a/sandbox> cabal haddock -v
this build was affected by the following (project) config files:
- /home/nr/asterius/sandbox/cabal.project.local
cabal: renderBuildTargetProblem: unexpected status (TargetDisabledByUser,Nothing)
CallStack (from HasCallStack):
error, called at src/Distribution/Client/CmdErrorMessages.hs:356:14 in main:Distribution.Client.CmdErrorMessages
nr@homedog ~/a/sandbox> cat cabal.project.local
ignore-project: False
@nrnrnr
nrnrnr / backend predicates
Created January 21, 2022 14:42
backend predicates
T: NoBackend; F: NCG, LLVM, ViaC, Interpreter
primal: backendInhibitsInterfaceWriting, backendNeedn'tLink
complement: backendGeneratesCode
T: Interpreter; F: NCG, LLVM, ViaC, NoBackend
primal: backendSptIsDynamic, backendWantsBreakpointTicks, backendForcesOptimization0, backendNeedsFullWays
complement: supportsHpc
T: ViaC; F: NCG, LLVM, Interpreter, NoBackend
@nrnrnr
nrnrnr / UserSettings.hs
Created September 20, 2021 14:57
Hadrian build with `-haddock` option, to ensure the HLS gets the links to the GHC API documentation
-- Ensure we don't expose any unfoldings to guarantee quick rebuilds
{-# OPTIONS_GHC -O0 #-}
-- If you want to customise your build you should copy this file from
-- hadrian/src/UserSettings.hs to hadrian/UserSettings.hs and edit your copy.
-- If you don't copy the file your changes will be tracked by git and you can
-- accidentally commit them.
--
-- See doc/user-settings.md for instructions, and src/Flavour.hs for auxiliary
-- functions for manipulating flavours.
@nrnrnr
nrnrnr / luaproc-serialize.lua
Created June 19, 2020 16:29
Abstractions for use with luaproc
local filetable = require 'filetable'
local string = require 'string'
local stringf = string.format
local M = { }
local __doc = { }
M.__doc = __doc
@nrnrnr
nrnrnr / gist:44609c0ed925ea33f8d3
Created June 17, 2014 15:32
Change to SIGPLAN LaTeX class to make sure that title banner is displayed in reprints
--- /home/nr/lib/latex/sigplan/sigplanconf.cls 2013-08-01 16:23:57.000000000 -0400
+++ ./sigplanconf.cls 2012-07-23 10:54:14.000000000 -0400
@@ -1074,7 +1046,7 @@
\end{center}}
\def \@settitlebanner {%
- \if \@andp{\@preprint}{\@notp{\@emptydefp{\@titlebanner}}}%
+ \if \@andp{\@orp{\@preprint}{\@reprint}}{\@notp{\@emptydefp{\@titlebanner}}}%
\vbox to 0pt{%
\vskip -32pt