Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor handling of abstract/primitve types #1604

Closed
yav opened this issue Jan 16, 2024 · 1 comment
Closed

Refactor handling of abstract/primitve types #1604

yav opened this issue Jan 16, 2024 · 1 comment
Assignees
Labels
enums Issues related to enums tech-debt For issues that require some internal refactoring.

Comments

@yav
Copy link
Member

yav commented Jan 16, 2024

PR #1602 adds support for sum types, which reuses a lot of the machinery for newtypes. We should reuse the same machinery for representing abstract types, as they are just another form of a "nominal" type.

@yav yav added the tech-debt For issues that require some internal refactoring. label Jan 16, 2024
@RyanGlScott RyanGlScott added the enums Issues related to enums label Jan 19, 2024
@RyanGlScott
Copy link
Contributor

Specifically, we should merge AbstractType:

-- | Information about an abstract type.
-- XXX: This should probably be combined with newtype as just another
-- kind of "definition".
data AbstractType = AbstractType
{ atName :: Name
, atKind :: Kind
, atCtrs :: ([TParam], [Prop])
, atFixitiy :: Maybe Fixity
, atDoc :: Maybe Text
} deriving (Show, Generic, NFData)

Into NewtypeDef:

-- | Definition of a nominal type
data NewtypeDef = Struct StructCon | Enum [EnumCon]
deriving (Show, Generic, NFData)

But note that Newtype may be renamed to NominalDef (#1607).

@yav yav self-assigned this Jan 31, 2024
yav added a commit that referenced this issue Feb 1, 2024
@yav yav closed this as completed Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enums Issues related to enums tech-debt For issues that require some internal refactoring.
Projects
None yet
Development

No branches or pull requests

2 participants