Live data from Hacker News

Cutting through the smog: making an air quality bot with Haskell

engineering.linecorp.com

1–10 of 12 posts

Re: Cutting through the smog: making an air quality bot with Haskell

#3
I know it is hard to strike a good balance between academic and technical focus, especially when writing about haskell, but I think starting out with language extensions and imports without writing about what and how we're going to do it, makes for difficult reading.

The smaller parts with the types and small implementations should be at the top and only at the end all is easily combined.

And I highly doubt that the author went about writing the chatbot by writing out all the language extensions and imports first (which makes the coding-along line at the and a bit cynical).

Edit: This sounds so negative. I think the article is good and shows how the small pieces work together but I think the order is all wrong.

Re: Cutting through the smog: making an air quality bot with Haskell

#4
I've been working on a side project related to the air quality too, for a few months now. However, the technology stack is less impressive than Haskell: plain PHP7 + MySQL. I just wanted to have a single page presenting the air quality stats [1], fetched from the DIY detector Luftdaten [2], that can be hosted anywhere (so other people can grab the code from github [3] and use it too).

Then, people started to requesting new features and I had ideas for new features and it was no longer a single-page project.

Then, people started to reporting issues with their PHP hosting accounts, so I was spending time debugging problems in their deployments.

Then, I thought it may be easier to introduce multi-tenancy so I can just support a single environment, the one that I own. So I added registration, dashboard, maps, Let's Encrypt, etc.

This way I ended up owning a small, open-source SaaS written in PHP7 and MySQL [4]. If I knew how my single-page app will grow, I'd choose something more suitable, like Rails or Dropwizard. On the other hand, it works, is usable and maintainable, so maybe it's fine the way it is.

[1] https://smolna.aqi.eco/ [2] https://luftdaten.info/ [3] https://github.com/trekawek/air-quality-info/ [4] https://aqi.eco/

Re: Cutting through the smog: making an air quality bot with Haskell

#5
post #3

I know it is hard to strike a good balance between academic and technical focus, especially when writing about haskell, but I think starting out with language extensions and imports without writing about what and how we're going to do it, makes for difficult reading. The smaller parts with the types and small implementations should be at the top and only at the end all is easily combined. And I highly doubt that the…

Hi, author here. I agree that straight away throwing a bunch of language extensions without an explanation of why we need them at all wasn't a good idea. The original blog post was written in literate Haskell, that's the reason why the code is organized that way.

I will think about rearranging the code blocks or add more explanations to make it all fit more naturally. Thanks for your feedback!

Re: Cutting through the smog: making an air quality bot with Haskell

#6
post #5
post #3

I know it is hard to strike a good balance between academic and technical focus, especially when writing about haskell, but I think starting out with language extensions and imports without writing about what and how we're going to do it, makes for difficult reading. The smaller parts with the types and small implementations should be at the top and only at the end all is easily combined. And I highly doubt that the…

Hi, author here. I agree that straight away throwing a bunch of language extensions without an explanation of why we need them at all wasn't a good idea. The original blog post was written in literate Haskell, that's the reason why the code is organized that way. I will think about rearranging the code blocks or add more explanations to make it all fit more naturally. Thanks for your feedback!

When I teach or write about Haskell I try to break down the parts in a way that the parts can be tested using ghci and just composing it at the end.

I think there are quite a few parts in there that one can easily "try out on their own".

Re: Cutting through the smog: making an air quality bot with Haskell

#7
On a related note, I've been looking for a good sensor that is hopefully plug & play and reliable for integration with home assistant. Is something like https://www.banggood.com/Geekcreit-Nova-PM-Sensor-SDS011-Hig... really the best way to go about it rather than an Awair? Would be keen on VOCs and CO2 as well.

edit: Looks like esphome with the following low-cost sensors is the way to go: * MH-Z19 for co2 (or CCS811 CO_2 for VOCs as well) * SDS011 for particle counts

Re: Cutting through the smog: making an air quality bot with Haskell

#8

On a related note, I've been looking for a good sensor that is hopefully plug & play and reliable for integration with home assistant. Is something like https://www.banggood.com/Geekcreit-Nova-PM-Sensor-SDS011-Hig... really the best way to go about it rather than an Awair? Would be keen on VOCs and CO2 as well. edit: Looks like esphome with the following low-cost sensors is the way to go: * MH-Z19 for co2 (or CCS811…

This looks like an interesting project: https://learn.pimoroni.com/tutorial/sandyj/enviro-plus-and-l...

This sensor also looks good: https://shop.pimoroni.com/products/adafruit-sgp30-air-qualit...

Post reply on HN