Proper Treatment 正當作法/ blog/ posts/ There’s no type class like Show type class
標籤 Tags:
2008-08-17 19:19

(Sing to the tune of “There’s no business like show business”)

There’s no type class like Show type class
Like no type class I know
Everything about it is deriving
Everything the standard talks about
No where could you start evaluating
When you aren’t writing to standard-out

There’s no instance like Show instance
They scale when programs grow
Yesterday they hired you at the software firm
That night you opened and closed the term
Nothing ever can go wrong, the types confirm
Let’s go on with the show

The spaces, the brackets, the infix with ease
The monad that lifts you when you’re down
The state threads, the functions, the infinite trees
The boilerplate that makes Ralf Lämmel frown
To simulate a quantified constraint
To wish that superclass of Num it ain’t

There’s no type class like Show type class
If you tell me it’s so
Polymorphic recursion’s so thrilling
Overloading gives you such a blast
Smiling as you watch the console filling
And see your functions composing fast

There’s no instance like Show instance
They scale when programs grow
Even with some data that you know will fold
The type checker may find that you’re too bold
Still you wouldn’t wait till run-time to be told
Let’s go on with the show
Let’s go on with the show

(Thanks to Dylan Thurston, the original lyrics online, and RhymeZone.)