For anyone interested, here's a complete list of all foreign imports at the
STG level from base and integer-simple:
https://gist.github.com/chrisdone/24b476862b678a3665fbf9b833a9905f
They all have type (# State# RealWorld #) or (# State# RealWorld,
#).
On Tue, 5 Nov 2019 at 15:18, Christopher
Aha, thanks Csaba. So I’m not losing my marbles. The AST has a type
signature of the “initial” but implements the “lowered”. So with
-ddump-stg we can observe it:
The version claimed in the type signature (returning a tuple):
Foreign.it :: Foreign.C.Types.CDouble
[GblId] =
[] \u []
Hi,
I've also observed that in the final lowered STG the State# is always
passed to effectful primops and FFI calls, but the returning new State# is
removed from the result type. The State# has VoidRep representation in in
cmm, so no register gets allocated for it and eventually the State#
Hi all,
I tried compiling this file:
{-# LANGUAGE NoImplicitPrelude #-}-- | Demonstrate various use of the
FFI.module Foreign whereimport Foreign.Cforeign import ccall "math.h
sin" sin :: CDouble -> CDoubleit :: CDoubleit = sin 1
And I’ve noticed that the annotated type given for this foreign