Skip to content

Instantly share code, notes, and snippets.

@maoe
maoe / repro.c
Last active March 31, 2021 01:37
// cc -o repro repro.c libopenblas.a
// or
// cc -o repro repro.c -L. -lopenblas
// then
// ./repro
#include <stdio.h>
#include "cblas.h"
int main(void)
{
@maoe
maoe / repro.rs
Last active March 18, 2021 07:05
fn main() {
let v: f64 = 1.1276353206339418;
assert_eq!(v.ln(), 0.12012280349368988);
}
@maoe
maoe / Foo.hs
Last active February 28, 2021 13:32
Minimum repro for a GHCi panic due to linkSomeBCOs: no break array
module Foo (Foo(..)) where
class Foo a where
bar :: a -> ()
bar _ = ()
<!DOCTYPE HTML><html><head><title>Criterion comparison</title><meta charset="UTF-8"><style>
.stddev
{
font-size : x-small;
}
td
{
padding-left : 1em;
padding-right : 1em;
{-# LANGUAGE BangPatterns #-}
module Main where
import Data.Char
import Data.List
import Data.List.Split
import Criterion.Main
commafyFoldr :: String -> String
commafyFoldr = snd . foldr f (0 :: Int, "")
where

UnboxedSums

GHC 8.2.1で実装された言語拡張。anonymousでunboxedな直和型を実現する機能。

例: Maybe#

{-# LANGUAGE MagicHash #-} -- Maybe#のハッシュ記号に必要
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE PolyKinds #-} -- a :: TYPE rに必要
@maoe
maoe / update.sh
Created November 17, 2018 14:07
Update symlinks for GHC
#!/bin/bash
EXECUTABLES="ghc ghc-pkg ghci haddock runghc"
VERSION=$1
if [ -z "$1" ]; then
echo "ERROR: GHC version number needs to be specified. Exiting." 1>&2
exit 1
fi
pushd /opt/ghc/bin > /dev/null
@maoe
maoe / TODO.md
Last active March 31, 2018 05:05
TODO for threadscope
  • Make application settings (e.g. default window size, checkboxes in the Traces tab etc) persistent

  • Switch to GTK+3 for better HiDPI support

  • Display duration in the status bar when dragging on the timeline

  • Checkbox to display/hide event markers

  • Drag support in the raw events

  • Search text in the raw events

  • Filter by thread ID (like "follow tcp stream" in wireshark)

  • Tooltip that displays the thread name or ID of the area under the cursor

  • Build index (with succinct/compact data structures) to save memory usage

Version 1.5.1, Git revision 600c1f01435a10d127938709556c1682ecfd694e x86_64 hpack-0.17.1
2017-08-09 23:05:29.805236: [debug] Checking for project config at: C:\Users\maoe\Downloads\ThreadScope-embed-data-files-fixes\stack.yaml
@(Stack\Config.hs:974:9)
2017-08-09 23:05:29.807189: [debug] Loading project config file stack.yaml
@(Stack\Config.hs:999:13)
2017-08-09 23:05:29.827719: [debug] Trying to decode C:\sr\build-plan-cache\x86_64-windows\lts-8.22.cache
@(Data\Store\VersionTagged.hs:72:5)
2017-08-09 23:05:30.038642: [debug] Success decoding C:\sr\build-plan-cache\x86_64-windows\lts-8.22.cache
@(Data\Store\VersionTagged.hs:76:13)
2017-08-09 23:05:30.040588: [debug] Using standard GHC build
@maoe
maoe / Foldr.hs
Created July 23, 2017 21:16
Core for foldr on list
-- RHS size: {terms: 30, types: 29, coercions: 0, joins: 1/1}
Data.Foldable.$fFoldable[]_$cfoldr'
:: forall a b. (a -> b -> b) -> b -> [a] -> b
[GblId,
Arity=3,
Caf=NoCafRefs,
Str=<L,C(C1(U))><L,U><S,1*U>,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [60 0 0] 126 0}]
Data.Foldable.$fFoldable[]_$cfoldr'