tianon has quit [Read error: Connection reset by peer]
tianon has joined #ocaml
mengu has joined #ocaml
mengu has quit [Ping timeout: 246 seconds]
vfoley has quit [Ping timeout: 244 seconds]
fraggle-boate__ has joined #ocaml
fraggle-boate_ has quit [Ping timeout: 245 seconds]
AltGr has joined #ocaml
tianon has quit [Read error: Connection reset by peer]
tianon has joined #ocaml
madroach has quit [Ping timeout: 264 seconds]
madroach has joined #ocaml
<seangrove>
I have a yojson-parsed json obj, converted into a Assoc list, so [(string, Yojson.Basic.something)]
<seangrove>
I'm trying to append some values to that list, but I'm not sure how to construct/convert a string -> `String string
xinau has joined #ocaml
<seangrove>
Does this seem idiomatic? Yojson.Basic.(`String "asdf");;
<pippijn>
uhm
<pippijn>
no
<pippijn>
`String and Yojson.(`String) are the same thing
<seangrove>
Heh, I suspected as much
<pippijn>
polymorphic variants are global constructors
<seangrove>
Making a note of that...
x1n4u has quit [Ping timeout: 255 seconds]
<pippijn>
type t = [ `Hey ];; type u = [ `Hey of int ];; <- this is valid
<pippijn>
the two `Heys are not compatible
<pippijn>
you can't put them in the same type
<pippijn>
what you can do is: type t = [ `A | `B ];; type u = [ `A ];; let a : u = `A;; let b : t = (a :> t);;
<pippijn>
(;; is not necessary, I just put it in to make the separation clear on IRC)
MrScout_ has joined #ocaml
badkins has quit [Read error: Connection reset by peer]
avsm has quit [Quit: Leaving.]
MrScout_ has quit [Read error: Connection reset by peer]
MrScout_ has joined #ocaml
paradoja has quit [Remote host closed the connection]
MrScout_ has quit [Ping timeout: 256 seconds]
ghostpl_ has joined #ocaml
claudiuc has quit [Remote host closed the connection]
manud has joined #ocaml
reem has quit [Remote host closed the connection]
ghostpl_ has quit [Ping timeout: 272 seconds]
reem has joined #ocaml
boogie has quit [Remote host closed the connection]
boogie has joined #ocaml
<bernardofpc>
is there a syntax for match foo with | None | Some (a,b) when a*b > 0 -> ... | Some (a,b) -> ?
tianon has quit [Read error: Connection reset by peer]
tianon has joined #ocaml
boogie has quit [Ping timeout: 265 seconds]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
reem has quit [Remote host closed the connection]
reem has joined #ocaml
yminsky has joined #ocaml
darkf has joined #ocaml
<bernardofpc>
in fact, I have two problems...
<bernardofpc>
one is that merlin believes that the "Npne" is guarded by the "when"
<bernardofpc>
the other is that ocaml compiler gives me "Error: Variable a' must occur on both sides of this | pattern"
<bernardofpc>
(but, of course, neither a nor b are used in the ..., it is the error case)
badkins has joined #ocaml
oriba has quit [Quit: Verlassend]
yminsky has quit [Quit: yminsky]
<struktured>
bernardofpc: this works for me:let f foo = match foo with None -> 0 | Some (a,b) when a*b = 0 -> a-b | Some (a',b') -> a' + b'
<bernardofpc>
No
<bernardofpc>
I want let f foo = match foo with None | Some (a,b) when a*b > 0 -> false | Some (a,b) -> true
<bernardofpc>
but I guess the pattern-match precedence says that the guard applies to *all* or'ed stuff before it, not to the closest one
<struktured>
bernardofpc: in particular... you don't want to do let f foo = match foo with None -> false | Some (a,b) when a*b = 0 -> false | Some (a',b') -> true
<struktured>
sorry a*b > 0, but whatever
ericwa has quit [Quit: Leaving...]
<bernardofpc>
well, it's not as simple as "false"
<ousado>
then use a function
<struktured>
yeah exactly
<bernardofpc>
yeah, but it sucks, because I have to make up a name for this situation
<bernardofpc>
I guess I wanted a more expressive pattern match
<bernardofpc>
well, it's just precedence rules
shinnya has quit [Ping timeout: 264 seconds]
<bernardofpc>
but it turns out that having no way to put a paren there to change the precedence makes code more complicated
<struktured>
well its more of a scoping issue, in case of None, a,b don't exist so the scoping is conditioned on the LHS of the pattern
<bernardofpc>
I can perfectly understand having a global "when" clause for many matches, even if it's really not what I'd have thought more natural...
dant3 has joined #ocaml
<bernardofpc>
I mean, OCaml parses as (None | Some (a,b)) when a*b > 0, which triggers an error
<bernardofpc>
It's just sad that there's no way for it to parse as None | (Some (a,b) when a*b > 0)
<bernardofpc>
I mean, if it was [a;b;_;_] | [_;b;a;_] when a*b > 0 this would work (given an exhaustive thing after)
<ousado>
it /could/ check whether a and b are only used in the guard belonging to that one case
<bernardofpc>
ousado: the point is that the compiler does not make the precedence that way, I think
<ousado>
but as it is it complains either way, with or without guard
<ousado>
yes I know what you mean
<bernardofpc>
bleh
destrius has joined #ocaml
dant3 has quit [Ping timeout: 252 seconds]
<bernardofpc>
(for complaining about an unused variable with the wrong error )
<ousado>
in terms of generating the pattern maching code it makes total sense
<bernardofpc>
well, that's the typical compiler dileman
<bernardofpc>
and honestly, I don't understand
<bernardofpc>
if some variable is declared on only one pattern of match with two arms, it cannot be used in the sequel
<bernardofpc>
so its only possible use would be a guard
<bernardofpc>
(sequel : -> expr)
<bernardofpc>
but maybe this is harder to encode in jump tables
<ousado>
sure it is
badkins has quit []
<bernardofpc>
I mean, if you can use jmp (since youre the compiler,not a structured programmer), you have the if-code for testing the match constructur, then you jmp to the guard test, then again to the expr
<struktured>
bernardofpc: I just got it to work in scala...damnnit
<bernardofpc>
if OCaml's compiler does not compile when clauses to an if, I'd acknowledge it might be tricky
<bernardofpc>
but if it *does* compile when clauses to if, I don't really think it should be too hard
<ousado>
more cases to consider is always harder than less cases to consider
reem has quit [Remote host closed the connection]
<ousado>
but of course it could be done
<ousado>
so why don't you invert the condition
<struktured>
bernardofpc: actually, if you change either the 3 or "s" to a free variable it has a similar compiler error in scala.
<bernardofpc>
| Tpat_or (p,_,_) -> extract_vars r p -> well, this tells the compiler only knows about the vars in the first arm of an or (which is fine)
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
matason has joined #ocaml
ygrek has joined #ocaml
reem has joined #ocaml
vfoley has joined #ocaml
vfoley has joined #ocaml
antkong has quit [Quit: antkong]
nullcat_ has joined #ocaml
ghostpl_ has joined #ocaml
reem has quit [Remote host closed the connection]
ghostpl_ has quit [Ping timeout: 246 seconds]
AlexRussia has quit [Ping timeout: 272 seconds]
manud has quit [Quit: manud]
reem has joined #ocaml
AlexRussia has joined #ocaml
tianon has quit [Read error: Connection reset by peer]
tianon has joined #ocaml
swgillespie has joined #ocaml
kandu has quit [Remote host closed the connection]
tianon has quit [Read error: Connection reset by peer]
tianon has joined #ocaml
matason has quit [Ping timeout: 246 seconds]
Algebr has quit [Ping timeout: 264 seconds]
reem has quit [Remote host closed the connection]
reem has joined #ocaml
reem has quit [Remote host closed the connection]
virtualeyes has joined #ocaml
matason has joined #ocaml
reem has joined #ocaml
reem has quit [Remote host closed the connection]
ggole has joined #ocaml
reem has joined #ocaml
ghostpl_ has joined #ocaml
reem has quit [Remote host closed the connection]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
reem has joined #ocaml
ghostpl_ has quit [Ping timeout: 256 seconds]
codefo has joined #ocaml
pyon is now known as ste-pyon-ov
Algebr has joined #ocaml
matason has quit [Ping timeout: 265 seconds]
AlexRussia has quit [Ping timeout: 246 seconds]
Algebr has quit [Ping timeout: 265 seconds]
Bhavya has joined #ocaml
virtualeyes is now known as nullremains
ygrek has quit [Ping timeout: 244 seconds]
AlexRussia has joined #ocaml
slash^ has joined #ocaml
swgillespie has joined #ocaml
siddharthv_away is now known as siddharthv
xinau has quit [Ping timeout: 252 seconds]
codefo has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
freling has joined #ocaml
freling has quit [Client Quit]
MercurialAlchemi has joined #ocaml
dant3 has joined #ocaml
freling has joined #ocaml
freling has quit [Client Quit]
freling1 has joined #ocaml
freling1 has quit [Client Quit]
tianon has quit [Read error: Connection reset by peer]
tianon has joined #ocaml
dant3 has quit [Ping timeout: 252 seconds]
nullcat_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ygrek has joined #ocaml
tianon has quit [Read error: Connection reset by peer]
tianon has joined #ocaml
marynate has joined #ocaml
marynate has quit [Client Quit]
ghostpl_ has joined #ocaml
larhat has joined #ocaml
siddharthv is now known as siddharthv_away
larhat has quit [Ping timeout: 246 seconds]
larhat has joined #ocaml
larhat has quit [Client Quit]
ghostpl_ has quit [Ping timeout: 264 seconds]
larhat has joined #ocaml
magthe has joined #ocaml
<magthe>
got a cubietruck and put an image from https://github.com/mirage/xen-arm-builder on it, then proceeded to do `opam switch 4.02.1` to get the latest version of the compiler... which failed due to a warning turning into an error (`msg` is unused in ../util/misc.ml)... is this a known issue?
mengu has joined #ocaml
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<ggole>
A what truck?
<ggole>
Oh, I see
<ggole>
Neat
<magthe>
ggole: yeah, I thought so too :)
<adrien>
die warn-error, die!
<magthe>
adrien: yes, that was my first thought too, but didn't have time to look into exactly how to disable warn-error
<magthe>
I'm a hopeless newbie at opam, so is there any way of controlling the compiler flags from the command line?
<whitequark>
OCAMLPARAM=_,warn-error=-A
avsm has joined #ocaml
antkong has joined #ocaml
tianon has quit [Read error: Connection reset by peer]
tianon has joined #ocaml
slash^ has quit [Read error: Connection reset by peer]
<magthe>
whitequark: where would I find out about that env var? (opam --help doesn't list it)
<whitequark>
it's an ocamlc's one
<magthe>
hmm, but not documented in man page or its help... and I'm guessing 'a' means 'all', the default for warn-error is '-a' already though
<magthe>
well, I just have to test it when I'm home
thomasga has joined #ocaml
avsm has quit [Quit: Leaving.]
antkong has quit [Ping timeout: 255 seconds]
ghostpl_ has joined #ocaml
axiles has quit [Quit: Quitte]
ghostpl_ has quit [Ping timeout: 255 seconds]
mort___ has joined #ocaml
<reynir>
A means all (Upper case)
<reynir>
ocamlc -warn-help lists what the errors are
dant3 has joined #ocaml
Haudegen has quit [Ping timeout: 245 seconds]
tianon has quit [Read error: Connection reset by peer]
tianon has joined #ocaml
ia0 has quit [Quit: leaving]
siddharthv_away is now known as siddharthv
ia0 has joined #ocaml
freling has joined #ocaml
antkong has joined #ocaml
Haudegen has joined #ocaml
oscar_toro has quit [Ping timeout: 265 seconds]
mort___ has quit [Quit: Leaving.]
axiles has joined #ocaml
larhat has quit [Quit: Leaving.]
dsheets has quit [Ping timeout: 256 seconds]
oscar_toro has joined #ocaml
ghostpl_ has joined #ocaml
mengu has quit [Remote host closed the connection]
<avsm>
Leonidas: thanks — i think AltGr is doing a coordinated announcement
<Leonidas>
ok, then hereby pinging AltGr :-)
<Leonidas>
(I only found out about the release because Arch Linux packaged it)
kakadu has joined #ocaml
<Leonidas>
oh, 1.2.1 uses unicode arrows and swirls, cute :-)
Simn has joined #ocaml
ollehar has quit [Quit: ollehar]
ollehar has joined #ocaml
<ggole>
magthe: Hmm? The warning/error stuff is all in the ocamlc manpage.
freling has quit [Quit: Leaving.]
Hannibal_Smith has joined #ocaml
tianon has quit [Read error: Connection reset by peer]
tianon has joined #ocaml
mort___ has joined #ocaml
thomasga has quit [Quit: Leaving.]
<magthe>
ggole: I don't find any mention of the environment variable there
<magthe>
ggole: and `ocamlc --help` list the default for -w as `-a`, not `-A` :)
<ggole>
"The letters stand for the following sets of warnings" with -A described as "all"
<ggole>
You're right about the env variable though
<ggole>
(Or is that an opam thing?)
<AltGr>
Leonidas: yeah, it's coming :)
<magthe>
ggole: yes, now I found that part of the manpage too, I'm just being impatient and irritated because I'd much rather be home playing with ocaml on ARM than at work dealing with PLC crap
<AltGr>
Any idea why github suddenly started filing most of my code as standard ML instead of OCaml ?
<magthe>
ggole: not sure, I find no mention of OCAMLPARAM anywhere
<flux>
still misses quite many :), maybe it's processing-in-progress
<ggole>
OCAMLRUNPARAM is mentioned though... perhaps this should be added to the manual
<ggole>
(And the ocamlc/opt man page.)
<magthe>
ggole: yes, always nice to document useful features :) and the ocaml toolchain is still confusing to me, opam/ocamlfind/ocamlc/... which is used by which and when
<ggole>
Confusing is what the toolchain does best.
<magthe>
ggole: and here I was hoping that prolonged exposure would lead to clarity... is there no hope?
<ggole>
I think there's a possibility that prolonged expose would lead to knowing how to compile things
<ggole>
'Clarity' is probably a bit too much to ask for.
<magthe>
ggole: luckily the language itself makes up for the issues with tooling
* magthe
needs to get back to work
<ggole>
opam is usually quite good though
<magthe>
ggole: yes, I'm impressed with opam... I used ocaml briefly before opam's existance, and it was terrible to get things built back then
<magthe>
still haven't written an opam recipe myself though... but so far just using it to build other stuff simply works
* magthe
is going back to the PLC crap
<magthe>
ggole: thanks for the help
magthe has quit [Quit: WeeChat 1.1.1]
dsheets has joined #ocaml
tianon has quit [Read error: Connection reset by peer]
spearalot has joined #ocaml
spearalot has quit [Remote host closed the connection]
* mrvn
still wants a opam to deb converter
tianon has joined #ocaml
<Leonidas>
debian packages ar hilariously complex to make
<mrvn>
not realy
larhat has joined #ocaml
reem has quit [Remote host closed the connection]
dsheets has quit [Ping timeout: 252 seconds]
antkong has quit [Ping timeout: 252 seconds]
spearalot has joined #ocaml
spearalot has quit [Client Quit]
<whitequark>
they are
<whitequark>
source: i'm making one right now
fedjo has joined #ocaml
dsheets has joined #ocaml
gdsfh has joined #ocaml
<gdsfh>
hello. I want to patch runtime (2 lines of code: debug prints). What is the easiest way to use modified runtime in my application? Can opam help me here?
matason has joined #ocaml
spearalot has joined #ocaml
dant3 has joined #ocaml
spearalot has quit [Remote host closed the connection]
mengu has quit [Remote host closed the connection]
axiles has quit [Ping timeout: 246 seconds]
<Leonidas>
mrvn: if you want a good one, they have lots and lots of rules and for the rules to be manageable they created cdbs, debhelper, dh_make etc. and lintian as checker.
<gdsfh>
whitequark: thank you!
<mrvn>
Leonidas: if you have a good one it has %: dh and maybe one or two overrides
<xificurC>
if I have some record types I'm using in my app, is it typical/idiomatic to create separate .ml(i) files for each one?
<AltGr>
Leonidas, yeah, I have been wondering how thick would the Guidelines be if printed as a book
AltGr has left #ocaml [#ocaml]
matason has quit [Ping timeout: 245 seconds]
<xificurC>
I have a player, a card, a hand, settings, etc. Creating 2 files for each
<Leonidas>
mrvn: that just hides the complexity under layers of wrapper scripts. Now something needs to be adjusted and you have to dig into it.
<Leonidas>
xificurC: I'd say no. It is not java.
<mrvn>
Leonidas: No I don't. I want it to already work.
<xificurC>
Leonidas: so you'd just keep all in one file?
sdothum has joined #ocaml
<xificurC>
Leonidas: and wrap them in modules there?
<Leonidas>
xificurC: not "everything". But related things go in one file, yes.
<xificurC>
Leonidas: so something like a card can be in a separate file since the representation makes sense in any card game, but what is specific to the app can be coupled in 1 file
<Leonidas>
well if you like. I'd put everything in one file and split if it feels like there is a good reason to have it in a different file
<Leonidas>
we have different types for each compiler phase.
<Leonidas>
or rather, tree representation.
<Leonidas>
which kinda makes sense to me
matason has joined #ocaml
mort___ has quit [Ping timeout: 256 seconds]
oscar_toro has quit [Ping timeout: 252 seconds]
larhat has quit [Read error: Connection reset by peer]
larhat has joined #ocaml
tianon has quit [Read error: Connection reset by peer]
tianon has joined #ocaml
<xificurC>
Leonidas: not sure I understand what you mean by the compiler phases
avsm has joined #ocaml
mengu has joined #ocaml
mengu has joined #ocaml
siddharthv is now known as siddharthv_away
Haudegen has quit [Ping timeout: 244 seconds]
yminsky has joined #ocaml
mengu has quit [Ping timeout: 244 seconds]
siddharthv_away is now known as siddharthv
ghostpl_ has joined #ocaml
thomasga has quit [Quit: Leaving.]
yminsky has quit [Ping timeout: 265 seconds]
antkong has joined #ocaml
tianon has quit [Read error: Connection reset by peer]
tianon has joined #ocaml
Haudegen has joined #ocaml
ygrek has quit [Ping timeout: 252 seconds]
_andre has joined #ocaml
mengu has joined #ocaml
antkong has quit [Ping timeout: 246 seconds]
xinau has joined #ocaml
thomasga has joined #ocaml
thomasga has quit [Client Quit]
tianon has quit [Read error: Connection reset by peer]
tianon has joined #ocaml
kandu has joined #ocaml
thomasga has joined #ocaml
ghostpl_ has quit [Remote host closed the connection]
siddharthv is now known as siddharthv_away
<Leonidas>
xificurC: it is about my program. my program has distinct phases with distinct representations for the data, so each of these representations gets its own file.
tianon has quit [Read error: Connection reset by peer]
zoetus has joined #ocaml
tianon has joined #ocaml
<zoetus>
hey everyone!
<zoetus>
i was wondering what the preferred testing frameworks are for ocaml
<zoetus>
i've seen ounit, but i didn't know if there were viable alternatives
<whitequark>
i've not found anything besides ounit usable
<zoetus>
okay, good to know, thanks
matason has quit [Ping timeout: 256 seconds]
freling has joined #ocaml
mengu has quit [Remote host closed the connection]
mobajm has joined #ocaml
mobajm has quit [Client Quit]
ghostpl_ has joined #ocaml
mobajm has joined #ocaml
mobajm has left #ocaml [#ocaml]
Denommus has joined #ocaml
mobajm has joined #ocaml
mobajm has quit [Remote host closed the connection]
mobajm has joined #ocaml
mobajm has quit [Client Quit]
mengu has joined #ocaml
mengu has joined #ocaml
waneck has joined #ocaml
tianon has quit [Read error: Connection reset by peer]
tianon has joined #ocaml
zoetus has quit [Ping timeout: 246 seconds]
thomasga has quit [Quit: Leaving.]
yminsky has joined #ocaml
contempt has quit [Ping timeout: 265 seconds]
tianon has quit [Read error: Connection reset by peer]
tianon has joined #ocaml
reem has joined #ocaml
spearalot has joined #ocaml
contempt has joined #ocaml
spearalot has quit [Remote host closed the connection]
reem has quit [Ping timeout: 265 seconds]
yminsky has quit [Quit: yminsky]
badkins has joined #ocaml
tianon has quit [Read error: Connection reset by peer]
tianon has joined #ocaml
shinnya has joined #ocaml
<xificurC>
I read in 5 strings from Lwt_io.stdin, so I have 5 vars of string Lwt.t . Now I want to use that to create a record that holds the 5 strings. How can I do that?
<ggole>
Um, in the usual way? Have you programmed with records in OCaml before?
<adrien_znc>
match on the results, handle the expected case, create a record, handle the unexpected case and error as wished
<ggole>
Oh, string Lwt.t. My brain skipped right over the type constructor.
matason has joined #ocaml
<xificurC>
yeah, for the sake of example: type mytype = { x: int; y: int}; let x = Lwt.return 1 in let y = Lwt.return 2 in ???
sgnb`` has joined #ocaml
<xificurC>
ggole: and no, not much as I just started with ocaml :) I did some haskell before and I see lwt's correlation to monads, but I don't see a function of e.g. 'a Lwt.t list -> 'a list Lwt.t
sgnb` has quit [Ping timeout: 265 seconds]
mengu has quit [Remote host closed the connection]
<zozozo>
xificurC: I think you should probably use 'Lwt.bind' to return a 'mytype Lwt.t'
<xificurC>
in the above case I see how to make mytype = { x: int Lwt.t; y int Lwt.t }, but I wanted to return { x; y } Lwt.t, or even just the record, if there is away out of the monad
tristero has quit [Ping timeout: 256 seconds]
mengu has joined #ocaml
mengu has joined #ocaml
<mrvn>
so your problem is extarcting the value from a Lwt.t
<ggole>
I'm not too familiar with Lwt, but isn't Lwt.state what you want?
<ggole>
match Lwt.state x, Lwt.state y with Lwt.Return x, Lwt.Return y -> { foo = x; bar = y } | ... -> <handle error case>
<ggole>
(Although there's probably some combinator to do that more elegantly.)
<xificurC>
mrvn: something like that
<xificurC>
ggole: maybe, still wrapping my head around everything
tianon has quit [Read error: Connection reset by peer]
tianon has joined #ocaml
Bhavya has quit [Quit: Quit the channel]
<reynir>
you could use bind as many times as you have fields to get a myrecord Lw.t
<reynir>
Lwt.t
boogie has joined #ocaml
<reynir>
I don't know f what I'm sayng makes much sense
marynate has joined #ocaml
boogie has quit [Remote host closed the connection]
jwatzman|work has joined #ocaml
rishabhjain has joined #ocaml
<xificurC>
reynir: that's just how I got it to work, so yes it does! Thanks
mjw56 has joined #ocaml
Haudegen has quit [Remote host closed the connection]
Haudegen has joined #ocaml
tianon has quit [Read error: Connection reset by peer]
tianon has joined #ocaml
<reynir>
great
<reynir>
Is there a regular expression library that doesn't necessarily work on strings?
Haudegen has quit [Ping timeout: 252 seconds]
<companion_cube>
I don't think so
<ggole>
You mean, something to search over arbitrary ADTs?
<companion_cube>
oh, I thought it was only on arbitrary characters
mjw56 has quit [Ping timeout: 256 seconds]
cesar_ has joined #ocaml
<reynir>
I'm not sure. I want to match on a list of atoms that are not characters
zoetus has joined #ocaml
cesar_ is now known as Guest12452
<zoetus>
are there any good guides out there on how to set up an ocamlbuild project to use a separate target for running tests?
<xificurC>
is there a simple way to print out any record? Or is this a serialization question and I'd need to use sexplib
<companion_cube>
it's a serialization problem
<companion_cube>
you can use whichever deriver you want, ppx_deriving.show does the job too
<xificurC>
companion_cube: didn't hear of that one yet, will take a look, thanks
<companion_cube>
reynir: I don't think that exist, sorry.
<companion_cube>
xificurC: ppx_deriving is new and quite modern (uses ppx), but it requires OCaml >= 4.02
<reynir>
looks like I've found me a weekend project then :)
<xificurC>
companion_cube: yes I see the love for ppx and hate for ocamlp4 :)
<zoetus>
ha, that may work actually
<zoetus>
thumbs up for simplicity
axiles has joined #ocaml
<companion_cube>
reynir: you want to write a regex engine from scratch?
<companion_cube>
if so, consider refactoring Re to functorize it over the type of characters
<companion_cube>
(although it's a tough job, I think)
<companion_cube>
it would be awesome, for it would make Re work on unicode
<ggole>
Real support for unicode needs more than that, though
<ggole>
eg, consider a regexp to search for lower-case chars
<reynir>
just the ones that correspond to regular languages
<xificurC>
doesn't str already have regex support? What is the reason for a second library
marynate has quit [Quit: Leaving]
<ggole>
Because Str is terrible
waneck has quit [Remote host closed the connection]
Algebr has joined #ocaml
<xificurC>
that's short and concise, I'll believe you
<flux>
even if some interface in Str looked thread safe.. it likely isn't. because it's implemented in terms of the other decidedly non-thread-safe functions.
<flux>
though I suppose os-level threads aren't very popular in ocaml
Hannibal_Smith has quit [Ping timeout: 246 seconds]
<xificurC>
the documentation of the packages is really sparse
<xificurC>
I can't find show in ppx_deriving and Re has no docs
<flux>
what kind of documentation are you looking for on Re?
<flux>
I took a random look on a few .mli-files, they seem to have decent enough documentation?-o
tianon has quit [Read error: Connection reset by peer]
<flux>
often times the types of the functions tell a story already
tianon has joined #ocaml
Haudegen has joined #ocaml
<flux>
for example the function Re.exec, Re.execp and Re.exec_partial
<flux>
val exec : ?pos:int -> ?len:int -> re -> string -> substrings val execp : ?pos:int -> ?len:int -> re -> string -> bool val exec_partial : ?pos:int -> ?len:int -> re -> string -> [ `Full | `Mismatch | `Partial ]
<xificurC>
flux: e.g. something like lwt has
<flux>
seem relatively understandable what they do even without documentation :-o
meteo has quit [Ping timeout: 255 seconds]
<xificurC>
flux: links to submodules, a little bit of explanation to the important functions, an overview page
<flux>
though I wouldn't mind seeing actual examples in the .mli files
<flux>
xificurc, ok, so introduction etc, that's definitely nice if modules have it
<flux>
what exists are mostly reference documentation, not the 'big picture' docs
<xificurC>
flux: yeah, and a click-happy interface, not mli files scattered across the directory
<flux>
I wonder about that exec_partial.. no way to resume matching?
<flux>
sad. I would have thought the ability to have that would be the one big plus for a native ocaml implementation :)
<xificurC>
flux: would be nice to e.g. type `opam doc re' and a webpage would open in your favorite browser that would be a result of a auto-generation
<xificurC>
flux: I mean the docs would be auto-generated
<companion_cube>
ggole: yes, indeed
<companion_cube>
you need decision trees parametrized with predicates, all that stuuf
Guest12452 has quit [Remote host closed the connection]
<companion_cube>
but first, functorizing over the alphabet is required anyway
<companion_cube>
Algebr: that could be a ppx, I suppose
<companion_cube>
no chance to see that in the compiler though, imho
nullcat_ has joined #ocaml
<ggole>
Algebr: write a hashtbl_of_alist and use that
<whitequark>
hrm. yeah, should change that
Hannibal_Smith has joined #ocaml
<Algebr>
companion_cube: why no chance? Just expand the grammar a little bit.
<companion_cube>
in practice, the core team will not do that
<companion_cube>
Hashtbl doesn't have a special status
<companion_cube>
because it's definable by the user (unlike Array or String)
<Algebr>
special status meaning being defined in c code?
rishabhjain has quit [Remote host closed the connection]
<ggole>
The "special status" of array doesn't really have anything to do with access sugar though
<companion_cube>
ggole: it's related to the unsafe manipulation of a continuous block of memory
<companion_cube>
Algebr: or known to the compiler, but yes
Hannibal_Smith has quit [Ping timeout: 255 seconds]
<ggole>
Yeah, but that's independent of syntax
rishabhjain has joined #ocaml
<ggole>
And (except for -unsafe) all of the array operations with sugar are safe anyway
tianon has quit [Read error: Connection reset by peer]
ptc has joined #ocaml
tianon has joined #ocaml
maufred has quit [Ping timeout: 255 seconds]
<companion_cube>
because they are provided by OCaml
<companion_cube>
there is no way a regular library could define arrays, unless it also uses some C
<companion_cube>
(and the compiler even knows about float arrays, but yuck)
Hannibal_Smith has joined #ocaml
maufred has joined #ocaml
<ggole>
What are we even discussing? What bearing does this have on hash table literals?
<companion_cube>
I was just underlining that Hashtbl wasn't known to the compiler, unlike Array
<companion_cube>
(which has its own syntax)
<companion_cube>
the module Hashtbl is regular OCaml
boogie has joined #ocaml
mengu has quit [Remote host closed the connection]
<ggole>
Sure (although there's some instrinsics in there), but that doesn't stop them from adding sugar that expands to Hashtbl.whatever
<ggole>
(Not that I think Hashtbl deserves such special treatment.)
tristero has joined #ocaml
nullcat_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
sepp2k has joined #ocaml
<zoetus>
is there a way to tell ounit to print each test name to sdtout instead of just the dots?
<companion_cube>
zoetus: I think some function of OUnit takes command-line arguments, including -verbose
<companion_cube>
ggole: well, a ppx (or camlp4 extension) can do it
<companion_cube>
[%tbl a, b; c, d] and so on
darkf has quit [Quit: Leaving]
<ggole>
Hashtbl.{ "one", 1; "two", 2 } would be nice
<ggole>
With a bit of convention you could make it work for user types
yomimono has joined #ocaml
slash^ has joined #ocaml
<zoetus>
hmm, neither -verbose nor -display seem to do it
<Denommus>
I'm kinda confused with the "with" syntax for functors
<companion_cube>
you need to use OUnit.run_test_tt_main
<zoetus>
(well, -verbose technically does it, but you get a bunch of other output you don't care about as well)
<companion_cube>
Denommus: you mean for signatures?
<zoetus>
i am using that
<companion_cube>
oh, just the name, I don't know
<Denommus>
companion_cube: maybe, I don't know
<Denommus>
companion_cube: I have a CONTAINER sig with only a 'a t and a val fold_left (with the obvious signature)
<companion_cube>
yes
<Denommus>
companion_cube: and a functor that takes a module of the CONTAINER sig
<companion_cube>
functor(C : CONTAINER) -> S, right ?
<Denommus>
companion_cube: now I want to create a concrete module that takes the module List as a parameter
<companion_cube>
(for some signature S)
<ggole>
So you want to do (M : CONTAINER with type 'a t = 'a list)?
maufred has quit [Ping timeout: 256 seconds]
<ggole>
(But in the right place.)
maufred has joined #ocaml
<Denommus>
ggole: what would the right place be? That's what's confusing me
<Denommus>
ggole: what I'm trying to do is module FooList = Foo(List: CONTAINER where type 'a t = 'a list), but of course I'm having a syntax error
dsheets has quit [Ping timeout: 264 seconds]
<hcarty>
ggole: Something similar is hopefully coming in 4.03
<ggole>
Denommus: first, it's with and not where
Simn has quit [Ping timeout: 252 seconds]
<Denommus>
ggole: I typed here wrong. I used with
<Denommus>
what else?
<ggole>
Second, I think you need to use it at the module definition point (and there to add information to any signature that you gave the result module)
<ggole>
Eg, if you had module T (M : CON) : CON = struct include M end
mengu has joined #ocaml
tianon has quit [Read error: Connection reset by peer]
tianon has joined #ocaml
<ggole>
You would not be able to use T(List) and List together, because the equality of types has been lost
<Denommus>
ggole: I ended up doing module FooList = Foo(struct type 'a t = 'a list;; include List end)
<Denommus>
ggole: thanks for the help
dsheets has joined #ocaml
keen______ has joined #ocaml
<zoetus>
if i have a functor `Foo (SS : Stringable.S) = struct ... end`
<zoetus>
can i not write `Foo(Int).some_func x` ?
<zoetus>
i get 'parse error currified constructor'
keen_____ has quit [Ping timeout: 245 seconds]
thomasga has joined #ocaml
mengu has quit [Remote host closed the connection]
tianon has quit [Read error: Connection reset by peer]
tianon has joined #ocaml
badkins has quit [Read error: Connection reset by peer]
<ggole>
zoetus: nope, Foo (Int) is parsed as constructor application
<ggole>
So module FooInt = Foo(Int) FooInt.some_func etc
rishabhjain has quit []
tianon has quit [Client Quit]
Algebr has quit [Remote host closed the connection]
<zoetus>
ugh, okay
uris77 has joined #ocaml
tianon has joined #ocaml
BitPuffin has joined #ocaml
matason has quit [Ping timeout: 246 seconds]
lordkryss has quit [Quit: Connection closed for inactivity]
dsheets has quit [Ping timeout: 265 seconds]
avsm has quit [Quit: Leaving.]
dant3 has quit [Remote host closed the connection]
dant3 has joined #ocaml
tianon has quit [Read error: Connection reset by peer]
tianon has joined #ocaml
oriba has joined #ocaml
dsheets has joined #ocaml
dant3 has quit [Ping timeout: 272 seconds]
xificurC has quit [Ping timeout: 256 seconds]
<seangrove>
I'm still bashing away at getting a proper utop workflow with multiple subdirectories and files. Right now my thought it to write a script that compiles all of the files into cmi/cmo files that I can then #require ...;;
<seangrove>
But I'm having a hard time getting the files compiled. As an example, I run `ocamlfind ocamlc -I lib,cli, -package xmlm lib/xmlRope.mli lib/xmlRope.ml` => `File "lib/xmlRope.ml", line 1: Error: Could not find the .cmi file for interface lib/xmlRope.mli.`, but lib/xmlRope.cmi has been created
<seangrove>
I guess the include directory isn't for build artifacts, only source code
<seangrove>
There's probably a combo of flags here that should get things working...
<companion_cube>
I think you should use a build system, for starters
<companion_cube>
e.g. ocamlbuild
<seangrove>
companion_cube: I'm using ocamlbuild in my Makefile, but trying to figure out how all the pieces fit together
<seangrove>
I'll go back to trying ocamlbuild
<companion_cube>
oh, ok
<companion_cube>
the ocaml manual explains the compilation process, but it's a bit of a pain to do manually
ptc has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
badkins has joined #ocaml
mort___ has joined #ocaml
oriba has quit [Ping timeout: 264 seconds]
<ggole>
seangrove: ocamlbuild has a (somewhat sketchy) feature to build toplevels
ptc has joined #ocaml
ollehar1 has joined #ocaml
Antoine59 has quit [Ping timeout: 256 seconds]
avsm has joined #ocaml
tianon has quit [Read error: Connection reset by peer]
tianon has joined #ocaml
copy8 has joined #ocaml
Hannibal_Smith has quit [Quit: Leaving]
uris77 has quit [Quit: leaving]
xinau has quit [Ping timeout: 264 seconds]
ghostpl_ has quit [Remote host closed the connection]
kakadu has quit [Quit: Page closed]
ghostpl_ has joined #ocaml
mort___ has quit [Ping timeout: 256 seconds]
cmtptr has joined #ocaml
<cmtptr>
I'm gonna learn the shit out of this language today.
oriba has joined #ocaml
<Drup>
you can start renaming yourself "cmtref" then :3
<cmtptr>
maybe I will, but I am no Jedi yet
boogie has quit [Remote host closed the connection]
thomasga has quit [Quit: Leaving.]
ste-pyon-ov has quit [Ping timeout: 246 seconds]
BitPuffin has quit [Ping timeout: 272 seconds]
thomasga has joined #ocaml
oriba has quit [Ping timeout: 256 seconds]
thomasga has quit [Client Quit]
dsheets has quit [Ping timeout: 265 seconds]
gdsfh has quit [Quit: Leaving.]
gdsfh1 has joined #ocaml
yomimono has quit [Ping timeout: 255 seconds]
tPuffinBi has joined #ocaml
Hannibal_Smith has joined #ocaml
<ollehar1>
lol +1
<ollehar1>
at drup
BitPuffin has quit [Ping timeout: 244 seconds]
pyon has joined #ocaml
ghostpl_ has quit [Remote host closed the connection]
Haudegen has quit [Ping timeout: 256 seconds]
ghostpl_ has joined #ocaml
snikkers has joined #ocaml
shinnya has joined #ocaml
dsheets has joined #ocaml
dsheets has quit [Remote host closed the connection]
dsheets has joined #ocaml
xificurC has joined #ocaml
bjorkintosh has quit [Quit: Leaving]
boogie has joined #ocaml
Haudegen has joined #ocaml
<tobiasBora>
Hello !
<Denommus>
hi
lopex has quit [Ping timeout: 252 seconds]
emmanueloga has quit [Ping timeout: 250 seconds]
oskarth has quit [Ping timeout: 252 seconds]
<tobiasBora>
I'm trying to use macaque in Toplevel, but I always have a "syntax error" on the beginning of the line : let test_tb = <:table< users ( avatar text ) >>
imslavko has quit [Read error: Connection reset by peer]
leifw has quit [Ping timeout: 252 seconds]
<Drup>
you did the mandatory #camlp4o and all that ?
<tobiasBora>
I began my file with #use "topfind";; #camlp4o;; #require "macaque";; #require "macaque.syntax"
xificurC has quit [Remote host closed the connection]
avsm has quit [Quit: Leaving.]
<Denommus>
is there a good functional language for mono/.NET?
<Denommus>
F# is kinda lacky
<Denommus>
I wish there was a project like OCaml-Java
<tobiasBora>
Here is a possible explanation of someone : "I believe that's because script file is first parsed, and then the directives are executed, hence it cannot handle unknown (yet) syntax"