User loginNavigation |
LtU ForumSession Types for Purely Functional Process NetworksSession types greatly augment purely functional programming. Session types enable pure functions to directly model process networks and effects. We can adapt session types to pure functions by first reorganizing function calls of form ` Sequential session types conveniently represent that intermediate outputs are available before all inputs are provided. A simple reordering to ` Sequential sessions already demonstrate a trivial model of interaction: the caller can observe the intermediate output `X` before computing inputs `B` and `C`. We can also model 'plain old structured data' types as unidirectional sessions, e.g. a type ` Session type systems usually also support choice and recursion. We can adapt 'choice' to pure functions by assigning a choice-label to a choice parameter and this label determines which subset of choice-specific parameters we'll use. A simple example: type IF = &{ add: ?x:int ?y:int !r:int
| negate: ?x:int !r:int
}
With this definition in scope, the session type `?method:IF` could represent an external choice of 'method'. The choice-label `add` or `negate` might be assigned to implicit parameter `method.case`, and the label chosen will determine whether we further use parameters `in method.add.x : int`, `in method.add.y : int`, and `out method.add.r : int` or `in method.negate.x : int` and `out method.negate.r : int`. This is an exclusive choice, so a compiler could safely 'overlap' memory for these five parameters, similar to a C union. But unlike a conventional union or variant, the choice determines both inputs and outputs. Choice session types can conveniently model object-oriented interfaces or singular request-response interactions. Aside: Session type systems distinguish external choice (&) vs internal choice (⊕). In the adaptation to functional programming, whether a choice is external or internal is based on whether the 'choice parameter' like 'method' in is input or output. However, it's convenient to represent some choices from the 'external choice' perspective. Thus, use of `&` above allows the type to be syntactic sugar for ` Recursive session types can further augment our functions with unbounded trees or streams of interactions. Conceptually, they allow functions to have an unbounded set of parameters, each with a unique 'path' name. A demand-driven stream type might have a form: ` Use of recursive session types is similar to conventional functional programming with tree-structured data. A compiler or garbage collector can recycle memory for parameters that become irrelevant to further computation. Session types can represent many useful evaluation strategies such as call-by-need or bounded-buffer pushback. Intriguingly, session types can model 'algebraic effects' via recursive streams of request-response choice sessions. Beyond sequencing, choice, and recursion, we can also extend functional programming with 'concurrent' sessions to represent partitioned data dependencies. For example, with function type ` Session types give us a rich model for interaction with pure function calls. Implicitly, these interactions are between the 'call' and 'caller'. Fortunately, it is not difficult for a session-typed functional programming language to support 'delegation' such that we tunnel handling of interactions to another function call. When we begin to delegate long-lived sessions (e.g. recursive streams) between functions, the program begins to take a form of a 'process network' where pure functions are the processes and delegation models the wiring between them. Use of session types and delegation for purely functional process networks will subsume Kahn Process Networks (KPNs), which are limited to simple streams as the only interaction between processes. With session types, we can effectively model processes that rendezvous, coroutines, processes that have clear bounds on input and output, clear termination behavior. As a summary, session types for purely functional programming supports:
Session types greatly improve this does not compromise functional abstraction or functional purity, except insofar as unbounded interactions with functions are not what we usually imagine from the mathematical connotations of 'function'. I have not searched hard for prior art on the subject of session types exposing partial evaluation of pure functions as a basis for interaction and deterministic concurrency. I would not be surprised to discover all this is known in obscure corners of academia. But to me, who has recently 'discovered' this combination, this seems like one of those 'obvious in hindsight' features with an enormous return on investment, which all new functional programming languages should be seriously pursuing. The Way-Too-Early announce: EcstasyIt's been four years in development, and it'll still be another few years before it's ready to be used in the real world, but we've taken the wraps off the development of the Ecstasy language and pushed a public repo. The "real" documentation including a full language spec isn't done, but the blog is meant to be a good introduction to the ideas, and relatively easy to chew: https://xtclang.blogspot.com/2016/11/welcome-to-ecstasy-language-first.html The partial language spec, a text form of the BNF, and other docs are here: https://github.com/xtclang/xvm/tree/master/doc At a few hundred thousand lines of code so far in the prototype, it's not a small project, but if you're interested in the workings of it: https://github.com/xtclang/xvm Building this has been some of the most fun that I've ever had as a developer. Finally getting to _use_ it and see it actually running is one of those "sunlit summits". Peace, Cameron. CFP: PLOS '19: 10th Workshop on Programming Languages and Operating SystemsThose of you who apply advanced PL ideas to operating systems might be interested in the upcoming PLOS 2019 workshop. See the abbreviated CFP below, and please consider submitting a short paper! Thanks! --- Eric.
(ABBREVIATED) CALL FOR PAPERS
Tenth Workshop on Programming Languages and Operating Systems (PLOS 2019) October 27, 2019 Huntsville, Ontario, Canada Paper submission deadline: August 9, 2019 Historically, operating system development and programming language development went hand-in-hand. Today, although the systems community at large retains an iron grip on C, many people continue to explore novel approaches to OS construction based on new programming language ideas. This workshop will bring together researchers and developers from the programming language and operating system domains to discuss recent work at the intersection of these fields. It will be a platform for discussing new visions, challenges, experiences, problems, and solutions arising from the application of advanced programming and software engineering concepts to operating systems construction, and vice versa. Please visit the Web site for more info: http://plos-workshop.org/2019/ By eeide at 2019-07-08 18:05 | LtU Forum | login or register to post comments | other blogs | 3529 reads
Applied Category Theory and Categorical Query LanguageI'd like to announce both: 1) the open-source categorical query language CQL and visual IDE: https://www.categoricaldata.net based on David Spivak's functorial data migration sketch from his book/course "7 sketches on compositionality: https://ocw.mit.edu/courses/mathematics/18-s097-applied-category-theory-january-iap-2019/index.htm 2) funding opportunities of up to $1.5M USD for start-ups who want to apply category theory (and especially, the other 6 sketches) to business problems: Previous discussion on Hacker News and Haskell-Reddit: https://news.ycombinator.com/item?id=20376325#20377243 By Ryan Wisnesky at 2019-07-07 22:16 | LtU Forum | login or register to post comments | other blogs | 4075 reads
A production rule system matching algorithm with match cost logarithmic wrt the size of the knowledge base (rules + facts)I propose an algorithm to match facts against rule sets (or against fact sets) which has a time complexity logarithmic with respect to the size of the knowledge base, measured in terms of rules + facts in working memory. As far as I am aware, the current state of the art is polynomial, with RETE derivatives. There is a description of this algorithm in a reference implementation I have published, in Python (sorry), whose docs can be checked here: syntreenet in gitlabThanks! A pretty printing algorithmA pretty printing algorithm which works for strict languages with an example implementation in ocaml. By hbrandl at 2019-03-19 16:41 | LtU Forum | login or register to post comments | other blogs | 5603 reads
For a relational language, how treat KeyValues, Streams in relations with operators that add or remove "columns"I'm building a relational language where I wish to treat everything as a relation. The main point is to provide a common core of relational operators (aka: Queries) that work across all. A "relation" here is a table with a header of fields, columns and rows. I have a container that match directly this, that internally is an array:
Now, I have other containers that are Key/Value like a hashmap and BTreeMap, and single value like Generators, ranges and vectors. Only generators, as being read-only forward-only can be say to output a fixed schema. You can say a hashmap, for example, is a relation that look like:
And a vector one like
With all of them, I wanna provide the same operations like: Now my dilema is what to do for some operations that add or remove columns, like joins and projection: What could be the best option here? 1- Say that kv/array have fixed schemas and can't grow or shrink their headers 2- Say a KV only have fixed the KEY and the value header is flattened, so it become: The problem is not what OUTPUT. I could just output tuples. Is how REPRESENT the relation if it be more than the KV. So, If I have 10 columns, what is the best option to put inside a KV? Consider that the relational model allow to rename columns, and add and remove them. Another problem is that KV like Btree allow to model... trees. If I think instead of Btree as a index behind a table, the language lost the ability of "naturally" model trees. BTW, I wanna to have AGDTs. P.D: Other potential question is: What kind of container could work alike "table" but also alike hashmaps/trees? How model a type that allow several "backends"? P.D: Originally here: https://www.reddit.com/r/ProgrammingLanguages/comments/awkdrb/for_a_relational_language_how_treat_kv_and/ but not good answers... so I ask here with a bit of more details. Streaming Language Rewrite Processing (SLRP)
The article develops a Turing complete foundation for a SLRP machine code based on concatenative combinatory logic, and sketches several extensions. The challenge is that the operands for a combinator may be larger than a processor's memory, e.g. for a copy operator ` Paper on ParaSail published in <Programming> journal V3.3; new release also availableWe very recently published a long-ish article on the ParaSail programming language (ParaSail = Parallel Specification and Implementation Language) in the relatively new Journal on the Art, Science, and Engineering of Programming, Volume 3, Issue 3: ParaSail: A Pointer-Free Pervasively-Parallel Language for Irregular Computations There is also a new (version 8.0) release of the ParaSail binaries (Linux, Mac, and partial Windows) and sources at: A direct download is available at: http://bit.ly/psl8rel By sttaft at 2019-02-10 19:01 | LtU Forum | login or register to post comments | other blogs | 3915 reads
Abstraction Tiers of NotationsDZone has published 3 my articles:
Few key points from them:
Note, I’ve described some elements of this model in some discussions on LtU previously. |
Browse archives
Active forum topics |
Recent comments
1 day 5 hours ago
2 days 2 hours ago
3 days 6 hours ago
3 days 7 hours ago
1 week 1 day ago
1 week 1 day ago
1 week 1 day ago
4 weeks 2 days ago
5 weeks 8 hours ago
5 weeks 14 hours ago