Skip to content

Instantly share code, notes, and snippets.

View bgamari's full-sized avatar

Ben Gamari bgamari

View GitHub Profile
#!/usr/bin/bash
set -e
rm -f *.hi *.o
args="-O -package-env -"
#args="$args -ddump-hi-diffs -ddump-hi"
cat >Z.hs <<EOF
module Z where
class Hello a where
diff --git a/hadrian/src/Rules/Rts.hs b/hadrian/src/Rules/Rts.hs
index b7f39609b9..8137c62196 100644
--- a/hadrian/src/Rules/Rts.hs
+++ b/hadrian/src/Rules/Rts.hs
@@ -17,9 +17,10 @@ rtsRules = priority 3 $ do
root -/- "//libHSrts_*-ghc*.dylib",
root -/- "//libHSrts-ghc*.so",
root -/- "//libHSrts-ghc*.dylib"]
- |%> \ rtsLibFilePath' -> createFileLinkUntracked
- (addRtsDummyVersion $ takeFileName rtsLibFilePath')
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE UndecidableInstances #-}
module Types where
# We can't use `nix log` within a nix derivation builder so we instead
# generate a bash script which we call from the outside.
collectLogs =
let
exportLog = name: drv: ''
nix log ${toString drv.drvPath} > ${name}.log
'';
in
nixpkgs.writeScriptBin "collect-logs.sh"
(lib.concatStrings (lib.mapAttrsToList exportLog testedPackages));
@bgamari
bgamari / cross.nix
Last active February 11, 2019 20:11
let
nixpkgs = import <nixpkgs> {
crossSystem = { config = "aarch64-unknown-linux-gnu"; };
};
in
nixpkgs.buildEnv {
name = "aarch64-cross-compiler";
paths = with nixpkgs; [ gmp ncurses buildPackages.gcc buildPackages.binutils ];
}
quadrance_snhP
quadrance_snhP
= \ x_anez ->
foldlM'
$fMonadId
(plusDouble `cast` <Co:7>)
(D# 0.0##)
(stream
$fVectorVectorDouble
(case $WVector
diff --git a/compiler/llvmGen/Llvm/MetaData.hs b/compiler/llvmGen/Llvm/MetaData.hs
index 3199506431..012567f2c8 100644
--- a/compiler/llvmGen/Llvm/MetaData.hs
+++ b/compiler/llvmGen/Llvm/MetaData.hs
@@ -110,12 +110,14 @@ instance Outputable MetaExpr where
[ (text "types", ppr $ MetaStruct distType ) ]
ppr (MetaDICompileUnit {..}) =
specialMetadata "DICompileUnit"
- [ (text "language" , ftext dicuLanguage)
- , (text "file" , ppr dicuFile)
@bgamari
bgamari / packet-iscsi.nix
Last active September 7, 2020 09:06
A NixOS module for using Packet's iSCSI-based block storage infrastructure.
{ pkgs, config, lib, ... }:
let
packet-block-storage =
pkgs.stdenv.mkDerivation {
name = "packet-block-storage";
src = pkgs.fetchFromGitHub {
owner = "packethost";
repo = "packet-block-storage";
rev = "4be27cbca7a924b4de7af059d5ac30c2aa5c9e6f";
-- Automatically generated VHDL-93
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
use IEEE.MATH_REAL.ALL;
use std.textio.all;
use work.all;
use work.silmarils_firmware_types.all;
entity silmarils_firmware is
{-# LANGUAGE MagicHash#-}
module Hi where
import GHC.Exts
import Data.Bits
import Data.Char
newtype Unique = MkUnique Int