Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,251
    • Issues 4,251
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 394
    • Merge Requests 394
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #15432

Closed
Open
Opened Jul 23, 2018 by Andri M@moll

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
Assignee
Assign to
⊥
Milestone
⊥
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#15432