
#15996: Add Unlifted List type to base -------------------------------------+------------------------------------- Reporter: chessai | Owner: (none) Type: feature | Status: new request | Priority: normal | Milestone: 8.6.3 Component: | Version: 8.6.2 libraries/base | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- {{{#!hs data UList (a :: TYPE 'UnliftedRep) where UNil :: UList a UCons :: a -> UList a -> UList a }}} This would guarantee that values stored inside the list would not be thunks. It would likely live in something like GHC.List.Unlifted, since it uses GHC-specific things. An example of something it might improve is the implementation of Control.Concurrent.QSem.QSem: {{{#!hs data QSem = QSem !(MVar (Int, [MVar ()], [MVar ()])) }}} this could instead be: {{{#!hs type MVarIO = MVar# RealWorld -- type synonym for brevity data QSem = QSem (MVarIO (Int, UList (MVarIO ()), UList (MVarIO ()))) }}} Note that in this example the tuple inside the outermost `MVarIO` boxes the `Int` - this tuple could be represented as a datatype which ensures the unboxing on the `Int`. The main idea here though is that now you can use `MVar#` inside of the `UList`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15996 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler