Re: Aliasing current module qualifier

2014-09-30 Thread Iavor Diatchki
Hello, What semantics are you using for recursive modules? As far as I see, if you take a least fixed point semantics (e.g. as described in A Formal Specification for the Haskell 98 Module System, http://yav.github.io/publications/modules98.pdf ) this program is incorrect as the module does not

RE: Aliasing current module qualifier

2014-09-30 Thread Simon Peyton Jones
: Re: Aliasing current module qualifier Hello, What semantics are you using for recursive modules? As far as I see, if you take a least fixed point semantics (e.g. as described in A Formal Specification for the Haskell 98 Module System, http://yav.github.io/publications/modules98.pdf

Re: Aliasing current module qualifier

2014-09-30 Thread John Meacham
Yes, that is the semantics I use for recursive module imports in jhc. And you are right in that it does not accept those examples due to being unable to bootstrap the least fixed point. How would the 'as M' proposal interact? Would it actually be new entries in the name table or rewritten as a

Aliasing current module qualifier

2014-09-29 Thread Herbert Valerio Riedel
Hello *, Here's a situation I've encountered recently, which mades me wish to be able to define a local alias (in order to avoid CPP use). Consider the following stupid module: module AnnoyinglyLongModuleName ( AnnoyinglyLongModuleName.length , AnnoyinglyLongModuleName.null

Re: Aliasing current module qualifier

2014-09-29 Thread Andreas Abel
Indeed, being able to introduce a short name for the current module, or having a fixed short name like 'This' or 'Self' would be neat. The standard workaround for your example would be import Prelude hiding (length,null) Did you try a .hs-boot file with your self-import trick? Cheers,

Re: Aliasing current module qualifier

2014-09-29 Thread Andreas Abel
The other two work arounds are 1. Explicit import lists for the stuff you need. 2. Explicit export list for your module (which you do), and internally use non-overloaded identifiers. module AnnoyinglyLongModuleName ( AnnoyinglyLongModuleName.length ,

Re: Aliasing current module qualifier

2014-09-29 Thread Jan Stolarek
On a somewhat related note, I'd love to be able to do this in Haskell: import Basics.Nat renaming (_≥_ to _≥ℕ_) (this is taken from Agda). Janek Dnia poniedziałek, 29 września 2014, Herbert Valerio Riedel napisał: Hello *, Here's a situation I've encountered recently, which mades me wish

Re: Aliasing current module qualifier

2014-09-29 Thread John Meacham
You don't need a new language construct, what i do is: module AnnoyinglyLongModuleName (M.length, M.null) where import AnnoyinglongLongModuleName as M I think ghc would need to be extended a little to make this convienient as it doesn't handle recursive module imports as transparently.