Panda has 1068 SLOC

Wow, I didn't expect that.

I spent a morning refactoring the code.

  • More static typing: configuration options used to be runtime strings, it's now checked by the compiler.
1
2
3
4
5
6
7
8
9
data ConfigData = 
BlogTitle
| BlogSubtitle
| HostName
| AuthorEmail
| PerPage
| Navigation
| Root
...
  • Default value: use data-default
1
2
instance Default State where
def = State def def def def def def
  • Rails style humanized string conversion
1
show_data = show >>> snake_case

In conclusion, the code gets better ( I think ... ), yet correctness maintained, for not that I'm any good, quite the contrary, I suck. Then why I'm still blindly happily refactoring code without sophisticated tools or test suites as backups?

Haskell rocks

Tests are useful for sure, but coming from a dynamic world, trained to spec everything and constantly hold every piece of code in addition to the runtime in mind, Haskell just feels simple, relaxed :)

BTW, Panda is big enough. I used to hope to keep the code size under 700, but it didn't work out :) This is it. If more features are to be added, they should come as extensions. Though I need to find out a way to do that first...

blog comments powered by Disqus