Skip to content

Instantly share code, notes, and snippets.

@MostAwesomeDude
Created November 12, 2012 21:10
Show Gist options
  • Save MostAwesomeDude/4061920 to your computer and use it in GitHub Desktop.
Save MostAwesomeDude/4061920 to your computer and use it in GitHub Desktop.
data Protocol s a = Protocol { state :: s
, connected :: Bool
, transport :: Maybe Transport
, makeConnection :: Transport -> Protocol s a
, connectionMade :: Protocol s a
, dataReceived :: [a] -> Protocol s a -> ([a], Protocol s a)
, connectionLost :: Maybe Reason -> Protocol s a }
class Protocol:
implements(interfaces.IProtocol, interfaces.ILoggingContext)
connected = 0
transport = None
def makeConnection(self, transport):
pass
def connectionMade(self):
pass
def logPrefix(self):
return self.__class__.__name__
def dataReceived(self, data):
pass
def connectionLost(self, reason=connectionDone):
pass
data Recipe = Recipe { matches :: Table -> Bool
, reduce :: Table -> Table
, provides :: Provision }
data Provision = Provision { slot :: Item, count :: Int }
class Recipe:
def matches(self, table, stride):
pass
def reduce(self, table, stride):
pass
provides = slot, count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment