I don't really blog anymore. Click here to go to my main website.

muhuk's blog

Nature, to Be Commanded, Must Be Obeyed

September 29, 2013

Unified Support for Numbers in Scala

If you are using Scala, you must have noticed that numeric types do not have a supertype that encapsulates common beheavior. For instance in order to support both Double’s and Float’s in your function you have to do one of the following:

// Use multiple function signatures:

def foo(bar: Double): Double = {
    ...
}

def foo(bar: Float): Float = {
    ...
}

// or use pattern matching:

def foo(bar: AnyVal): Double = {
    bar match {
        case barAsDouble: Double => ...
        case barAsFloat: Float => ...
        case _ => ...
    }
}

There will be a little duplication if you need this in just one place. But your code will quickly get unpleasantly bulky if you need to this in many places.

Enter Numeric! It’s a type class[1] that provides a unified interface for all numeric types. And the cool thing is you can easily extend it. Let’s first cover usage.

Read more...


September 16, 2013

Is Technology Disconnecting Us

This was a wake up call for me:

Technology is neither good nor bad. It is a reflection of us, you know.

So I don’t think technology makes us do anything. I think it’s our personalities that are, you know, expressed through all these devices that we have.

—Alex Rubin

Read more...


August 03, 2013

Just Wait Released

I have finally finished the last things I had planned for Just Wait. You can download and play it for free here. Let me know what you think.


July 10, 2013

On Recognition

If you think Aragorn kneels before hobbits because The Ring is destroyed, you are completely missing the point. It is a gesture in recognition of their morals, regardless of what has transpired. There was a certain expectation of how they would act. Humans, elves, dwarves, even other halflings expected them to cower in fear at the first sign of trouble. They were supposed to crawl in a hole and hide. But these hobbits discovered their virtuous selves through the hardships they faced. And this calls for acknowledgement.

Read more...


June 12, 2013

Please Update Your RSS Reader

The RSS feed for this blog used to end with .html but now I have fixed it. Please update your RSS feeds to use the URL below:

http://blog.muhuk.com/rss.xml