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

[feat] add initial support for unlifted types #162

Closed
wants to merge 2 commits into from

Conversation

MangoIV
Copy link

@MangoIV MangoIV commented Mar 21, 2023


Note
This is a draft for adding support for unlifted types for generics-sop, according to #155


Status

  • unlifted representations
  • th generation for unlifted Generic
  • levity polymorphic Generic
  • example
  • compiles on ghc927, ghc944, ghc961
  • more polymorphic BasicFunctors (something like
    data family I :: forall levin levout. TYPE ('BoxedRep levin) -> TYPE ('BoxedRep levout)
    data instance I @'Unlifted @'Lifted a = ULI a
    ... 
  • make both the unlifted and the lifted repr derivable for an unlifted type (in the moment, only the unlifted is derivable by the TH code.)
  • a whole lot of CPP to exclude these changes on ghc <92

Warning
Due to a bug in GHC, this only works on GHC 9.4 >= 9.4.6
it hasn't been backported to GHC 9.6 but should exist in GHC 9.8
I would also expect that it will get soon backported to GHC 9.6

@MangoIV
Copy link
Author

MangoIV commented Mar 22, 2023

update: the PR to GHC that fixes the issue sometimes doesn't actually seem to fix this issue here as it is not only related to the interpreter but also segfaults after building normally

@MangoIV
Copy link
Author

MangoIV commented Mar 22, 2023

https://gitlab.haskell.org/ghc/ghc/-/issues/23146#note_488309

the root of the issues have been found and a fix exists <3

generics-sop/src/Generics/SOP/Universe.hs Show resolved Hide resolved
generics-sop/test/Example.hs Outdated Show resolved Hide resolved
Comment on lines +220 to +221
deriveGenericOnly ''UT

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should support metadata, too.

generics-sop/test/Example.hs Outdated Show resolved Hide resolved
sop-core/src/Data/SOP.hs Show resolved Hide resolved
Comment on lines +65 to +66
type BoxedType :: Levity -> Type
type BoxedType levity = TYPE ('BoxedRep levity)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be moved to another module?

@@ -242,6 +242,7 @@ module Generics.SOP (
, NS(..)
, SOP(..)
, unSOP
, unUSOP
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

@MangoIV MangoIV closed this Jul 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant