toastal has quit [Read error: Connection reset by peer]
toastal has joined #ocaml
Frostillicus has joined #ocaml
Frostillicus has quit [Ping timeout: 248 seconds]
Frostillicus has joined #ocaml
toastal has quit [Ping timeout: 265 seconds]
Frostillicus has quit [Ping timeout: 276 seconds]
Frostillicus has joined #ocaml
toastal has joined #ocaml
Tuplanolla has joined #ocaml
Anarchos has joined #ocaml
myrkraverk_ has joined #ocaml
myrkraverk has quit [Ping timeout: 252 seconds]
Anarchos has quit [Quit: Vision[]: i've been blurred!]
Haudegen has quit [Quit: Bin weg.]
Anarchos has joined #ocaml
toastal has quit [Ping timeout: 252 seconds]
Haudegen has joined #ocaml
toastal has joined #ocaml
Frostillicus has quit [Ping timeout: 260 seconds]
Anarchos has quit [Quit: Vision[]: i've been blurred!]
toastal has quit [Ping timeout: 248 seconds]
<discocaml>
<_4ad> is it possible to obtain an `Uchar.t Seq.t` from a file (or stdin) just from the standard library? (no Uutf or other libraries).
<discocaml>
<_4ad> (or maybe `Uchar.t Seq.t` is just a bad idea altogether, I'm open to alternatives.)
<discocaml>
<yawaramin> i guess depends on why you want this?
Frostillicus has joined #ocaml
<companion_cube>
String.get_utf8_uchar in a recursive function should do it
<discocaml>
<_4ad> I am writing a lexer+parser for a language that encodes its files as UTF-8.
<companion_cube>
I mean you could also use that to read directly
<discocaml>
<_4ad> yeah, but that requires a string. I want a streaming interface.
<companion_cube>
that's a bit of work I guess
<companion_cube>
how big are your files?
<companion_cube>
cause reading into a string will almost always be simpler and faster
<discocaml>
<_4ad> I think we saw multi-GB files in production, heh.
<discocaml>
<_4ad> although that was an isolated incident.
<companion_cube>
if it's a programming language, bail out :D
Anarchos has joined #ocaml
<discocaml>
<_4ad> it's a real language alright, albeit not a general purpose one. the language is CUE (cuelang.org), I'm one of the developers. I am reimplementing it in OCaml.
<discocaml>
<yawaramin> wow
<companion_cube>
GB of cuelang :s
<companion_cube>
I'd do a lexbuf-style interface then
<companion_cube>
internal buffer, refilled if it doesn't contain a whole codepoint
<companion_cube>
`val next : t -> Uchar.t (** @raise End_of_file *)`
toastal has joined #ocaml
<discocaml>
<_4ad> yeah that makes sense, I think.
Frostillicus has quit [Ping timeout: 276 seconds]
<discocaml>
<deepspacejohn> do you need to lex tokens out of unicode characters? e.g. `🐫 -> CAMEL_TOKEN`? or will just strings/comments/etc. contain unicode?
<discocaml>
<deepspacejohn> (TIL that Discord doesn't like it when you post emojis like 🐫 in code blocks and helpfully converts it for you.)
<discocaml>
<deepspacejohn> But if it's the latter case, you don't really need to do anything special for unicode AFAIK.
wbooze has joined #ocaml
<discocaml>
<_4ad> it's identifiers which can contain non-ASCII unicodes (so basically like strings and comments).
<discocaml>
<_4ad> the symbols and punctuation is all ASCII.
Frostillicus has joined #ocaml
<companion_cube>
ah yeah the funny thing is that you probably can half-ass a lexer by doing tokenization byte by byte
<discocaml>
<_4ad> and the UTF-8 is normalized.
<discocaml>
<_4ad> yeah.
<companion_cube>
and just kind of ignoring the bytes with a 1 MSB
<companion_cube>
(just keeping them together in tokens)
<companion_cube>
but still, it's also possible to lex Uchar.t
<companion_cube>
from Uchar.t I mean
<discocaml>
<deepspacejohn> yeah, I'd also say String.get_utf8_uchar is the way to go
<companion_cube>
(from a refillable buffer, that is)
<discocaml>
<deepspacejohn> There's also Bytes.get_utf_8_uchar
Haudegen has quit [Quit: Bin weg.]
Frostillicus has quit [Ping timeout: 260 seconds]
Frostillicus has joined #ocaml
Guest19 has joined #ocaml
Guest19 has quit [Client Quit]
Anarchos has quit [Quit: Vision[]: i've been blurred!]
germ has quit [Ping timeout: 265 seconds]
<discocaml>
<njb9438> @_4ad Cue implemented in ocaml sounds great! Do you have any idea of a vague timeframe for a mvp? Can't wait!
<discocaml>
<_4ad> I am implementing CUE on top of interaction nets, and a lot of work has been done already on an internal IL very similar to CUE. now I need to hook it to an actual parser so it shouldn't take too long to have actual CUE (famous last words). I am hoping at most two months or so.
<discocaml>
<froyo> I would be surprised if daniel's unicode libraries don't do byte streaming
<discocaml>
<njb9438> @_4ad Thanks for the above, looking forward to it - thanks also for mentioning interactive nets, hadn't come across them before
<discocaml>
<froyo> in any case io with seq means you need to be explicitly aware of lifetimes to avoid seq replays and/or channel closing
<discocaml>
<deepspacejohn> That looks like the expected behavior to me. the Complex32 and Complex64 constructors have different types so they can't be unified in the same branch.
<discocaml>
<deepspacejohn> Actually, I'm not completely sure...
<discocaml>
<gabyfle> Ok I see, the fact that b is either complex32_elt or complex64_elt make the type checker unable to decide what it should be?
<discocaml>
<gabyfle> I don't really know how the typechecker is implemented and how hard can it be, but to me it seems like no strong constraint is put on the b type in either branches
<discocaml>
<deepspacejohn> I think my first comment might have been incorrect, but I'm not completely sure why the code isn't typechecking exactly now.
Serpent7776 has quit [Ping timeout: 252 seconds]
dstein64- has joined #ocaml
dstein64 has quit [Ping timeout: 260 seconds]
dstein64- is now known as dstein64
Frostillicus has joined #ocaml
bartholin has quit [Quit: Leaving]
Frostillicus has quit [Ping timeout: 245 seconds]
<discocaml>
<froyo> it doesn't pass the vibe-check
<discocaml>
<froyo> or-patterns don't work well with gadts, they can't carry the type equations introduced by gadts
<discocaml>
<froyo> onto the body of the match
<discocaml>
<froyo> please don't post large text blocks here or edit your text as it creates lots of noise for irc users
<discocaml>
<froyo> (see channel description)
theblatte has quit [Ping timeout: 268 seconds]
itszor has joined #ocaml
_jbrown_ has quit [Ping timeout: 272 seconds]
<discocaml>
<Kali> GADTs do not permit or-patterns, you must do it separately
<discocaml>
<froyo> more precisely they permit them but they discard any constraints provided by matching on gadt constructors.