Easy concurrency with functional programming

My most recent project was an Android REPL application that reads an expression, sends a GET request to a server and then receives the result of evaluating that expression from an interpreter on the server. Network programming is admittedly very error prone (a lot can go wrong), and network requests sometimes take a long time to process. For this reason, Android prevents applications from running network tasks on the UI thread. However, the Android API provides some concurrency mechanisms for dealing with network I/O, the most common being AsyncTask. AsyncTask is a class for running tasks in the background and defining what happens before, during, and after task execution. The AsyncTask class, crucially, allows the user to edit/change a view after the operation in a way that running a normal thread doesn’t. The syntax is quite involved and considering I only wanted to define two behaviours - downloading and getting results - AsyncTask feels like overkill.

Read More

Try Frege Android

When I initially started learning Haskell I’d always want to run ad hoc code on my phone from books like RWH and LYAH. The only mobile application that was available was TryHaskell which provided a thin veneer over the haskell website TryHaskell and ironically didn’t let you define functions. I discovered the Frege REPL and used it for a lot of my discrete math assignments on ChromeBook and thought it would be helpful to provide and Android wrapper.

Read More

OpenGL on froid

The design and implementation of froid continues. I am currently finishing up Criminal Intent from the BigNerd Ranch Android programming book. After work on Criminal Intent is done I will push the changes along with the application to a repository and that will mark version 0.0.2 of froid.

Read More

Functional inheritance in Android

I’ve spent the past few works working on what I decided to call froid, a library/framework for writing Android applications in Frege. Because I want the library to be usable to write entire Android applications with ease, my method of developing the library has proceeded as follows:

Read More

Frege on Android

After a weekend of clicking through forums and reading about previous attempts I’ve finally gotten Frege to work on Android. The implementation can be found here

Read More

A simple server in Frege

I’ve always liked working in Java because the packages are extensive and are usually well documented. However, I prefer working in functional languages because functional languages do a better job of enforcing modularity. Frege seems to be the sweet spot between these two concerns (I haven’t looked into ETA yet but it seems promising too). So I took it upon myself to try and write a simple HTTP server in Frege using Java SE (if you count the sun packages as part of Java SE proper).

Read More