<HyperMonkey>
how can I use Left of 'a | Right of 'b in ocaml? is it in the standard library or in an additional library or do I just define it myself?
<pigeonv>
the ('a, 'b) result type is isomorphic
<pigeonv>
it's in Base, too (but don't depend on it for a single type)
amiloradovsky has quit [Ping timeout: 240 seconds]
cheater has quit [Ping timeout: 272 seconds]
cheater has joined #ocaml
<HyperMonkey>
I guess I'll define it myself then. The Base docs claim that is the "dual" of tuple, not isomorphic to it
<pigeonv>
Ok of 'a | Error of 'b is isomorphic to Left of 'a | Right of 'b
<pigeonv>
oh, btw, don't confuse ('a, 'b) [type parameters] with ('a * 'b), a couple between parentheses
<HyperMonkey>
ah - the name of the type is literally "result" - I missed that on the first reading. I guess I'll switch to that then
<pigeonv>
it depends on what you planned to do with it ;)
<HyperMonkey>
I have a function that can succeed with a new state and an output, or fail with an error message
<pigeonv>
that's a perfect match, then
<pigeonv>
have a look at rresult if you want the typechecker to collect errors automatically
<sleepydog>
i built a library that uses [@@ppx_derving show] with dune, but i had to include ppx_deriving.runtime as a dependency of my tests of the library. is there a way to make consumers of the lib depend on ppx_deriving.runtime automatically?
<pigeonv>
if your library is built with (preprocess (pps ppx_deriving.show)) (or something more general), there's nothing to do...
<sleepydog>
hmm, that's what i did, but dune happily builds the test without depending on the runtime and i get a compilation error
<sleepydog>
ah, i see what i did
<pigeonv>
that's strange. You could try adding it as an explicit dependency of your library
<sleepydog>
(implicit_transitive_deps false) in dune-project :)
<pigeonv>
brilliant xD
<sleepydog>
i think i didn't understand what that flag did when i disabled it
mfp has quit [Ping timeout: 256 seconds]
pigeonv has quit [Ping timeout: 244 seconds]
waleee-cl has quit [Quit: Connection closed for inactivity]
dborisog has joined #ocaml
jao has quit [Ping timeout: 265 seconds]
nullcone has joined #ocaml
<HyperMonkey>
how do I make an ocaml regexp that will match ^[a-z]*$ but with no newlines permitted?
<HyperMonkey>
guess I might have to use String.index_opt separately to rule out newlines ...
narimiran has joined #ocaml
mbuf has joined #ocaml
ferd has quit [Ping timeout: 265 seconds]
ferd has joined #ocaml
ferd has quit [Ping timeout: 272 seconds]
vicfred has quit [Quit: Leaving]
sleepydog has quit [Ping timeout: 260 seconds]
chripell has joined #ocaml
Haudegen has joined #ocaml
amiloradovsky has joined #ocaml
ollehar_ has joined #ocaml
<reynir>
are you using re?
nullcone has quit [Quit: Connection closed for inactivity]
olle_ has joined #ocaml
pigeonv has joined #ocaml
mfp has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
RalfJ has quit [Ping timeout: 244 seconds]
RalfJ has joined #ocaml
pigeonv has quit [Ping timeout: 260 seconds]
pigeonv has joined #ocaml
Haudegen has joined #ocaml
<HyperMonkey>
how would I run an external command for a bounded time (e.g., 5s) and return an option of the command's standard output if it completed or None if it took longer than 5s
<HyperMonkey>
oh wait I notice now that select accepts a timeout
<HyperMonkey>
it looks like select doesn't return the unslept time .. how do I get the wall time in a manner that is robust to clock adjustments? some kind of "monotonic" time ...
<HyperMonkey>
ah there is mtime package, and also there is support in core
TheRuralJuror has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
TheRuralJuror has quit [Client Quit]
ferd has joined #ocaml
jao has joined #ocaml
nullcone has joined #ocaml
Carmelo has joined #ocaml
struktured has quit [Ping timeout: 256 seconds]
Carmelo is now known as Guest12623
jao has quit [Ping timeout: 256 seconds]
ollehar_ has quit [Ping timeout: 246 seconds]
olle_ has quit [Ping timeout: 256 seconds]
chripell has quit [Remote host closed the connection]
chripell has joined #ocaml
chripell has quit [Remote host closed the connection]
chripell has joined #ocaml
chripell has quit [Remote host closed the connection]
chripell has joined #ocaml
<HyperMonkey>
is there a way to list the ocaml switch creates that have been done? also how do I switch away from a switch back to the system-installed compiler?
<companion_cube>
`opam sw list` ?
<HyperMonkey>
hm ok nice
<HyperMonkey>
ah the man page is very clear: opam switch set <switch>
mbuf has quit [Quit: Leaving]
muskan has joined #ocaml
sleepydog has joined #ocaml
Haudegen has joined #ocaml
<olle>
Drup: so about that Affe thing, do you have a picture of how affine types in OCaml would interact with a future effect system? are they orthogonal to each other, or would it be messy?
amiloradovsky has quit [Remote host closed the connection]
amiloradovsky has joined #ocaml
dborisog has quit [Ping timeout: 256 seconds]
amiloradovsky has quit [Quit: amiloradovsky]
nullcone has quit [Quit: Connection closed for inactivity]
jao has joined #ocaml
jao is now known as Guest77108
Guest77108 has quit [Remote host closed the connection]
jao- has joined #ocaml
muskan has quit [Ping timeout: 245 seconds]
amiloradovsky has joined #ocaml
Anarchos has joined #ocaml
<Anarchos>
i am looking for a good design of formal logic with proposition and first order theories : should i use module or classes ?
waleee-cl has joined #ocaml
zolk3ri has joined #ocaml
zolk3ri has quit [Remote host closed the connection]
<HyperMonkey>
where do I find the functions that are the opposite of `Buffer.add_u?int??_.e` . that is, suppose I have a buffer containing a value, how do I read it into an integer?
<Anarchos>
int_of_string @@ Buffer.contents ?
Jesin has quit [Quit: Leaving]
<HyperMonkey>
nah I found it the functions are in Bytes module and probably perform 10x faster than int_of_string
<HyperMonkey>
of course, you must have Bytes, not Buffer
vicfred has joined #ocaml
Jesin has joined #ocaml
<Anarchos>
HyperMonkey you mention Buffer, so i anwsered with Buffer...
<HyperMonkey>
fair enough :/
<olle>
can you run ocsigen with reasonml syntax?
FreeBirdLjj has joined #ocaml
Anarchos has quit [Remote host closed the connection]
FreeBirdLjj has quit [Ping timeout: 260 seconds]
<pigeonv>
it's just a frontend, so if you manage to adapt the Makefile, yeah
jgkamat has joined #ocaml
<olle>
pigeonv: hm
<olle>
well, ocsigen also has some syntax extensions, iirc
sleepydog has quit [Remote host closed the connection]
sleepydog has joined #ocaml
<pigeonv>
ppx extensions should work, at least their doc features a Reason button
<olle>
yeah? hm
<pigeonv>
it might be ugly, but it should be usable
<simpson>
I wonder if interoperability between various flavors of ML module is a more workable dream than the general case of FFI. It seems so tantalizing.
<companion_cube>
they all have different runtimes and GCs
<companion_cube>
not sure why that'd be easier :/
<simpson>
Yep, agreed. I don't think it's feasible, but it's fun to wonder.
<olle>
a transpiler might be more easy at hand
<olle>
or, make sure all MLs compile to the same bytecode
<olle>
the JVM!
<olle>
moahaha
<HyperMonkey>
I want to transform ocaml code. As a dumb but simple example, consider the task of replacing a*b with (a,b) pair everywhere, where pair is a custom definition. Can ppx do this or is there some other library that would be more suited to the task?
<olle>
HyperMonkey: vim
<olle>
or emacs
<HyperMonkey>
well I want to transform it mechanically I mean .. by writing a program (ideally in ocaml)
<olle>
why?
<simpson>
Because some code transformations can't be expressed as functors.
<HyperMonkey>
well if you must know I want to transform a subset of ocaml into another language (or more long-term, maybe directly into the bytecodes of that language)
<HyperMonkey>
said language is similar to ocaml but supports a much restricted set of syntax
<olle>
aha
<olle>
HyperMonkey: why not hack the lexer of ocaml then?
<HyperMonkey>
well it would be convenient to have a parsed AST (not sure if that's what you mean by "lexer")
<companion_cube>
compiler-libs can give you an AST
<olle>
HyperMonkey: if you wanna make a language, you gotta know about lexer and parser
<HyperMonkey>
nah I will leave parsing to ocaml. I've already made 2 languages so far (none of them have users other than me though) and I've largely avoided major parsing by using simplified syntaxes. but as I'm learning ocaml I find the elaborate syntax and emacs tooling very convenient to use as a programmer. hence the interest in transforming a subset of
<HyperMonkey>
ocaml into one of my other languages (that is largely functional)
<olle>
still, you should know what it is, or more generally, about a standard compiler pipeline
narimiran has quit [Ping timeout: 256 seconds]
zmt01 has joined #ocaml
zmt00 has quit [Ping timeout: 244 seconds]
Hrundi_V_Bakshi has joined #ocaml
<olle>
guessing ocsigen is not highest priority? lots of old github issues.
<pigeonv>
it works for them, so...
<olle>
"them"?
<olle>
sigh
<olle>
saying they're not better than facebook?
<companion_cube>
in what way?
<olle>
afaik, facebook cares pretty much only about their own use-case
<olle>
which is why hacklang is now a niche language
<companion_cube>
which is why react is not used outside of facebook
<olle>
i don't know how much used it is, but yeah
<olle>
typescript is the standard now, at least
<olle>
microsoft did something there
<simpson>
Um, isn't ECMAScript the standard?
<pigeonv>
(I didn't say that in a negative way)
<pigeonv>
you're welcome to contribute to the issue I've referenced, though :D
<pigeonv>
I think it's always more complicated where people from different teams have different opinions
<olle>
we'll see, gotta get an overview here
<pigeonv>
but that's how life works, so we shouldn't expect something else
<olle>
pfff
<olle>
we should learn from successful projects :)
<pigeonv>
it doesn't mean we'll agree with their decisions
<pigeonv>
(btw, TypeScript's typing is unsound, so...)
<olle>
doesn't matter, it's still better than vanilla js
<olle>
I'm not talking about certain decision, more like the decision making process
<pigeonv>
that's right, it could be worse
<olle>
PHP has a voting mechanism
<olle>
FreeBSD too, kind of
<pigeonv>
we're free to fork and propose changes
<olle>
that doesn't change the culture of a certain project
<pigeonv>
... and we sometimes need some coordination
<pigeonv>
I have no problem with their culture
<pigeonv>
I mean, there's a lot of work behind
<olle>
facebook's?
<pigeonv>
no, ocsigen & eliom ;)
<pigeonv>
and they've published their tools and research
<olle>
yeah, I'm mostly talking about fb vs m$
<pigeonv>
different ways of working
<olle>
ocsigen doesn't really have a budget (i assume)
<pigeonv>
they can't work on it full-time
<olle>
exactly
<pigeonv>
integration is still a bit weak
<pigeonv>
it would be great if it worked with dune
<pigeonv>
and merlin
<pigeonv>
but it takes time
<pigeonv>
it's not really rewarding
<pigeonv>
there are a lot of decisions to make
haesbaert has quit [Ping timeout: 264 seconds]
Anarchos has joined #ocaml
<Anarchos>
I tried both 'dune build' in merlin source tree, and 'opam pin add merlin merlin_repo' to build ocamlmerlin-server. How come both binaries are different ?
Anarchos has quit [Quit: Vision[0.10.3]: i've been blurred!]
Hrundi_V_Bakshi has quit [Ping timeout: 260 seconds]
amiloradovsky has quit [Ping timeout: 260 seconds]
pierpa has joined #ocaml
Haudegen has quit [Ping timeout: 265 seconds]
Anarchos has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
nullifidian has quit [Ping timeout: 265 seconds]
nullifidian has joined #ocaml
<HyperMonkey>
is there a way to parse `-dlambda` output? or get the output in a machine form in the first place?
<Anarchos>
it seems there is no type record = mutable {...} to declare all fields of a record mutable. it would be a nice syntactic sugar !