[Haskell-cafe] Moving the messages for compiler to another file?
alexander.dunlap at gmail.com
Tue Dec 2 18:59:24 EST 2008
On Tue, Dec 2, 2008 at 2:56 AM, nml <arumakanil at gmail.com> wrote:
> How about moving the messages for compiler to an additional file?
> My motivation is that we often face a trade-off between
> aesthetical(elegant code) and practical(efficient code).
> Like pragmas and strictness annotations, I often feel they make the
> source code ugly.
> They don't affect the semantics of our programs, do they?
> Some people would say this beautifying should be accomplished by an
> editor, like hiding/showing option for those information.
> But such separation has additional benefits.
> For instance, making the source code more compiler-independent.
> (yeah, this is not the case with language-extensions)
> And we avoid dispersing those information among our lines. (or even files)
> In some cases, it would be convenient.
> I'm not sure if this idea is reasonable, reachable or just naive.
> Best regards
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
One problem is that in many cases, the things that you're talking
about DO affect semantics. Consider strictness annotations:
> f (!x) = Just x
> g x = Just x
> h (Just _) = True
> h Nothing = False
Now h (f _|_) == _|_, but h (g _|_) == True, even though a strictness
annotation was the only difference between them. (For those not
already familiar with it, _|_ ("bottom") is a semantically undefined
value, equivalent to an infinite loop.)
I agree that it's good to reduce semantically-irrelevant code, but I'm
not sure how feasible the proposal would be. I think GHC's rewrite
rules may be of interest in this problem (the debate between elegant
and fast code). Don Stewart has also written about this issue and has
a couple of really good posts on his blog
More information about the Haskell-Cafe