Skip to content

Instantly share code, notes, and snippets.

View deontologician's full-sized avatar
🦀
🌎

Josh Kuhn deontologician

🦀
🌎
View GitHub Profile
type Callback m a = [String] -> CommandLineT m a
type CallbackList m a = Map.Map String (Callback m a)
type Environment = Map.Map String String
data CommandState m a = CS { registry :: Environment
, callbacks :: CallbackList m a
}
newtype CommandLineT m a = CommandLine (StateT (CommandState m a) (InputT m) a)
// Sample army storage for Ressel:Arena
#include <iostream>
#include <list>
#include <string>
using namespace std;
// Setting up the Node data structure, in this case a clone of "soldier"
// From the Ressel:Arena game..
post_list = blobs_from_db
interested_in_formatting_posts = some_list1
interested_in_formatting_the_page = some_list2
# when modules are loaded they add methods to whatever "interest" lists they want
def format_posts():
for element in post_list: # list of text blobs from database
for formatter in interested_in_posts:
element = formatter(element)
class Fastrclient(object):
""" Creates a connection object and manages all communication
with the server."""
def __init__(self, addr="localhost", port=4168):
self.clientsock = s.socket(s.AF_INET,s.SOCK_DGRAM)
self.addr = (addr,port)
self.count = 0
self.count_l = threading.Lock()