cycles
u/cycles
getRHLines can be written nicely with the new aeson-lens package (which is fantastic):
import Control.Lens import Data.Aeson.Lens getRHLines :: Value -> Maybe Integer getRHLines json = json ^. key "lines"
As long as you can produce a Value (which you can get via a decode and the case analysis to make sure the parse succeed), you can maybe get the lines property out of it, by looking at the "lines" path. If the Value isn't an Object this will fail, and it will also fail if there is no 'lines' key, or if the 'lines' key is not an integer. All of this in hardly any characters!
That's a good point, I've never tinkered in GHC but I should at some point, I don't want it to remain a black box to me. I wonder what percentage of Haskellers have hacked on GHC?
Not enough, I'd bet. There a few open GADT bugs that are bothering me in some of my own code atm, I might use both these bugs and this post as motivation to sort it out!
http://joyridelabs.de/game/ looks perfectly 'real world' and 'usable' to me. Maybe it's time we stopped the 'Haskell is only academic' meme?