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,391
    • Issues 4,391
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 376
    • Merge Requests 376
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #10030

Closed
Open
Opened Jan 27, 2015 by Oleg Grenrus@phadejDeveloper

packageName for GHC.Generics.Datatype

Seems it's perfectly ok to have the data type of the same name in the same module, but different packages. Yet used in the same module:

{-# LANGUAGE PackageImports #-}
{-# LANGUAGE RankNTypes #-}
module Data.Foo where
 
import "void" Data.Void as A
import Data.Void as B
 
foo :: A.Void -> a
foo = absurd
 
bar :: B.Void -> a
bar x = x ()
{-# LANGUAGE RankNTypes #-}
module Data.Void where
 
type Void = forall a b. a -> b

https://gist.github.com/phadej/8b628d579ddf6958d937 motivated by: http://stackoverflow.com/questions/28159068/packagename-with-ghc-generics

I'd propose to change Datatype class to be:

class Datatype d where
  -- | The name of the datatype (unqualified)
  datatypeName :: t d (f :: * -> *) a -> [Char]
  -- | The fully-qualified name of the module where the type is declared
  moduleName   :: t d (f :: * -> *) a -> [Char]
  -- | The package name of the module where the type is declared
  packageName :: t d (f :: * -> *) a -> [Char]
  -- | Marks if the datatype is actually a newtype
  isNewtype    :: t d (f :: * -> *) a -> Bool
  isNewtype _ = False
Trac metadata
Trac field Value
Version 7.8.4
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component libraries/base
Test case
Differential revisions
BlockedBy
Related
Blocking
CC ekmett, hvr
Operating system
Architecture
Assignee
Assign to
8.0.1
Milestone
8.0.1 (Past due)
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#10030