Opened 4 years ago

Last modified 7 months ago

#11610 new task

Remove IEThingAll constructor from IE datatype

Reported by: mpickering Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.10.3
Keywords: newcomer Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

It seems that now IEThingWith can include a wildcard that the IEThingAll constructor is a special case. I'm not sure how involved this would be but it seems worth doing.

  | IEThingAll  (Located name)     -- ^ Class/Type plus all methods/constructors
        --
        -- - 'ApiAnnotation.AnnKeywordId's : 'ApiAnnotation.AnnOpen',
        --       'ApiAnnotation.AnnDotdot','ApiAnnotation.AnnClose',
        --                                 'ApiAnnotation.AnnType'

        -- For details on above see note [Api annotations] in ApiAnnotation
        -- See Note [Located RdrNames] in HsExpr

  | IEThingWith (Located name)
                IEWildcard
                [Located name]
                [Located (FieldLbl name)]
                 -- ^ Class/Type plus some methods/constructors
                 -- and record fields; see Note [IEThingWith]
        -- - 'ApiAnnotation.AnnKeywordId's : 'ApiAnnotation.AnnOpen',
        --                                   'ApiAnnotation.AnnClose',
        --                                   'ApiAnnotation.AnnComma',
        --                                   'ApiAnnotation.AnnType'

        -- For details on above see note [Api annotations] in ApiAnnotation

Change History (4)

comment:1 Changed 4 years ago by simonpj

I'm dubious about the benefit. It'll need special treatment regardless. Do we allow wildcards in exports lists today?

comment:2 Changed 3 years ago by mpickering

Yes,

Today you can write

{-# LANGUAGE PatternSynonyms #-}

module Foo(T(.., P)) where

data T = T

pattern P :: T
pattern P = T

which is documented here - http://downloads.haskell.org/~ghc/8.0.1-rc2/docs/html/users_guide/glasgow_exts.html#import-and-export-of-pattern-synonyms

comment:3 Changed 3 years ago by simonpj

Ah I see. So you propose to kill off IEThingAll n in favour of IEThingWith n IEWildCard [] [].

Yes that seems fine. Better make certain that the behaviour is identical but it jolly well ought to be.

Meanwhile, could you also add a comment with

data IEWildcard = NoIEWildcard | IEWildcard Int deriving (Eq, Data, Typeable)

What is this Int? Comment plus example. (I think it may indicate where the single ... occurs in the list perhaps?

Ditto in

data ImpExpSubSpec = ImpExpAbs
                   | ImpExpAll
                   | ImpExpList [Located RdrName]
                   | ImpExpAllWith [Located (Maybe RdrName)]

what is this Maybe doing? Perhaps Nothing indicates ..? Might you add commentary and an example to explain?

Data types are such a golden golden opportunity for comments :-).

comment:4 Changed 7 months ago by mpickering

Keywords: newcomer added
Note: See TracTickets for help on using tickets.