@@ -256,7 +256,10 @@ builtinTypesSrc =
256256 B' " ClientSockAddr" CT. Data ,
257257 B' " PinnedByteArray" CT. Data ,
258258 B' " Integer" CT. Data ,
259- B' " Natural" CT. Data
259+ B' " Natural" CT. Data ,
260+ B' " FFI.Type" CT. Data ,
261+ B' " FFI.Spec" CT. Data ,
262+ B' " FFI.DLL" CT. Data
260263 ]
261264
262265-- rename these to "builtin" later, when builtin means intrinsic as opposed to
@@ -810,7 +813,20 @@ builtinsSrc =
810813 B " Natural.gteq" $ natural --> natural --> boolean,
811814 B " Natural.toFloat" $ natural --> float,
812815 B " Natural.isEven" $ natural --> boolean,
813- B " Natural.isOdd" $ natural --> boolean
816+ B " Natural.isOdd" $ natural --> boolean,
817+ B " FFI.openDLL" $ text --> ioexn dll,
818+ B " FFI.int64" $ ffiType int,
819+ B " FFI.uint64" $ ffiType nat,
820+ B " FFI.double" $ ffiType float,
821+ B " FFI.void" $ ffiType unit,
822+ B " FFI.base" . forall2 " a" " b" $ \ a b ->
823+ ffiType a --> ffiType b --> ffiSpec (a --> Type. effect () [] b),
824+ B " FFI.baseIO" . forall2 " a" " b" $ \ a b ->
825+ ffiType a --> ffiType b --> ffiSpec (a --> io b),
826+ B " FFI.arr" . forall2 " a" " b" $ \ a b ->
827+ ffiType a --> ffiSpec b --> ffiSpec (a --> Type. effect () [] b),
828+ B " FFI.getDLLSym" . forall1 " a" $ \ a ->
829+ dll --> text --> ffiSpec a --> ioexn a
814830 ]
815831 ++
816832 -- avoid name conflicts with Universal == < > <= >=
@@ -1176,6 +1192,9 @@ iof = io . eithert failure
11761192iot :: Type
11771193iot = (Type. effects () [Type. builtinIO () ])
11781194
1195+ ioexn :: Type -> Type
1196+ ioexn = Type. effect () [Type. builtinIO () , DD. exceptionType () ]
1197+
11791198failure :: Type
11801199failure = DD. failureType ()
11811200
@@ -1203,6 +1222,15 @@ iarrayt a = Type.iarrayType () `app` a
12031222marrayt :: Type -> Type -> Type
12041223marrayt g a = Type. marrayType () `app` g `app` a
12051224
1225+ ffiType :: Type -> Type
1226+ ffiType t = Type. ref () Type. ffiTypeRef `app` t
1227+
1228+ ffiSpec :: Type -> Type
1229+ ffiSpec t = Type. ref () Type. ffiSpecRef `app` t
1230+
1231+ dll :: Type
1232+ dll = Type. ref () Type. ffiDllRef
1233+
12061234socket , threadId , handle , phandle , unit :: Type
12071235socket = Type. socket ()
12081236threadId = Type. threadId ()
0 commit comments