
@lexi.lambda do you have plans reviving hackett?

Yup, sorry, not a mistake at all.

@stchang Is there a way to get the position in Parsack? I ask because Greg’s toml
parser used: (define (getPosition)
(match-lambda
[(and state (State _ pos -))
(Empty (Ok pos state (Msg pos "" null)))]))
but the current version of Parsack doesn’t export State.

@soegaard2 as I understand, the position is only needed for error reporting. I tried removing pos-related code yesterday and managed to get it runnable. Not a good solution though.
The best solution IMO is to specify in info.rkt
that “please use this version of parsack
instead”. But #:version
in info.rkt
is only for lower bound, not upper bound :disappointed:

I am surprised we haven’t seen a foo1, foo2, foo3 … situation on the package server.

But since toml it self is a parser, the error positions are needed.

Can we get the position form the input port instead?

FWIW it works when checking out this version: https://github.com/stchang/parsack/commit/beddbd2ba7de85745c1023a0177d16efd6fe16a1

The next commit changes parsack to use ports instead of strings - and it no longer exports Pos, Msg and other stuff.

Does it make sense to make a repo called parsack-old ?

@soegaard2 if you will do it, I’d suggest using the code right before this commit instead

I thought that was the one I had found?

Maybe @stchang wants to?

You are right. The commit you found is right before the commit I found. :face_palm:

Perhaps there is an easy way to check out the proper version, if the command line raco pkg is used? /checks

Does raco pkg install <git://github.com/stchang/parsack#beddbd2ba7de85745c1023a0177d16efd6fe16a1>
work?

@alexknauth I’ll try. This didn’t: mbp:tmp soegaard$ raco pkg install --checksum de85745c1023a0177d16efd6fe16a1 parsack
Resolving "parsack" via <https://download.racket-lang.org/releases/7.3/catalog/>
Resolving "parsack" via <https://pkgs.racket-lang.org>
Using cached15659698591565969859745 for <github://github.com/stchang/parsack/master/>
raco pkg install: unexpected checksum on package
package source: parsack
expected: "de85745c1023a0177d16efd6fe16a1"
got: "b45f0f5ed5f8dd3f1ccebaaec3204b27032843c6"

raco pkg install '<git://github.com/stchang/parsack#beddbd2ba7de85745c1023a0177d16efd6fe16a1>'
works for me

Nope. mbp:tmp soegaard$ raco pkg install <git://github.com/stchang/parsack#beddbd2ba7de85745c1023a0177d16efd6fe16a1>
Querying Git references for parsack at <git://github.com/stchang/parsack#beddbd2ba7de85745c1023a0177d16efd6fe16a1>
Using cached15659737761565973776575 for <git://github.com/stchang/parsack#beddbd2ba7de85745c1023a0177d16efd6fe16a1>
raco setup: directory: #<path:/Users/soegaard/tmp/parsack/parsack> does not exist for collection: "parsack"
context...:
/Applications/Racket v7.3/collects/setup/setup-core.rkt:354:2: collection-cc!20
/Applications/Racket v7.3/collects/setup/setup-core.rkt:503:8: for-loop
...

And it doesn’t used a cached version?

> Using cached15659737761565973776575 for
This line is very suspicious.

Querying Git references for parsack at <git://github.com/stchang/parsack#beddbd2ba7de85745c1023a0177d16efd6fe16a1>
Downloading repository <git://github.com/stchang/parsack#beddbd2ba7de85745c1023a0177d16efd6fe16a1>
raco setup: version: 7.4
raco setup: platform: x86_64-macosx [3m]
raco setup: target machine: racket

Here’s mine

Perhaps try clearing the cache?

Easier said than done. I get an error: mbp:tmp soegaard$ raco pkg remove parsack
Removing parsack
Moving parsack to trash: /Users/soegaard/Library/Racket/7.3/pkgs/.trash/1565974010-0-parsack
raco setup: directory: #<path:/Users/soegaard/tmp/parsack/parsack> does not exist for collection: "parsack"
context...:
/Applications/Racket v7.3/collects/setup/setup-core.rkt:354:2: collection-cc!20

mbp:tmp soegaard$ raco pkg empty-trash
Removing trash directory /Users/soegaard/Library/Racket/7.3/pkgs/.trash/1565973991-0-parsack
Removing trash directory /Users/soegaard/Library/Racket/7.3/pkgs/.trash/1565974010-0-parsack
mbp:tmp soegaard$ raco pkg install "<git://github.com/stchang/parsack#beddbd2ba7de85745c1023a0177d16efd6fe16a1>"
raco pkg install: package is already installed
package: parsack

Huh, some invariants are broken apparently :slightly_smiling_face:

I am confused: mbp:tmp soegaard$ raco link -l \| grep parsack
collection: "parsack" path: "/Users/soegaard/tmp/parsack/parsack"
root path: "/Users/soegaard/Library/Racket/7.3/pkgs/parsack"
mbp:tmp soegaard$ raco link -r parsack
[no links removed]

Here’s an idea: install Racket 7.4 :joy:

I do have 7.4. Need to adjust my path :slightly_smiling_face:

If you already have parsack installed maybe replace install with update

No updates available.

So raco pkg update <git://github.com/stchang/parsack#beddbd2ba7de85745c1023a0177d16efd6fe16a1>
says no updates available?

Yes. mbp:tmp soegaard$ raco pkg update "<git://github.com/stchang/parsack#beddbd2ba7de85745c1023a0177d16efd6fe16a1>"
Querying Git references for parsack at <git://github.com/stchang/parsack#beddbd2ba7de85745c1023a0177d16efd6fe16a1>
No updates available

At some point I cloned parsack and made a link.

Then I deleted the directory, and then unlinked (or was it the other way around).

Hmm. Seems toml now works.

Still confused though.

FWIW I think creating an empty tmp/parsack/parsack folder helped (that’s why setup failed).

Still can’t unlink properly.

@darioszr has joined the channel

Is it possible to convet a bytes that contains UTF–16BE to a string? I see the bytes-open-converter supports UTF–16 but appears to use platform endianness only (as indicated by the docs - https://docs.racket-lang.org/reference/bytestrings.html#%28def._%28%28quote._~23~25kernel%29._bytes-open-converter%29%29 )

I think UTF–16be is a legal encoding in bytes-open-converter
(for/list ([to '("UTF-16" "UTF-16be")])
(let ([xf (bytes-open-converter "UTF-8" to)])
(let-values ([(b _x _y) (bytes-convert xf #"hello world")])
b)))
==> '(#"\376\377\0h\0e\0l\0l\0o\0 \0w\0o\0r\0l\0d" #"\0h\0e\0l\0l\0o\0 \0w\0o\0r\0l\0d")

Oh yeah Racket uses iconv so I think all of these should work: https://www.gnu.org/savannah-checkouts/gnu/libiconv/documentation/libiconv-1.15/iconv_open.3.html

@nma.arvydas.silanskas I was thinking of data conversion for serializable continuations: serializable-struct
won’t help you with conversion to or from JSON. If I were doing enough conversions that writing them manually became painful, I would either: 1. Write some macros for defining structs that know how to convert themselves to and from JSON; or 2. Just manipulate the data as hash tables, possibly with convenience functions or macros for things like nested hash-ref
/hash-update
. I think there are some packages for this, and I know I’ve written my own versions occasionally.

Excellent! Thank you a bunch!