Posted by Alex Korban on Sun, 11/17/2019 - 02:00

Creating UIs with CSS is rarely as straightforward as you expect.

A few weeks ago I wanted to make the navigation on my site responsive, having it switch from a row of links to a hamburger slideout menu. Seems like a reasonable thing to do with CSS, right?

Not really. As often happens, I tried a few reasonable things -- they didn't work. I started searching for solutions -- most involved JavaScript.

I finally found a solution that was CSS-only, and then spent a couple of hours trying differe...

Posted by Alex Korban on Tue, 12/11/2018 - 02:00

Crafting a nice UI can suck up a lot of time due to its stateful nature. We're all familiar with this cycle: make some tweaks, reload the app, navigate to the relevant page, click around and type for a while to get the right state, only to see that the spacing in one of the dropdowns still doesn't look quite right. Rinse and repeat.

If you use something like elm-live, you can cut out the reload step and have it done automatically on every code change. But you still need to do the rest of the s...

Posted by Alex Korban on Wed, 11/28/2018 - 02:00

I've published the Elm 0.19 update of my book, Practical Elm for a Busy Developer. This update is also based on the latest versions of elm-ui and elm-test packages.

Why Elm?

If you're not familiar with Elm, why would you choose it? There are many good reasons, whether your goal is to broaden your knowledge or to find a new language to use for production applications. Here are a few:

Its goal is to produce no runtime exceptions
It can be a relatively easy introduction to functional programmin...

Posted by Alex Korban on Tue, 11/27/2018 - 02:00

In addition to the two hardest problems in computer science — cache invalidation and naming things — I would add one more, which is dealing with user input via forms.

Somehow, forms tend to evolve into a tangle of interdependencies between fields and byzantine validation rules. "This field is optional based on particular values of three other fields, and not shown at all if another checkbox is selected (but we still want the corresponding value to be calculated as an average of the...

Posted by Alex Korban on Fri, 11/23/2018 - 02:00

It's not so easy to keep up with what's going on in the Elm world these days. On one hand, as the language becomes more popular, the volume of posts on Discourse and the traffic on Slack is going up. On the other hand, I'm still often surprised to run into an interesting article or a useful package that slipped under the radar.

Other languages and technologies have weekly digest emails -- JavaScript Weekly, React Weekly, Haskell Weekly etc. These can be very helpful for keeping up to date. Eve...

Posted by Alex Korban on Wed, 11/21/2018 - 02:00

You have a bug in your view that only shows up sometimes, under as-yet-undetermined conditions, but the problem is that this view is part of a specific workflow in the application, so you have to get to the right page, fill out a form and click through a couple of dialogs before you can even see if the view is displaying correctly. If not, it's back to tweaking the code to introduce a potential fix, then reload the application, and start over to get to the view again. Does this sound familiar?

Posted by Gizra on Fri, 10/26/2018 - 08:00

After almost one year, and that $1.6M for a single item we had a couple more (big) sales that are worth talking about.

If you expect this to be a pat on the shoulder kind of post, where I’m talking about some hyped tech stack, sprinkled with the words “you can just”, and “simply” - while describing some incredible success, I can assure you it is not that.

It is, however, also not a “we have completely failed” self reflection.

Like every good story, it’s somewhere in the middle.

The Exciting World of Stamps

Many years ago, when Brice and me founded Gizra, we decided “No gambling, and no porn.” It’s our “Do no evil” equivalent. Along all the life of Gizra we always had at least one entrepreneurial project going on in different fields and areas. On all of them we just lost money. I’m not saying it necessarily as a bad thing - one needs to know how to lose money; but obviously it would be hard to tell it as a good thing.

Even in the beginning days, we knew something that we know also now - as a service provider there’s a very clear glass ceiling. Take the number of developers you have, multiple by your hourly rate, number of working hours, and that’s your your optimal revenue. Reduce at least 15% (and probably way more, unless you are very minded about efficiency) and now you have a realistic revenue. Building websites is a tough market, and it’s never getting easy - but it pays the salaries and all things considered, I think it’s worth it.

While we are blessed with some really fancy clients, and we are already established in the international Drupal & Elm market, we wanted to have a product. I tend to joke that I already know all the pain points of being a service provider, so it’s about time I know also the ones of having a product.

