Skip to content

Instantly share code, notes, and snippets.

View mbenke's full-sized avatar

Marcin Benke mbenke

  • Warszawa, Poland
View GitHub Profile
Starting debug for 'Hoogle'
[ERROR: alfred.workflow.input.scriptfilter] XML Parse Error 'The operation couldn’t be completed. (NSXMLParserErrorDomain error 76.)'. Row (null), Col (null): '(null)' in XML:
<?xml version='1.0'?>
<items>
<item arg="http://hackage.haskell.org/packages/archive/base/latest/doc/html/Prelude.html#t:Either" uid="http://hackage.haskell.org/packages/archive/base/latest/doc/html/Prelude.html#t:Either">
<title>data Either a b</title>
<subtitle>The Either type represents values with two possibilities: a value of type Either a b is either Left a or Right b.
The Either type is sometimes used to represent a value which is either correct or an error; by convention, the Left constructor is used to hold an error value and the Right constructor is used to hold a correct value (mnemonic: "right" also means "correct"). </subtitle>
@mbenke
mbenke / dialog2.hs
Created February 11, 2010 20:49
Haskell I/O dialog sample
import System.IO
promptLine :: String -> IO String
promptLine prompt = do
putStr prompt
hFlush stdout
getLine
doesQuit :: String -> Bool
doesQuit "" = True
@mbenke
mbenke / vty2.hs
Created February 11, 2010 21:03
Simple Vty area rendering
-- Simple Vty area rendering
import Graphics.Vty
import Data.Char
type X = Int
type Y = Int
type Loc = (Y,X)
type Dir = (Y,X)
type Area = ((Y,X),(Y,X))
@mbenke
mbenke / DummyParser.hs
Created March 16, 2010 10:51
Haskell DummyParser
-- Dummy parser module with stubs to be filled in by students
{-# LANGUAGE FlexibleInstances#-}
{-# LANGUAGE MultiParamTypeClasses #-}
module DummyParser(Parser,runParser,item) where
import Control.Monad
newtype Parser a = Parser a
runParser :: Parser a -> [Char] -> Either String (a,String)
runParser = undefined
@mbenke
mbenke / Constraints.hs
Created April 15, 2010 09:32
Curry lambda TR
module Constraints where
import Data.List(union,intersect,nub)
type Tyvar = String
infixr 5 :->
data Type = TInt | Type :-> Type | TVar Tyvar
deriving Eq
instance Show Type where
@mbenke
mbenke / .gitignore
Created May 3, 2010 20:55
Agda demo for Zawadowski Fest
*.agdai
*~
<!doctype html>
<html>
<head>
<style type="text/css">
a.test { font-weight: bold; }
</style>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
@mbenke
mbenke / jq5.html
Created June 4, 2010 18:43
Learning jQuery, day 3
<!doctype html>
<html>
<head>
<style type="text/css">
a.test { font-weight: bold; }
</style>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
@mbenke
mbenke / gist:706400
Created November 19, 2010 11:31
cid.l
%option noyywrap
D [0-9]
L [A-Za-z_]
%start COMMENT
%{
int depth = 0;
%}
%%
ifdef
ifndef
formulas(sos).
% data nat = z | s nat
nat(cz).
-nat(x) | nat(cs(x)).
plus(cz,x) = x.
plus(cs(x),y) = cs(plus(x,y)).
end_of_list.
formulas(goals).
% T(n) ≡ ∀ n :: nat.plus(n,zero) = plus(zero,n)