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 |