
Hi. Haskell 98 allows import alias: import qualified VeryLongModuleName as C however it does not allow aliasing for imported names import NormalModule (veryLongFunctionName as C) what is the rational? IMHO this can be very useful in some cases. Thanks Manlio

On Saturday 04 April 2009, Manlio Perillo wrote:
Hi.
Haskell 98 allows import alias: import qualified VeryLongModuleName as C
however it does not allow aliasing for imported names import NormalModule (veryLongFunctionName as C)
what is the rational? IMHO this can be very useful in some cases.
While I do agree with the argument that it could be useful in some cases, misuse of this feature would cause a lot of confusion, consider: from System.IO.Unsafe import (unsafePerformIO as safe) I think that the alias feature is OK, when the namespace is long, longfunctionnameswhichareapaintoreadandespeciallywrite are a bug and should be treated and fixed by the owner of that code, not by the user. If very function names are that much of a problem to you consider a wrapper library. -- Cheers! Marcin Kosiba

Am Samstag 04 April 2009 17:33:55 schrieb Manlio Perillo:
Hi.
Haskell 98 allows import alias: import qualified VeryLongModuleName as C
however it does not allow aliasing for imported names import NormalModule (veryLongFunctionName as C)
what is the rational? IMHO this can be very useful in some cases.
You can always do {-# INLINE short #-} short = C.veryLongFunctionNameThatIReallyDoNotWantToTypeOutEveryTimeIUseIt so it's not necessary.
Thanks Manlio

Hi
You can always do
{-# INLINE short #-} short = C.veryLongFunctionNameThatIReallyDoNotWantToTypeOutEveryTimeIUseIt
The INLINE pragma is not necessary, if an optimising compiler fails to inline that then it's not very good. However, you might want to consider the (evil) monomorphism restriction which will make that pattern fail for any functions with type classes. Thanks Neil
participants (4)
-
Daniel Fischer
-
Manlio Perillo
-
Marcin Kosiba
-
Neil Mitchell