ghc primop correctness and compile time constants, maybe a type operator for enforced Constantness?

Carter Schonwald carter.schonwald at gmail.com
Thu Aug 1 20:36:03 CEST 2013


Hey all,
a number of primops GHC has gained in the past year, prefetch and family,
as well as further primops that people (such as myself) hope to add require
certain arguments be known constant values at compile time for code gen to
work correctly.

I detail the problem a little bit further on this ghc trac ticket :
http://ghc.haskell.org/trac/ghc/ticket/8107

but the punchline is, a number of valuable SIMD, memory, and concurrent
memory model primops that are worth adding to GHC and making first class
operations, really require certain arguments to be compile time constant to
work correctly.

Accordingly, from the perspective of making those operations *truly* first
class, augmenting the haskell type system to have a way of expressing "this
argument must be a known value at compile time" that doesn't require
template haskell shenanigans might be really valuable.


thoughts all?

note that for some of these arguments that need to be compile time
constants, llvm et al will generate different machine code depending on the
argument!  (llvm doesn't even have the ability to express this invariant in
its current API / data model, it just checks it when it tries to compile
the code)

cheers

-Carter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20130801/297b8bc2/attachment.htm>


More information about the ghc-devs mailing list