Skip to content

Instantly share code, notes, and snippets.

View osa1's full-sized avatar

Ömer Sinan Ağacan osa1

View GitHub Profile
{-# OPTIONS_GHC -Wall -fno-warn-name-shadowing #-}
module Main where
import Language.Lua.Parser
import Language.Lua.Types
import qualified Language.ECMAScript3.Syntax as JS
import Language.ECMAScript3.PrettyPrint (renderExpression)
import System.Environment (getArgs)
?- length(X, 3), Term =.. [functor | X].
X = [_G388, _G391, _G394],
Term = functor(_G388, _G391, _G394).
@osa1
osa1 / dfs.hs
Created June 23, 2013 14:39
dfs
import Prelude hiding (fail)
dfs
:: a -- initial state
-> path -- empty path
-> (a -> [a]) -- branch function to generate states in next level
-> (path -> a -> path) -- function to add visited state to path
-> (a -> Bool) -- goal checker
-> (a -> Bool) -- failure checker, used for backtracking
-> [path] -- result is list of paths
This file has been truncated, but you can view the full file.
Tue Jul 2 13:03 2013 Time and Allocation Profiling Report (Final)
Shen.hs +RTS -p -RTS --shen K Lambda
total time = 443.39 secs (443389 ticks @ 1000 us, 1 processor)
total alloc = 124,775,518,168 bytes (excludes profiling overheads)
COST CENTRE MODULE %time %alloc
>>= Control.Monad.Trans.Error 42.9 15.6
package net.osa1.WikiaLyricsParser;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.List;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
AddPath "/home/omer/sf/" as.
Require Export Basics.
Inductive bin : Set :=
| Zero : bin
| TwoZero : bin -> bin
| TwoZeroPOne : bin -> bin.
Fixpoint inc (b : bin) : bin :=
match b with
fs = require "fs"
path = require "path"
cp = require "child_process"
goUp = (depth) ->
if depth == 0
return ""
_path = ""
for i in [0..depth-1]
@osa1
osa1 / gist:6201852
Last active December 20, 2015 21:59
➜ ghc git:(ticket3452) ✗ ../inplace/bin/ghc-stage2 --interactive
GHCi, version 7.7.20130806: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
ghci> :set +t
ghci> 1
1
it :: Num a => a
ghci> id
@osa1
osa1 / gist:6261221
Last active December 21, 2015 05:59
{-# OPTIONS_GHC -Wall #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
module Main where
@osa1
osa1 / gist:6469034
Created September 6, 2013 19:52
once working K program
module CONCAT-SYNTAX
syntax Concat ::= List{Concat1, " "}
syntax Concat1 ::= Id
| "|" Concat1 "|" // quotation
| "[" Concat "]"
| Int
| "print"
| "pop"