Install a full Haskell development environment (including hpack and cabal) on your Android phone. The command prompt runs via Termux and its PRoot (i.e. proot-distro).

F-Droid

Install F-Droid from f-droid.org (follow instructions).

Termux + PRoot

First install the Termux package via F-Droid and then follow the PRoot instructions to install a Linux distribution on your phone (I use Debian).

pkg install proot
pkg install proot-distro
proot-distro install debian

After installation has completed use the following to get a Debian prompt:

proot-distro login debian

Debian packages

A number of Debian packages are required and useful for your Haskell development environment. To install them start up Debian Linux under Termux (per instructions with PRoot) and type the following commands:

apt-get update
apt-get install build-essential curl vim-nox silversearcher-ag git ghc cabal-install hpack hlint stylish-haskell libghc-zlib-dev libpq-dev

Demonstration

Use the commands below to get and build my Paperspan export (HTML) to Instapaper import (CSV) convertor – Paperspan export (HTML) to Instapaper import (CSV) convertor.

git clone https://github.com/maridonkers/paperspan2instapaper.git
cd paperspan2instapaper
cabal update
hpack
cabal build
cp folders-example.yaml folders.yaml
cabal run . -- yourpaperspanexportfile.html

Notes:

  • • Depending on your phone the cabal new-update and cabal new-build may take a while to complete.
  • • If the build fails then simply start it again (I had to start it again once).

Termux sessions

If you require additional command prompts then simply swipe in from the left of the Termux window, to get the menu.

Select NEW SESSION in the menu.

OpenSSH and GUI

sshd

Modern phones are multi-core powerhouses with loads of memory and I’ve compiled big projects on my 2013 phone (a Samsung Note 3). The small on screen keyboard is a bit of a nuisance so you can run a SSH-server on your phone and ssh into it from a computer with a regular keyboard. Termux documentation is here: Remote Access.

GUI

You can also set up a graphical environment for your Termux installation, which enables you to run graphical programs from your termux prompt. Instructions here: Graphical Environment.

Screen dump