Live data from Hacker News

Solving `Passport Application` with Haskell

jameshaydon.github.io

121–130 of 131 posts

Re: Solving `Passport Application` with Haskell

#121
post #66

Earlier quoted context omitted.

I recently renewed my passport in France. There is a new-ish platform here for every document one might want to obtain. I had one form to complete online, that was rather easy to follow. I then had to go to the office once to finish the process. That took only 10 minutes and then the passport was delivered. As painless as can be, I believe. Whatever the situation is in the UK, it is not hopeless. The government needs…

as a French citizen, I find that surprising. While renewing a passport is one of the easiest things you can do, I distinctively remember it taking a good half-day (most of which is waiting in line jumping from one desk to another until you find someone that can check all the documents you provided are satisfactory and sign off for you). Now however, if it's not a renewal but a new application, the difficulty sharply…

Even Germany has this figured out. Getting a new passport just required me to make an appointment, fill out an online form and go to the appointment with a single person. The only document I needed was my personal ID. Took like 15 minutes, not including the wait before I was called up. I feel like if Germany can get its shit together, any other country can too.

If you're applying for your very first personal ID, then you need to bring a birth certificate and another adult who already has an ID, but it's also something that's been trivial to do for years now.

Re: Solving `Passport Application` with Haskell

#122
post #116

Earlier quoted context omitted.

err, no the perl6 guys ended up inventing the new perl (now renamed raku) https://rakujourney.wordpress.com/2024/10/12/raku-burritos/ the first perl6 parser (pugs) was written in Haskell btw

I'm aware. I was using the world pejoratively. Combinator style degrades into line noise.

no doubt its fashionable to think "perl == line noise == bad"

however, there are certain sub languages (slangs) where the use of punctuation chars as operators is very helpful, of course regex is the most compelling where the code is parsing one char at a time

  my regex url {
    ^                                # Start of line
    [ s? '://']                # Match http or https
    ['www.' ]?                       # Optional www.
    [+ '.' ]+                # One or more domain segments
     ** 2..6                 # TLD, 2 to 6 lowercase letters
    [ '/' * ]?         # Optional path/query
    $                                # End of line
  }
imo raku has improved the situation a lot by introducing "regex 2.0" with deep support for unicode and with built in grammars that can work smoothly with regex

Re: Solving `Passport Application` with Haskell

#123

Haskell itself is an amazing language once it "clicks". But all the tooling around Haskell is just really bad.

> all the tooling around Haskell is just really bad. No it isn’t. This is a stupid meme that people just dogmatically perpetuate.

[dead]

Re: Solving `Passport Application` with Haskell

#124

Earlier quoted context omitted.

In my case, as a British citizen married to a European living outside the UK, I had way fewer requests/demands for documentation. All I needed to do was submit my own details, and a copy of both the marriage certificate and birth certificate for the child. The assumption was made that as a married couple the child had me as the father, and as I'm British then so were they. No references at all to grandparents, or eve…

Were you born before 1983? It seems that makes it easier

Maybe that's the difference, but yes I was.

Re: Solving `Passport Application` with Haskell

#125
post #106

Earlier quoted context omitted.

Many countries simply have no way of knowing who their citizens are. People born abroad are often citizens. The British have had an insane number of changes in territory that affect citizenship. Some of their current citizens have citizenship because they were born in Bombay (Mumbai). Others because they were born in Hong Kong. Maintaining a reliable list of citizens requires regular registration, and loosing citizen…

Even in that case it would probably enough to prove your citizenship once to get into the database.

It would have to be combine with other databases. A death index, at the least.

Re: Solving `Passport Application` with Haskell

#126
post #116

Earlier quoted context omitted.

I'm aware. I was using the world pejoratively. Combinator style degrades into line noise.

