Personal tools

Views

Yhc/Primitives

From HaskellWiki

Import the primitive exactly as if it were a standard
FFI c-call. This allows for the possibility that the
primitive might block and so it is run in a seperate OS
thread.

foreign import fastccall

Same as ccall but don't run the primitive call in a
seperate OS-level thread because we promise it won't
block.

foreign import primitive

make a call to the C-function but don't try and convert
the arguments or result to/from Haskell nodes. This is
necessary because some primitives are so low level they
need to work on the Haskell nodes directly.

foreign import cast

this is a standard part of the FFI. Essentially it says
this might look like we're importing something but
actually just cast the argument to the result and forget
about it. You can implement this as a 'fastccall' but
it's quicker and standard FFI in any case.

foreign import builtin

the primitive uses EVAL or APPLY internally and thus
can't be implemented as C code - it has to be written as
byte code. Nor can the function be written in Haskell.
Currently there is only one primitive in this category
which is primCatch.