Discussion:
[polyml] Error with poly_smlnj-lib.sml
Mark Clements
2018-07-30 09:12:13 UTC
Permalink
Dear all,

This is my first post. I am trying to use poly_smlnj-lib.sml (with a
plan to see whether mlnffigen can be ported from MLton to Poly/ML).
Following instructions from
http://www.tbrk.org/software/poly_smlnj-lib.html (see also
https://github.com/standardml/smackage/blob/master/src/poly_smlnj-lib.sml),
I called:

$ poly
use "poly_mlyacc.sml"; (* ok *)
use "poly_smlnj-lib.sml";
with the latter giving an error:

/usr/local/lib/mlton/sml/smlnj-lib/Util/bit-array.sml:781: error:
Structure (Word8Array) has not been declared in structure Unsafe
Found near Unsafe.Word8Array.create (Word8Array.length bits)

I am using Poly/ML 5.7.1 Release and MLton 20180207. Any suggestions
would be welcomed.

Kindly, Mark.
Peter Gammie
2018-07-30 09:25:39 UTC
Permalink
Mark,
Post by Mark Clements
This is my first post. I am trying to use poly_smlnj-lib.sml (with a
plan to see whether mlnffigen can be ported from MLton to Poly/ML).
Following instructions from
http://www.tbrk.org/software/poly_smlnj-lib.html (see also
https://github.com/standardml/smackage/blob/master/src/poly_smlnj-lib.sml),
$ poly
use "poly_mlyacc.sml"; (* ok *)
use "poly_smlnj-lib.sml";
Structure (Word8Array) has not been declared in structure Unsafe
Found near Unsafe.Word8Array.create (Word8Array.length bits)
I am using Poly/ML 5.7.1 Release and MLton 20180207. Any suggestions
would be welcomed.
I’ve been assembling some random SML code here:

https://github.com/peteg/SML

There you will find a version of smlnj-lib that works with Poly/ML from git. Note that there are some new structures since the time of Tim’s patch, and I mostly didn’t bother to get them working. Note also you can use the smlnj-lib included with mlton with mlton. There are some build scripts in my repo that might help. I’m happy to accept PRs etc. that improve the situation.

cheers,
peter
--
http://peteg.org/
Mark Clements
2018-07-31 21:12:21 UTC
Permalink
Pete: thank you for this. Your proposal is a little heavier than
Timothy's solution.

If the HTML structures are *not* required, then no patching of MLton is
required and one can simply use this gist
(https://gist.github.com/mclements/f9308974a3635a4f640283e1cfa02212).
This adds to the Unsafe structure and comments out the HTML structures.

The patch for more recent MLton libraries are small and only require
changing the HTML/html-elements-fn.sml and HTML/html-attrs-fn.sml files
for the non-standard Or-pattern. The revised patch is available from
this gist
(https://gist.github.com/mclements/c5f715ed149cf264f33e12d496cc79e5).

These are specific working solutions - and my first SML code. Please
note that the gists have *not* been extensively tested. I will offer
them to Pete's SML repository if they prove to be useful.

Kindly, Mark.
Post by Peter Gammie
Mark,
Post by Mark Clements
This is my first post. I am trying to use poly_smlnj-lib.sml (with a
plan to see whether mlnffigen can be ported from MLton to Poly/ML).
Following instructions from
http://www.tbrk.org/software/poly_smlnj-lib.html (see also
https://github.com/standardml/smackage/blob/master/src/poly_smlnj-lib.sml),
$ poly
use "poly_mlyacc.sml"; (* ok *)
use "poly_smlnj-lib.sml";
Structure (Word8Array) has not been declared in structure Unsafe
Found near Unsafe.Word8Array.create (Word8Array.length bits)
I am using Poly/ML 5.7.1 Release and MLton 20180207. Any suggestions
would be welcomed.
https://github.com/peteg/SML
There you will find a version of smlnj-lib that works with Poly/ML from git. Note that there are some new structures since the time of Tim’s patch, and I mostly didn’t bother to get them working. Note also you can use the smlnj-lib included with mlton with mlton. There are some build scripts in my repo that might help. I’m happy to accept PRs etc. that improve the situation.
cheers,
peter
Loading...