no doubt its fashionable to think "perl == line noise == bad" however, there are certain sub languages (slangs) where the use of punctuation chars as operators is very helpful, of course regex is the most compelling where the code is parsing one char at a time my regex url { ^ # Start of line [ s? '://'] # Match http or https ['www.' ]? # Optional www. [ + '.' ]+ # One or more domain segments ** 2..6 # TLD, 2 to 6 lo…

Ahh not sure I agree. The reputation for being unreadable is pretty well deserved. It didn't happen for no reason.

Re: Solving `Passport Application` with Haskell

#127
post #126

Earlier quoted context omitted.

no doubt its fashionable to think "perl == line noise == bad" however, there are certain sub languages (slangs) where the use of punctuation chars as operators is very helpful, of course regex is the most compelling where the code is parsing one char at a time my regex url { ^ # Start of line [ s? '://'] # Match http or https ['www.' ]? # Optional www. [ + '.' ]+ # One or more domain segments ** 2..6 # TLD, 2 to 6 lo…

Ahh not sure I agree. The reputation for being unreadable is pretty well deserved. It didn't happen for no reason.

ok - I agree that there was a culture of golfing and obscurity in some sections of the perl coder base

it was inevitable that a simpler language - Python - would take the big slice of scripters who wanted something easier to learn and to read

I'm sad that perl no longer has a credible niche for script level coders who want to learn a more powerful and more expressive language than Python ...

Re: Solving `Passport Application` with Haskell

#128
post #31

Earlier quoted context omitted.

At some point, I did a rough count, and the number of operators you encounter in "normal" Haskell code—avoiding lens or domain-specific libraries—was pretty close to the number of operators you'd encounter in, say, JavaScript. This was a while ago and I don't want to redo the exercise now, but, even if we're being generous to JavaScript, practical Haskell needs on the order of 2x as many operators as practical JavaSc…

> practical Haskell needs on the order of 2x as many operators as practical JavaScript, not 10x. Yeah but the JavaScript operators are almost all universally understood. There are some exceptions and mistakes, like `===` which shouldn't exist, and `.?` which is new but fairly standard. But most of the operators are just standard maths stuff, normal array/field accesses, etc. Haskell has normal operators plus a bunch…

Haskell operators are generally well-chosen to have a consistent visual language:

* $ is "function application" - f $ x = f x, but lets you elide nested parens: f $ g $ h x = f (g (h x))

* & is "reverse function application" x & f = f x. This reads nicely in pipelines as "and"

* is "fmap" what is like a lifted application over a structure: f [1, 2, 3] = [f 1, f 2, f 3]

* is "reverse fmap", which is nice when you have a big lambda

* Anything in brackets is generally a "lifted" version of some operator

* And so on

Re: Solving `Passport Application` with Haskell

#129

I've worked on a variety of large UK government systems for the past ten years. This blog encapsulates the problem of writing government services/software, which often results in strange outcomes. Writing software for government is essentially the codification of centuries worth of Acts of Parliament. Now imagine building the HMPO passport system, and then some underlying Law/Act is changed or repealed etc. Now someo…

This problem of law being essentially an append only repository of amendments is not unique to the UK.

I'd be cool to have a system that just needs to be fed "patches" in an append only way instead of having to scatter exceptions (if branches) all around.

Some logic programming languages can do that a little bit, but I think that the real problem is that there's no tech debt budget, and lawyers working around the laws can also profit from things being complicated. It'd be cool to have people devoted to simply laws to keep things as simple as possible.

Re: Solving `Passport Application` with Haskell

#130

I have noticed in Japan the crazy bureaucratization of document applications in the 7-8 years I've been living here. I've had 2 Japanese documents expire, "MyNumber" and "Driving License" in these years, and when trying to re-obtain them the process has become MUCH more complex. I'm bad at remembering all these processes in detail, but these are from memory: - For the mynumber, first time, it was a simple application…

Ha! I go to Japan every now and then, as I have friends there, and I've though a couple times about doing the Japanese driving license thing, that looked super easy back at the time (translate your current driving license, book a meeting in the exam center, do a short exam, and you're almost good to go). I was thinking about doing it in my next trip in two weeks, but seems like they've raised the difficulty several l…

A friend lives there, he said basically:

if you drive on the right at home, they will fail you the first time on principle. If you drive on the left (aus, brit) you have a chance to pass the first time.

Post reply on HN