Skip to content

Instantly share code, notes, and snippets.

View angerman's full-sized avatar
🇸🇬

Moritz Angermann angerman

🇸🇬
View GitHub Profile
@angerman
angerman / to-sql.py
Last active December 11, 2019 12:55
#!/usr/bin/env nix-shell
#!nix-shell -i python3 -p python3 --pure
import sys
from pprint import pprint
stack = []
timestack = []
n = 0
{ pkgs ? import <nixpkgs> {}
}:
let
overrideWith = override: default:
let
try = builtins.tryEval (builtins.findFile builtins.nixPath override);
in if try.success then
builtins.trace "using search host <${override}>" try.value
else
default;
@angerman
angerman / powerset.hs
Last active May 3, 2018 20:39
Powersets in Haskell
powerset :: [a] -> [[a]]
powerset [] = [[]]
powerset (x:xs) = map (x:) (powerset xs) ++ powerset xs
{-# LINE 1 "libraries/base/GHC/Event/Poll.hsc" #-}
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE GeneralizedNewtypeDeriving
, NoImplicitPrelude
, BangPatterns
#-}
module GHC.Event.Poll
(
new
; ModuleID = '<stdin>'
source_filename = "Main.ll"
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
target triple = "arm-unknown-linux-gnueabihf"
@.str = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@Main_f_closure = local_unnamed_addr global { i32 } { i32 ptrtoint (void (i32*, i32*, i32*, i32, i32, i32, i32, i32)* @Main_f_info to i32) }
@Main_zdtrModule4_bytes = global { [5 x i8] } { [5 x i8] c"main\00" }
@Main_zdtrModule3_closure = global { i32, i32 } { i32 ptrtoint (i32* @ghczmprim_GHCziTypes_TrNameS_con_info to i32), i32 ptrtoint ({ [5 x i8] }* @Main_zdtrModule4_bytes to i32) }
; ModuleID = '<stdin>'
source_filename = "Main.ll"
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
target triple = "arm-unknown-linux-gnueabihf"
@Main_f_closure = local_unnamed_addr global { i32 } { i32 ptrtoint (void (i32*, i32*, i32*, i32, i32, i32, i32, i32)* @Main_f_info to i32) }
@Main_zdtrModule4_bytes = global { [5 x i8] } { [5 x i8] c"main\00" }
@Main_zdtrModule3_closure = global { i32, i32 } { i32 ptrtoint (i32* @ghczmprim_GHCziTypes_TrNameS_con_info to i32), i32 ptrtoint ({ [5 x i8] }* @Main_zdtrModule4_bytes to i32) }
@Main_zdtrModule2_bytes = global { [5 x i8] } { [5 x i8] c"Main\00" }
@Main_zdtrModule1_closure = global { i32, i32 } { i32 ptrtoint (i32* @ghczmprim_GHCziTypes_TrNameS_con_info to i32), i32 ptrtoint ({ [5 x i8] }* @Main_zdtrModule2_bytes to i32) }
; ModuleID = '<stdin>'
source_filename = "Main.ll"
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
target triple = "arm-unknown-linux-gnueabihf"
@r2Pd_bytes = private global { [5 x i8] } { [5 x i8] c"main\00" }
@r2Ps_closure = private global { i32, i32 } { i32 ptrtoint (i32* @ghczmprim_GHCziTypes_TrNameS_con_info to i32), i32 ptrtoint ({ [5 x i8] }* @r2Pd_bytes to i32) }
@r2Pt_bytes = private global { [5 x i8] } { [5 x i8] c"Main\00" }
@r2Pu_closure = private global { i32, i32 } { i32 ptrtoint (i32* @ghczmprim_GHCziTypes_TrNameS_con_info to i32), i32 ptrtoint ({ [5 x i8] }* @r2Pt_bytes to i32) }
@Main_zdtrModule_closure = local_unnamed_addr global { i32, i32, i32, i32 } { i32 ptrtoint (i32* @ghczmprim_GHCziTypes_Module_con_info to i32), i32 add (i32 ptrtoint ({ i32, i32 }* @r2Ps_closure to i32), i32 1), i32 add (i32 ptrtoint ({ i32, i32 }* @r2Pu_closure to i32), i32 1), i32 3 }
==================== Tidy Core ====================
2017-11-28 12:35:17.812664 UTC
Result size of Tidy Core
= {terms: 121, types: 172, coercions: 9, joins: 0/0}
-- RHS size: {terms: 3, types: 3, coercions: 0, joins: 0/0}
f [InlPrag=NOINLINE] :: forall a. a -> a
[GblId,
==================== Tidy Core ====================
2017-11-28 12:34:31.425861 UTC
Result size of Tidy Core
= {terms: 51, types: 32, coercions: 0, joins: 0/0}
-- RHS size: {terms: 3, types: 3, coercions: 0, joins: 0/0}
f_rqh :: forall a. a -> a
[GblId, Arity=1, Caf=NoCafRefs]
{-# LANGUAGE MagicHash, BangPatterns #-}
module Main where
import GHC.Exts
{-# NOINLINE f #-}
f :: (Int# -> Float# -> Double# -> Float# -> Double# -> String) -> String
f g = g 3# 4.0# 5.0## 6.0# 6.9## ++ " World!"
{-# NOINLINE p #-}