Skip to content

Instantly share code, notes, and snippets.

View osa1's full-sized avatar

Ömer Sinan Ağacan osa1

View GitHub Profile
@osa1
osa1 / gist:2c57818e0c8e3549ff14
Created May 14, 2015 20:55
CtrlP matcher written in Haskell (uses nvim-hs)
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Neovim
import Neovim.API.Plugin
import qualified Data.ByteString as B
import Data.List (foldl', sortBy)
import Data.MessagePack
!_TAG_FILE_SORTED 1 ~
<> tests/Properties.hs 20 ;" o
Analyse app/Options.hs 17 ;" C
Analysed Criterion/Types.hs 642 ;" C
Analysis Criterion/Analysis.hs 13 ;" m
B examples/Maps.hs 19 ;" t
BenchGroup Criterion/Types.hs 334 ;" C
Benchmark Criterion/Types.hs 331 ;" t
Benchmark Criterion/Types.hs 333 ;" C
Benchmarkable Criterion/Types.hs 123 ;" t
@osa1
osa1 / Main.hs
Created April 16, 2015 14:54
GHC bug
{-# LANGUAGE QuasiQuotes #-}
import Language.Haskell.Exts.QQ
main = print [hs| \x -> case x of { 0 -> True; _ -> odd (x - 1) } |]
-- | Spawn N threads, each one adding new elements to sets randomly
-- selected from a pool of sets.
module Main where
import Control.Concurrent
import Control.DeepSeq
import Control.Monad
import Data.IORef
import Data.Maybe
import qualified Data.Set as S
module Main where
import qualified Data.ByteString as B
import Data.MessagePack (Object)
import Data.Serialize (decode)
import System.IO (hGetContents)
import System.Process
main :: IO ()
main = do
# Some utilities to record jump table/virtual method calls.
# Implemented commands:
# `dynamics break-from-file`: reads an objdump output from given file and adds breakpoints to
# to dynamic calls. When one of the breakpoints are hit, it records jump address without
# dropping to the GDB prompt.
# `dynamics save`: saves collected dynamic call info to the hard-coded file `breakpoint_info`.
# `dynamics print`: prints collected dynamic call info.
# `dynamics disable-hits`: disables breakpoints that are hit at least one time.
# WIP, NOT WORKING YET:
# `dynamics note`: This should be run when $eip is on a dynamic call instruction.
; ModuleID = 'hello'
define i64 @add(i64 %a, i64 %b) {
%1 = alloca i64
store i64 %a, i64* %1
%2 = alloca i64
store i64 %b, i64* %2
%3 = load i64* %1
%4 = load i64* %2
%5 = add i64 %3, %4
module Cardinality where
open import Data.Bool using (Bool; true; false)
open import Data.Nat
open import Data.Fin using (Fin; zero; suc)
open import Data.Sum
open import Data.Product
open import Relation.Binary.PropositionalEquality
open import Function
diff --git k-core/src/main/java/org/kframework/backend/java/symbolic/KILtoBackendJavaKILTransformer.java k-core/src/main/java/org/kframework/backend/java/symbolic/KILtoBackendJavaKILTransformer.java
index 12ab701..28f9aca 100644
--- k-core/src/main/java/org/kframework/backend/java/symbolic/KILtoBackendJavaKILTransformer.java
+++ k-core/src/main/java/org/kframework/backend/java/symbolic/KILtoBackendJavaKILTransformer.java
@@ -537,11 +537,11 @@ public class KILtoBackendJavaKILTransformer extends CopyOnWriteTransformer {
java.util.Map<CellLabel, Term> lhsOfReadCell = null;
java.util.Map<CellLabel, Term> rhsOfWriteCell = null;
if (ruleData.isCompiledForFastRewriting()) {
- lhsOfReadCell = Maps.newHashMap();
+ lhsOfReadCell = Maps.newLinkedHashMap();
%default total
class Cardinality (a : Type) (n : Nat) where
toFin : a -> Fin n
fromFin : Fin n -> a
bijective : (a' : a) -> fromFin (toFin a') = a'
bijective_inv : (f : Fin n) -> toFin (fromFin f) = f
data T = A | B | C