jml / hamper Goto Github PK
View Code? Open in Web Editor NEWHaskell implementation of AMP
Haskell implementation of AMP
Muck around with Haskell. = AMP = == Terms == bytes :: a sequence of bytes == Boxes == Boxes! key :: bytes value :: bytes 1. What's the rationale for the maximum key length being different to the maximum value length? Keys should be keys, individual words easily described in a protocol specification document. 255 bytes is enough even for a wordy chinese identifier in UTF8. Also, the redundancy of the implicitly required NUL between messages gives us a nice hook to determine if the protocol has gone totally pear- shaped, like the "," between netstrings. 2. How does the Python keywords thing fit with the actual protocol, rather than the Python implementation? The Python keywords thing is purely a Python consideration. It should have no effect on the protocol. The Python keywords thing is purely a Python consideration. It should have no effect on the protocol. Hmm. Maybe a better question is, "are there any restrictions on what constitutes a valid key, other than length"? Nope. Maybe there should be, though, I've been thinking about adding the restriction of "no-NUL utf-8". Right now it's effectively ASCII for keys, Another question, does AMP have anything to say about character encoding? For my Haskell implementation I've been UTF-8 encoding strings before sending them over the wire, which seems like a good default sanity. As in the Python implementation of the "Unicode" argument type, UTF-8 is where it's at. "String" is a crummy argument name, it really should have been "Bytes"; but it's very clearly a bytestring, not text. Thanks for doing a Haskell implementation ;). == Commands == A *command definition* is:: command name :: bytes arguments response errors *arguments* is a mapping from 'name' to (encoder, decoder) pairs, where name :: bytes (a box 'key') encoder :: A -> bytes decoder :: bytes -> A Such that x = decoder(encoder(x)) for all x in A A *command request* is serialized from a command definition, given a mapping from parameter names (bytes) to values (arbitrary). _command => <command name> <name> => encoder (a) for all *arguments*. If the server MUST send a reply to the request, the command request also includes:: ASK => <unique_tag> where <unique_tag> is a byte-string unique to that connection. ANSWER errors??? == Conventions == === Names === Command names should be purely alpha-numeric, starting with a capital letter. << recommended range for argument / response names >> << recommended range for error names >> === Types === Text strings sent as UTF-8 encoded bytes. Integers are sent as stringified versions of themselves. Lists are sent as a list of AMP boxes, each one following the same argument-set-definition. Boolean values are sent as "True", "False" (byte strings) == SSL / Protocol switching == ???
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.