haskell / alex

A lexical analyser generator for Haskell
https://hackage.haskell.org/package/alex
BSD 3-Clause "New" or "Revised" License
298 stars 82 forks source link

`alexSetUserState`/`alexGetUserState` with `monadUserState-bytestring` wrapper #220

Closed zoeyfyi closed 10 months ago

zoeyfyi commented 1 year ago

Is there any reason these are not enabled for the monadUserState-bytestring wrapper?

https://github.com/haskell/alex/blob/24ab083ecf6fc82262090374ef46fb4ae7bbf61c/data/AlexWrappers.hs#L261

andreasabel commented 1 year ago

I suggest you try to find the author (e.g. via git blame) and then ask the author...

emekoi commented 10 months ago

Tracing the change back to 13fd23e1ea064eac611f1834c58d7b825a4013a9 and 4de7cd8b61ff05b5b2bdf5d4ece03ecf8c35f311, it seems that this was a mistake.

andreasabel commented 10 months ago

Tracing the change back to 13fd23e and 4de7cd8, it seems that this was a mistake.

@emekoi : Is there a released version of alex that supports alex{G,S}etUserState in the monadUserState-bytestring wrapper? According to my experiments,

So maybe this isn't a regression, but a feature that never worked.

emekoi commented 10 months ago

I probably should've checked, but I think you're right that this never worked. In a4f43f8c1532937673682b317470f8e47fe1be38 (just before 13fd23e1ea064eac611f1834c58d7b825a4013a9) monadUserState-bytestring also did not support alex{G,S}etUserState. I probably just assumed alex did at some point because I was following this tutorial by Serokell, and they use alex{G,S}etUserState with monadUserState-bytestring.

Also could you clarify what you meant by "alex-3.1.7 (Jan 2016) does not know about that wrapper"? Looking at Github, alex{G,S}etUserState were introduced in #23 which made it into alex-3.1.1, and monadUserState-bytestring was introduced in alex-2.3.1 (57d9d6d30ee28be5d1d02bfa6379d605e132a735).

andreasabel commented 10 months ago

Also could you clarify what you meant by "alex-3.1.7 (Jan 2016) does not know about that wrapper"?

Oh, I got a parse error for the test, so I assumed it was because of the %wrapper directive. I should check again...

andreasabel commented 10 months ago

I checked 3.1.4; it also does not know about alex{S,G}etUserState. Older versions of alex can't be built on my mac.