#4937: Remove indirections caused by sum types, such as Maybe
------------------------------+---------------------------------------------
Reporter: tibbe | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.0.1
Resolution: | Keywords:
Testcase: | Blockedby:
Difficulty: | Os: Unknown/Multiple
Blocking: | Architecture: Unknown/Multiple
Failure: None/Unknown |
------------------------------+---------------------------------------------
Changes (by simonmar):
* status: closed => new
* resolution: wontfix =>
Comment:
I just realised that there is something we could do here. Let's define
the representation of a ''strict'' `Maybe a` as either
* some distinguished pointer (`StrictNothing`), or
* the field of the `Just`
since the field of the `Just` is not strict, it can never be
`StrictNothing`. We could choose NULL for `StrictNothing`, but that would
mean the GC would have to ignore NULL pointers, and that's an extra test
in the GC inner loop.
So this would let us implement `{-# UNPACK #-} !(Maybe a)`, and strict
arguments of type `Maybe a` could be unboxed.
Of course this wouldn't be specific to `Maybe`, but would work with any
type with consisting of one unary constructor and any number of nullary
constructors.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4937#comment:9>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs