Created
November 12, 2012 21:10
-
-
Save MostAwesomeDude/4061920 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data Recipe = Recipe { matches :: Table -> Bool | |
, reduce :: Table -> Table | |
, provides :: Provision } | |
data Provision = Provision { slot :: Item, count :: Int } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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