Migrating a REST API from Javascript to Haskell

Background

For just over a year, I’ve been running the JTime project, which consists of a REST API, an Android app and a website, the latter two of which talk to the REST API. The JTime project allows me to see nearby prayer times. I don’t advertise it, as it is more of an educational project to try new technologies, and I just don’t want to be promoting it in case people think I’m clever for having made it (I don’t like showing off, and generally the people around me are non-programmers). So barely anyone uses it.

Read more

Switching to Hugo

Over the course of my life, I have used various blogging framework thingies. IIRC I have used wordpress and blogger at some points in the past, followed by fireblog, which was made by me. I have had several issues with fireblog:

  1. It is dynamic. I could change it into an SSG or a static/dynamic hybrid thing, but I can’t be bothered at this point in time.
  2. It is slow. The reason for this is that the server has been on a slow connection, on a slow server with a dynamic ip address.

So, I am now switching to hugo, hosted on gitlab pages. So I don’t have to worry about hosting costs, and I get a versioned history of everything. And hugo has lots of themes.

Read more

Thoughts on Haskell

Over the past few months, I have been learning haskell. It is truly an amazing language, unlike the heavyweight languages (Java, Python, C#), with a lot of innovative features in it. This is probably due to it being originally (although it still is) a research language, though it does seem very capable for use in production. Here are a few of my thoughts about it so far.

  • GHC, the standard compiler/interpreter, is awesome. The compiler times could be faster, but the executables it produces are very fast.
  • The language is very beautiful. To give an example: fibs = 0:1:(map (\n -> fibs!!n + fibs!!(n+1)) [0..]) is an infinite list of the Fibonacci numbers. It is not the fastest way of doing this (matrix exponentiation is really fast) but it is very good in terms of performance.
  • The level of support for higher order functions and currying is really good. In particular, I like the way function types are expressed, eg func :: Integer -> Integer -> String is a function that takes 2 numbers and returns a string. It can also be thought of (and used) as a function that takes one number and returns a new function, that takes one number and returns a string. This builtin currying allows for simplifying various problems in a beautiful way.
  • The type system is really powerful. Writing functions that work on classes of types is very straightforward, and type inference means that a lot of the time, you don’t need to write types. Although standard practice is to write out the types of functions, purely to help people reading the code. Often, you can just let ghc figure out what the type of a function is, and just copy paste it back into your code for documentation.
  • There are a lot of extensions built into GHC, and these extensions can be enabled on a file by file basis by adding flags at the top of the file.

I also have issues with haskell:

Read more

My ideal todo list app

The todo list app has been done again and again and again, yet I always seem to have some gripe with each of the ones I have used. ATM, I use Google Keep as it gets most things right. What follows are some of the features that I deem important for such an app to have:

  1. Queues.
    1. Sequence of subtasks that are dependent on the previous one being completed.
    2. Better would be graph support. And then the usual decision tree analysis to find the critical path, max/min time to do all tasks.
    3. Of course, this can get quite complicated, and it would have to be kept as simple as possible whilst still being very flexible.
  2. Tags
    1. Basically being able to group tasks, but more flexible than mutually exclusive categories.
  3. Reminders
    1. This is a killer feature, and the reason why I don’t use other tools eg Trello, evernote.
    2. Reminders have to be customisable. I should be able to set a specific time/day, and be able to recur the reminder, and have sensible defaults for saying that “I’ll do it in an hour, not right now” when a reminder comes up.
    3. IMO, Google keep does this quite well.

Before you ask, I have no plans to actually create yet-another-todo-list-app. It feels like it is way too crowded at the moment, and I feel more that I simply haven’t tried enough to find the best one for me.

Read more

New Simple Theme

I’ve just merged in a new theme, which I’ve called “simple”. Because it is meant to be dirt simple. And it is. For at least the next few hours, this blog will provide a demo of it. There are still various tweaks I should make to it, maybe add a splash of colour, resize things, but it at least passes the tests.

Read more

Blog is now running the latest code

Since I put the blog source code onto Github, I have been working on the code there, fixing bugs and stuff. With the code being on Github, I can work more easily and frequently on the code, but for the past few weeks I haven’t been updating the code this blog itself is running, as it would require a bit of effort and I’ve been busy.

Well, I have just redeployed this blog with the latest code. I have fixed some bugs around caching, made changes to urls and how posts are looked up (a big change to make), started improving pages that show multiple posts, and other stuff. In short, I’ve been busy improving stuff. The funny thing is that you shouldn’t really notice all of those things…

Read more

Source code for the blog is now on Github

Yes, you read that correctly. The source code that runs this blog is now on Github. Unfortunately I am not good at coming up with names, and fireblog was the best I could think of.

Putting the source code on Github helps me in several ways:

  1. Showing people the code is way easier.
  2. Working on the code is possible from pretty much any decent computer with Internet.
  3. Open source is cool and all that stuff…
Read more

Site is now online (after yet more downtime)

Yes, I know, for the past few days the site has been offline. I played around with partitions, and as always assumed that I would be able to get the site up and running in only a few hours.

How wrong I was.

I had to compile python twice as I hadn’t installed various packages before the first compilation. And the compilation takes ages. And then even the package server thing I was using went down for a while due to dns changes on their end.

Read more

Using quip to write a report

Over the past few months, I have been writing a report on what I was doing during my year on placement. During this year I have mainly been testing a booking system for the NHS, but I am not talking about what I did during the year in this post.(I also am not sharing the report here, but if you email me, I may be able to give it to you.) Instead, I want to talk about how I made the report.

Read more

Temporary dropping of SSL

You may have noticed that the website no longer is using ssl/tls. Before, I was using cloudflare. On their end, there were some issues which have meant that I’ve decided to remove them from the loop for the moment. Of course, this does remove a layer of protection, but I am relying on extremely low traffic. And this is definitely not a mission critical website by any means. Anyways, I have been working no decoupling the code for this website to make it easier to maintain. And hopefully, it will allow me to have more fine-grained caching too. I have also increased the thoroughness of the automated testing and just basically tried to do non-visible changes. So no functional changes whatsoever. There are still one or 2 more things to do before deploying this new code, and I need to fit this in around my other commitments. Meh.

Read more