
#13179: Levity-polymorphic data types -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: task | Status: new Priority: normal | Milestone: Component: Core | Version: 8.0.1 Libraries | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: #12708 Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- I don't know if this belongs as a part of [https://github.com/ghc- proposals/ghc-proposals/pull/30 levity-polymorphic type classes] (#12708) but many data types can be made levity-polymorphic, some have just been added to base: {{{#!hs -- Sum Array# Array# :: Type -> Type data Product :: forall rep. (k -> TYPE rep) -> (k -> TYPE rep) -> (k -> Type) where Pair :: f a -> g a -> (Product f g) a -- Sum Array# Array# :: Type -> Type data Sum :: forall rep. (k -> TYPE rep) -> (k -> TYPE rep) -> (k -> Type) where InL :: f a -> (Sum f g) a InR :: g a -> (Sum f g) a -- Compose Array# [] :: Type -> Type data Compose :: forall rep. (b -> TYPE rep) -> (a -> b) -> (a -> Type) where Compose :: f (g a) -> (Compose f g) a }}} Can you think of other examples? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13179 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler