
13 Apr
2009
13 Apr
'09
2:26 p.m.
Jason Dagit wrote:
removeMaybeHash x = case x of Just ref -> ref Nothing -> HashTable.new (==) (\key -> key)
When you see yourself writing a function like this, you could write it like this instead: removeMaybeHash (Just ref) = ref removeMaybeHash Nothing = HashTable.new (==) (\key -> key)
Hopefully you agree this 2 line version is more clear.
Actually, I prefer the other one... (though not necessarily spread out over 4 lines) I think this is more a matter of taste rather than clarity. Martijn.