Referring to current module (or aliasing current module)
Hey,
Suppose I got a record type Game
in a module Lib.Game
that has a field player
. I'd occasionally like to use the variable player
in a closure, but still refer to the player
field accessor once to assign the variable. Is it me or right now there's no way to refer to the current module by anything other than its full name? That is, to disambiguate the variable and function, I have to type let player = Lib.Game.player
.
In other words, I'd like the invocation of Lib.Game.player
below to be shortened somehow, either by assigning an alias to the current module via import qualified
(can't now as it results in a self-cycle) or by some other means of referring to the closing module.
module Lib.Game where
data Game = Game {player :: Player}
play game = foo player where player = Lib.Game.player game
This is vaguely similar to #10336, but the SOURCE
pragma seems to be about actually cyclical imports.
Thanks!
Trac metadata
Trac field | Value |
---|---|
Version | 8.2.2 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |