A Plethora of programs

Due Wednesday Oct 9th @ 9 am

From this assignment, students may show...

Software Ecosystem - Recognition

... through recognizing how to modify our stack haskell projects to match the environment for their domain e.g. environment variables, library dependencies, IO support, etc.

Functional Programming - Recognition

... through recognizing what skills we have learned in the class (likely the familiar functions for manipulating data structures and Monadic coding contexts like IO or State)

Technical Writing - Recognition

... through recognizing either a problem or an interesting topic in a domain and describing it with prose using the language of the class.

... in addition to other learning objectives students' feel their work accomplishes.

What do I need to turn in?

Update Note: These programs are intended to be plain 'ol haskell programs that show how users in your domain would write code "the hard way". We will use these programs as motivation for designing the language as we go.

Update Note2: These programs need not run nor compile. We'd be happy if you stubbed types and functions, like the examples do, to make a "wish list" of what functionality your domain depends on, but you are not expected to be expert programmers in your domain at this time. We are using this exercise to both motivate the writing prompt with concrete details and let you "try" a domain to see if it is a good fit.

6 domain specific programs

Please sketch 6 domain specific programs. Either all 6 in one domain, or 3 in two domains. This exact number is flexible, but 6 is how many we estimate you will need to accomplish the prescribed learning objectives. See the examples below to get a feel for what we mean by a domain-specific program.

1 Paragraph prose

Please select one of the domains you wrote programs in and write a paragraph of prose that:

Note: We will be using this prose in class on Wednesday to fuel discussion.

Examples to look at

Here are two toy examples. These examples show the average level of detail and functionality I expect of your programs for this assignment. They each explore their domain differently, asking different questions. Before each code example is an example of the prose I would expect.

Timed Hardware Computation

For single threaded, arduino-like programming, programmers insert delay statements between atomic blocks of computation to time them. For all of the included example programs, the programmer has to calculate how much time to spend between each computation in order to transform the n values of input data into m values of output data; these examples use a runtime library to track time spent. The programs show increasing complexity; the approach of figuring out the delay statements by hand becomes complicated as the number of inputs and outputs grow and have interdependencies. The programmer's task would be easier if they were told at compile time how much time was the program has spent and how many values have been transformed.

The code for these examples can be found here

Command Line Lockstep Platformer

I enjoy making platformer games where a character can jump around a stage of tiles; they can be played in the command line where time passes when I press a key to move left, right or jump up. These examples show how I iterated representing levels tiles -- first in a 2d array and then as a map. I changed my representation to map be more efficient or flexible, but generating content got less visually intuitive. Perhaps, a concrete syntax that enables me express levels easily, but with an efficient runtime representation, would make playing in this design space more fun for me.

The code for these examples can be found here

Examples to aspire to

Here are two example programming domains that I think show good application programming in haskell. Use these for inspiration, but their depth and detail are not what you are expected to do in under 4 hours for a homework.

Red 7 Card Game

Written by Karl, a library of functions to script instances of the card game Red 7

GPipe Monadic Combinator library for Graphics Programming

This graphics library represents programming graphical shaders (small programs that run in parallel on the GPU) as a monadic combinator library.

Guiding Advice

What is a domain?

You can think of a domain as either a particular kind of application/result. E.g. websites, annotated text or natural language processing, a game (video, card, board, etc.), a datastructure and api for using it, a static or dynamic analysis, etc.

You may instead want to think of a domain as a field of expertise. E.g. electronic music , animation, baking, dancing , computer assisted drafting, logic puzzles, etc.

In this class, as you have seen in the DSL papers and will continue to see, we will support either definition. Usually a field of expertise has a small collection of applications or artifacts to represent the work of that field.

How do I pick a domain?

Thinking of what category of programs you want to make might be the second most challenging task of this course; trying to figure out what utility your language will provide for those programs might be then the most challenging. To make it easier, keep in mind your work doesn't have to be novel. We care more about your thoughtful analysis and design decision (i.e. life long skills) than the industry grade utility of your language. However, your language will be more fun to work on if it is something at least one person wants to use (hopefully you!).

This is a good opportunity to ask for help from your classmates or us instructors about what domain you should pick. You get to do two domains for this assignment so you can try them before you buy them (for the final project).

I have a domain, but I don't think it'll be good for a language

Some students have asked domain-picking questions that require us to look ahead at where we are going in this course. If planning ahead will help pick a domain for this assignment, then read this section; otherwise, skip this section to focus on writing example programs without worry.

Rather than the counterpoint framing e.g. a library vs a language, consider that you are growing a library into a language. In both cases, you will write code that supports computation at runtime and package this code as a library -- even if only you use the library while implementing your language. In fact, figuring out what your domain would need from a runtime library is a desired effect of having you write small example programs for this homework.

In addition to that runtime support, you will answer the question "What can I generate at compile time?". Visualizations, static analysis, helper functions, custom types, and more are all good candidates. Any answers to this question should help you feel confident that you can grow your runtime library into a library + a compiler.

From a user's perspective, you may answer instead "What can I do for my users given their code and knoweldge of what kind of program they are writing?". You may find interesting ways of using IO at compile time to integrate with other software, provide debugging tools, or support the concrete syntax of the domain. Any answers to this should help you feel confident that you can grow your library into a library + IDE support.

If neither of these questions inspire any answers and you are still stuck, then the domain might not be a good fit. Most likely, the domain as you currently imagine it is too broad. Try narrowing the scope of the domain to programs that produce only one artifact -- e.g. every opertion is defined in terms of one type-to-rule-them-all -- or perform a particular function -- e.g. everything has to adhere to a typeclass your runtime relies on -- within that domain. The less unknowns you have, the easier it typically is to explore the design space.

Optional META.md

META.md should include
  1. your name
  2. your utln
  3. how much time you spent on this assignment
  4. the witness "proof" for how you earned each learning objective with a note about what from the class you recognized in the problem space.

Please Submit

Contents to be submitted

Method of submission

Please commit your changes in the hw10-1 directory of your private repo and push them to the remote server before 9 am.