Five years ago Yoav entered our door with the idea of CircuitAuction - a system for auction houses (the “going once… going twice…” type). Yoav was born to a family of stamps collectors and was also a Drupaler. He knew building the system he dreamed of was above his pay grade, so he contacted us.

Boy, did we suck. Not just Gizra. Also Yoav. There was a really good division between us in terms of suckiness. If you think I’m harsh with myself, picture yourself five years ago, and tell yourself what you think of past you.

Continue reading…

Posted by Alex Korban on Fri, 10/12/2018 - 03:00

I saw a tweet from someone who was confused by the missing section in the URL Parsing chapter of the Elm 0.19 guide.

The chapter shows several examples of URL parsers made with Url.Parser, but the Synthesis section at the end is just a TODO. However, the section does suggest what should be in it:

> The major new things are:
> 1. Our update parses the URL when it gets a UrlChanged message.
> 2. Our view function shows different content for different addresses!
> It is really not too fancy. N...

Posted by Alex Korban on Tue, 10/09/2018 - 03:00

If you use Ellie for quick non-interactive experiments like I do when playing with different language features or trying out API ideas, you probably find yourself either deleting the default code that a new Ellie is populated with, or somewhat awkwardly adding bits to it.

I kept doing that for a while, and finally I decided to document a minimal boilerplate for static content:

module Main exposing (main)

import Browser
import Html exposing (text)

main : Program () () Never
main =

Posted by Alex Korban on Tue, 10/02/2018 - 03:00

I was gearing up to publish my first package, and was a bit surprised that I was unable to find an explanation of the basic steps involved. There are a couple of posts for Elm 0.18 but they are out of date now, so I decided to write down all the things I had to do as I went. Granted, the steps are quite straightforward, as you will see, but it's still a bit of a barrier when they aren't spelled out (or at least a great excuse to procrastinate for me)!

You can get started the same way as you wo...

Posted by Alex Korban on Mon, 09/17/2018 - 03:00

[Note: I wrote this post from the point of view of an Elm developer, however aside from a few Elm related notes, it's really just an introduction to custom elements and Shadow DOM. There isn't any Elm code in this post - it's all JavaScript.]

Quite often, you may need to integrate a complex JavaScript UI component into your Elm application, like a rich text editor, or a calendar, or an image editor, or some kind of visualisation. Such components usually have a lot of state, so you might be con...

Posted by Alex Korban on Wed, 09/12/2018 - 03:00

In Practical Elm, I discuss at length how to convert a complex JSON string containing nested objects, arrays and recursion into Elm values.

But what about the opposite conversion, from Elm values to a JSON string? We often need to make requests to a server which include data in JSON format. For example, you might be working with a database like MongoDB or CouchDB, and you might need to get a JSON document from it, modify it in some way, and then send it back to the server.

In JavaScript, conv...

Posted by Alex Korban on Fri, 09/07/2018 - 03:00

Do you need to deal with some kind of structured data which is not in JSON format and too complex for regular expressions? Or perhaps you have to validate some kind of complex user input? Or maybe you need to report to users what exactly is wrong with the data?
One of the packages in the Elm core library which can help you with such tasks is elm/parser.
First of all, if you're not familiar with parsing, what is it? A parser allows us to take a string as input and to convert it into Elm values a...

Posted by Alex Korban on Tue, 09/04/2018 - 03:00

I'd like to give you a couple of updates on Elm 0.19 in this post.

But first, an announcement about my book, Practical Elm for a Busy Developer: I'm going to publish the final release on 18 September.

If nothing else, this will force me to finish the last round of proofreading and tweaks!

I would have liked to finish the book earlier, but I also wanted to make it maximally useful to you, so it took a bit longer. I ended up adding extra content, and the latest draft is over 200 pages. I've ad...

Posted by Alex Korban on Wed, 08/22/2018 - 03:00

This morning, my Twitter timeline was abuzz with exciting news: Elm 0.19 has been released!

The official announcement focused on the big ticket items: impressive reductions in the size of the generated JavaScript and no less impressive improvements in compilation speed. Those are very good things, but I wanted to provide a more comprehensive list (including some stuff that didn't make it into the release notes either).


Language changes

Nothing major has been added but a few things h...