FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
MercurialAlchemi has joined #ocaml
copy` has quit [Quit: Connection closed for inactivity]
brunoro has joined #ocaml
tmtwd has joined #ocaml
brunoro has quit [Ping timeout: 248 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
govg has joined #ocaml
Phagus has joined #ocaml
Mercuria1Alchemi has joined #ocaml
Algebr` has quit [Remote host closed the connection]
Phagus has quit [Quit: leaving]
kakadu has joined #ocaml
Sorella has quit [Quit: Connection closed for inactivity]
brunoro has joined #ocaml
noethics has quit [Ping timeout: 252 seconds]
brunoro has quit [Ping timeout: 248 seconds]
fluter has joined #ocaml
slash^ has joined #ocaml
rgrinberg has quit [Ping timeout: 252 seconds]
shinnya has joined #ocaml
kakadu has quit [Remote host closed the connection]
randomA has joined #ocaml
<randomA>
Hi, I have a question about functors
<randomA>
Suppose I am writing a functor called TestA, that takes as an argument a functor called MakeA. So module TestA(M:MakeA) = struct ... How would I be able to access the actual A? would I do module A = M(string) ?
<randomA>
Is anyone here?
<reynir>
What is MakeA?
<randomA>
so essentially, A is tu[e tjat o,[;e,emts d
<randomA>
MakeA is a functor
<randomA>
that makes A from a Comparable boject
<randomA>
as in the normalsih Comparable
<randomA>
reynir: did i answer really soo stfff
<randomA>
djoy dptti
groovy2shoes has joined #ocaml
<reynir>
uh
<randomA>
reynir: im sorry, dam i not being clear?
<randomA>
actually. So I want to create a test mdouel for Map.
<randomA>
ok?
<randomA>
module TestMap (M: Map.Make) = struct
<reynir>
Sorry no, you made some typos
<randomA>
module TMap = Map.Make(T : Comparable)
<randomA>
I get an error here saying T don't exist
<reynir>
You can do that provided there's a module T of course
<randomA>
reynir: write, so T is suppose to represent the Key values
<randomA>
but suppose i don't want to specify the key value type
<randomA>
so how owuld I create my T module?
<reynir>
I guess you could add another parameter: module TestMap (M: Map.Make) (T: Comparable) = struct ...
<randomA>
suppose I cannot add another parameter?
<randomA>
because this is already in the interface
<randomA>
and i cant change the interface
brunoro has joined #ocaml
<randomA>
So I tried to do module T:Comparable = struct type t = 't let compare = ... and then I don't know what to do about that
<randomA>
rgiht because how would I define compare without knowing what types
<reynir>
I can't see it's possible if you can't create a Comparable instance (because key type) and you can't add T as a parameter
<randomA>
i just can't add T as a parameter
<randomA>
but the point is that I just need to create a TestMap functor that can test Maps of any type
<randomA>
When I call TestMap on a MakeTest, it will generate tests for the MakeTest's Map's type
freusque has joined #ocaml
orbifx has joined #ocaml
brunoro has quit [Ping timeout: 248 seconds]
<randomA>
reynir: would it perhaps work if I were to define T to be a functor?
ocabot has joined #ocaml
<randomA>
oh perhaps it is with <Blank>.t
<randomA>
write, so type is sometype.t
<randomA>
like a string Map is like Map.string
<randomA>
im sorry, im so dumb
nicholasf has quit [Remote host closed the connection]
nicholasf has joined #ocaml
govg has quit [Ping timeout: 264 seconds]
orbifx has quit [Ping timeout: 272 seconds]
nicholasf has quit []
<randomA>
is there anyone on?
<randomA>
someone please help me
<companion_cube>
module TestMap(T : Map.Comparable) = struct … end ?
<randomA>
but now how do I run tests on the the Map's keys without knowing what kind of keys it is
<randomA>
I would have to make some sort of assumption about the keys of Map.Make
<randomA>
so like then module MyMap = M(String)
<companion_cube>
for testing you'll have to instantiate with a concrete type
<companion_cube>
yes
<companion_cube>
but you know that the map will not be able to use informations about the concrete type, so it's fine
<randomA>
companion_cube: right, but while I'm writing the TestMap module, I still would have to assume that Map is of key type string
<companion_cube>
(testing with strings, or integers, is enough)
<randomA>
companion_cube: but if I assume strings, I cannot test with integers
<companion_cube>
TestMap should take a functor as parameter, but instantiate it
<companion_cube>
module TestMap(M : functor(X:OrderedType) -> Map.S with type key = X.t) = struct … end
<randomA>
right, so inside DictTester, if I want to test "Map.find"
<companion_cube>
something like this should work: you take a polymorphic map ( a functor)
<companion_cube>
but then in … you can instantiate the functor with String
tmtwd has quit [Ping timeout: 252 seconds]
<randomA>
companion_cube: but then my TestMap functor will only be able to test for Maps with string keys?
<randomA>
or no
<randomA>
so module TestMap(M : functor (C: Comparable) -> Map with type Key.t = C.t) = struct ... end
<randomA>
except that I've replaced the M : functor... bit with the Map.Make
<randomA>
since that is essentially what Map.make is
<randomA>
but inside the module, how do I access my t values
<companion_cube>
it would test with string, sure
<companion_cube>
I mean, you cannot test on abstract values, can you?
<randomA>
companion_cube: but wouldn't I want it to be able to test with any keys?
<randomA>
no
<companion_cube>
becaues it does not make any sense
<randomA>
so it is not possible for me to right TestMap so that it can take in Maps of any keys?
<randomA>
*write
<companion_cube>
you can
<companion_cube>
but at some point you need to specify concrete types for the keys
wolfcore has quit [Ping timeout: 264 seconds]
<companion_cube>
and to be able to generate some values for those keys
<companion_cube>
otherwise you cannot test if you don;t have any input values
<randomA>
ok, so what would I write for my "representative keys". after declaring module TestMap (M: Map.Make) = struct module MyMap = M(MyKeys) end
<randomA>
but what do I put for "MyKeys" ?
<randomA>
if I do not want to specify yet what type is MyKeys
<reynir>
incr companion_cube
<companion_cube>
I don't know what you want to do
<companion_cube>
you seem to want to do something impossible
<companion_cube>
testing needs concrete values at some point
<randomA>
ok, so this is definitely impossible
AlexDenisov has joined #ocaml
<randomA>
because I've been searching all night trying to find a way
<randomA>
and i think it is impossible
<randomA>
but you know how in the List module, they do not specify a type, they just use like 't
<randomA>
I thought I oculd be able to write this module without specifying a type
<companion_cube>
you can write modules that abstract on types
<companion_cube>
but at some point, for testing, you need concrete types
<companion_cube>
is all
<randomA>
ok, i understand
<randomA>
Thank you for clearing that up
<randomA>
companion_cube: do you think it is better if I test with ints or stirngs if I'm wriing a TestMap module
<randomA>
because i want to essentially generate ounit tests with this module
<randomA>
or does it not really matter
<companion_cube>
it doesn't matter much
<randomA>
why not?
<companion_cube>
because in both cases you can write lots of interesting tests
<companion_cube>
and print the values on which tests fail easily
<randomA>
ok. I've always found int easier, so I will do that
wolfcore has joined #ocaml
<randomA>
Suppose I use Ints for this test, but my Map implemetation will be used with string keys. Will my testing not be considered good because I use int keys?
<flux>
randoma, the difference between Map and List is that List doesn't need to care about the content. consider how List has sort that takes the comparison function as an argument, whereas Map is always sorted. (so the comparison function for that type comse from somewhere)
<randomA>
flux: yeah, I understand now
<randomA>
I wish I found out earlier though, I've spent all night from 9 pm to 3:30 AM
<flux>
now someone might mention that how about the polymorphic = -operator, yes, there is a polymorphic map in ie. batteries that can make use of it, I think..
<randomA>
not even all night, like all day, from 5 PM to 3:30 AM
<randomA>
no, it's ok, i don't want batteries
<flux>
but using the = -operator can be error-prone and it can even produce runtime errors (ie. when comparing functions)
<randomA>
so if I create my TestMap using int keys, but my Map implementation will be mostly using String keys, is that bad?
<flux>
I think the key here is that Map doesn't actually care about the content. it cares about the interface on the content.
<randomA>
or is it valid for me to claim that the functions of my implementation that pass the tests with int keys will also pass the tests with string keys
<flux>
so most of the time Map is going to use T.compare to compare those values
<randomA>
Yeah, that is what i'm thinking
<flux>
if you change T from Int to String, you are testing T, not Map
<randomA>
so I figure I int is easier for me to work with than strings
<flux>
yes, I think that's a good way to go
<randomA>
ok, so just to make sure. testing my Map with int keys is fine even if my Map will be used with string keys
<randomA>
because Map only cares about compare
<flux>
yes
<randomA>
cool. So would a good way to test be to test using the actual Map module?
<randomA>
like test against that?
<flux>
sure.. ?
<randomA>
is there a better way to test? In the past, I just spam assert_equal
<randomA>
and it feels really not elegant
<randomA>
not really not elegant, but just idk liek not thorough
<Algebr>
hannes: in principle, all the building blocks are there for openvpn?
<hannes>
Algebr: it is a simple matter of programming (reading the spec, thinking about flow control and reassembly, think a bit harder about potential resource problems)
<Algebr>
hannes: what potential resource problems? Why?
<hannes>
Algebr: well, you don't want another computer to be able to exhaust your memory or computing time
<Algebr>
ah, like a denial of service like attack
<hannes>
Algebr: I've no deep knowledge about openvpn, but if I'd implement it, I'd think hard about it (when to throw away half-opened/half-finished connections)
<flux>
openvpn has a way to detect invalid sessions rapidly with a shared key (that's not used for securing the session)
<randomA>
Hi
<flux>
but I suppose that happens even earlier. probably not too difficult to just tell the kernel some limit?
govg has joined #ocaml
<randomA>
If I have my shitty Map call MyMap and the actual Map, how do I compare the two for structural equality?
<randomA>
Like make sure that the same key value pairs exist in both Maps?
<MK__>
openvpn is mostly based on SSL/TLS and is not compatible with IKE
<MK__>
Hannes, Your SSL/TLS library should be usable to implement it
alfredo has joined #ocaml
alfredo has quit [Client Quit]
<hannes>
MK__: I do know. But I -- in contrast to other people -- think that IPSec solves the VPN problem at the right layer
<randomA>
is this in ocmal?
alfredo has joined #ocaml
<hannes>
randomA: MyMap.compare (fun a b -> a.foo = b.foo && ...) mapa mapb
<randomA>
so hannes i didnt create a compare function in MyMap
<randomA>
i created stuff like membr, find
<randomA>
*member, find
<hannes>
randomA: oh, then I do not understand. is MyMap an instance of Map? or a completely separate implementation?
<randomA>
it's seperate implementation
<randomA>
but i want to check it against the good Map
<randomA>
so I need a fucntion to check all the key value pairs in between operations
<randomA>
I have a to_list function in MyMap, and then I can use Map.bindings, then iterate through?
<hannes>
randomA: then you need to fold over the good Map, ensuring that for each key, value pair a corresponding key,value pair exists in your MyMap
<randomA>
hannes: so how would i do this?
<randomA>
just Map.iter
<hannes>
Map.fold (fun k v r -> if MyMap.member k mymap && compare_value (MyMap.find k mymap) v then r else None) map (Some ()) (or similar.. indicating that if the fold results in Some (), the maps are equal)
<randomA>
cool beans, thank you
slash^ has quit [Read error: Connection reset by peer]
<jstolarek>
Oasis seems like such a nice tool and yet it makes simple things very difficult :-/
<Drup>
most of things are really easy, until you try to do that specific thing that you wanted
<Drup>
anyway, gtg, TAing :>
<Drup>
try to rebase everyones branches for them, it'll make things easier
<Drup>
say hi to james and sam from me :p
<jstolarek>
Sure :-)
larhat has joined #ocaml
<jstolarek>
about rebasing: I'd do that hapilly but I feel there might be some resistance
nojb has joined #ocaml
<Algebr>
:( opam's make cold isn't getting correct MD5 hashes for dependencies
copy` has joined #ocaml
_andre has joined #ocaml
brunoro has joined #ocaml
rpip has joined #ocaml
larhat has quit [Ping timeout: 264 seconds]
fraggle_ has quit [Remote host closed the connection]
malina has quit [Remote host closed the connection]
<reynir>
make cold?
govg has quit [Ping timeout: 252 seconds]
brunoro has quit [Ping timeout: 264 seconds]
fraggle_ has joined #ocaml
larhat has joined #ocaml
<Algebr>
like when you don't have opam installed, I have a fresh install of debian and wanted make cold rather than install debian's version of ocaml/oopam
<Algebr>
opam
<companion_cube>
doesn't it ship with its dependencies anyway?
<companion_cube>
(maybe I remember wrong)
govg has joined #ocaml
<Algebr>
have to do make lib-ext for that
<Algebr>
but make cold is supposed to take care of everything
<companion_cube>
hmm, I must have typed `make lib-ext`
FreeBirdLjj has quit [Remote host closed the connection]
SimonJF has quit [Remote host closed the connection]
larhat has quit [Read error: Connection reset by peer]
randomA has quit [Quit: leaving]
larhat has joined #ocaml
ser_iously has joined #ocaml
brunoro has joined #ocaml
<orbitz>
Hello, is there any concise reading on the technique Jane St's polmorphic map/set use to add the comaprator as a type?
wxfdglm has quit [Ping timeout: 252 seconds]
<ser_iously>
hi, looking for info on the Containers lib. I'd like to know what's the difference between pp and print in various modules. Their type is a bit misleading as pp is of type 'a printer and print : 'a formatter. I get that one relies on Buffer.t and the other on Format.formatter but my question is rather about what is the expected use.
<companion_cube>
ser_iously: basically, the Buffer.t based interface is from a time when Format was slow
<companion_cube>
so it would often be faster to using Printf
<companion_cube>
(and bprintf is more general than sprintf and fprintf, as it allows to output to both strings and channels with reasonable perfs)
<ser_iously>
So waht would you advise nowadays? To only rely on print?
<companion_cube>
those days, though, I'd advise to use Format only
<companion_cube>
yes
brunoro has quit [Ping timeout: 244 seconds]
<companion_cube>
I'm even leaning towards using CCFormat (or Bunzli's Fmt) only, not the per-module printers, but that's really a detail
<ser_iously>
ok thanks. Is it meant to perform pretty-printing of basi printing? Said otherwise, what would you advise for someone needing to prettyprint huge for;ulas?
<companion_cube>
Format is good for printing huge formulas
<companion_cube>
(well, it's only a problem when the nesting is so wide, that indentation exceeds 80 columns; everything gets pressed on the right border)
<companion_cube>
(but I know nothing better in this case)
<ser_iously>
Until recently I relied on PPrint because of its nice combinators but I fear it's a bit slow
<companion_cube>
I use Format for printing large formulas and terms every day
<ser_iously>
ok so I guess I'll lean towards CCFormat, to avoid depending on another package (like Fmt)
<ser_iously>
Another question if you please: is there a blog post or something detailing the rationale for Containers. E.g. it seems you included in every module various interfaces for printing, monad or applicative, etc. Knowing this would allow to learn about the library quite fast I guess
<companion_cube>
not really, it's all in the readme, and there is no global guideline except my own taste
<companion_cube>
I use printing, applicative and monads quite regularly, hence they are present in some modules :)
<orbitz>
I wish tehre was a better library structure than that. Jane St does this too and it's really painful IMO
<companion_cube>
how do you mean?
<ser_iously>
include Print with type t = int ?
<ser_iously>
something like that ?
<companion_cube>
this works
<companion_cube>
it's just that in containers most modules have no deps besides the stdlib
<ser_iously>
if I look into CCInt.mli there is no such thing as what I wrote
<ser_iously>
not sure to undersatnd your answer
<companion_cube>
there is no include because it would add a dependency to the interface module
<ser_iously>
well a dependency w.r.t another signature provided by Containers... I don't see the harm
<companion_cube>
originally it was also designed so you could copy a module and avoid depending on containers itself :)
<ser_iously>
:)
<companion_cube>
and nowadays, well, it's just enforced by usual conventions
<orbitz>
companion_cube: I haven't looked at containers. but in Jane St they include all the things you can do with, String, for instance in the String module. So Map, Set, HashMap, blah blah. Which makes it feel really awkward if you want to do something new with a String, because all of a sudden all your callsites become inverted.
<ser_iously>
Right. You also have plenty of modules implementing map, filter_map, etc.
<orbitz>
Haven't looked at conatiners for this particular aspect*
<companion_cube>
orbitz: but it's an issue with OCaml, in this case
<companion_cube>
I mean, it boils down to the expression problem
<orbitz>
companion_cube: Sort of. It depends on if you need access to internals or not. In the cases I referenced with Jane St, all of those can liv ein another module
<companion_cube>
OO would also be problematic because you'd have to use a subclass
<companion_cube>
ah, right
<companion_cube>
in containers they live in another module, namely, CCString :p
tane has joined #ocaml
<orbitz>
companion_cube: does CCString have references to the Map and Set collections for String?
<ser_iously>
As you are here, I have yet another question regarding IteML. Aloctest seems to be trendy but I like
rgrinberg has joined #ocaml
<ser_iously>
sorry... is it possible to use a colorful print in Iteml
rgrinberg has quit [Client Quit]
rgrinberg has joined #ocaml
<companion_cube>
orbitz: no, I usually just CCMap.Make(String)
<companion_cube>
well, nothing in theory prevents it, but we did not write a colorful runner
<companion_cube>
I'm not working much on qtest those days, sadly :s
<orbitz>
companion_cube: nice. that is my preference :
<orbitz>
:)
<companion_cube>
(I think the proper way to go, anyway, would be to always use a OUnit runner; and write a colorful OUnit runner)
<companion_cube>
there is no reason OUnit can't be as pretty as alcotest, I think
<companion_cube>
(and it actually allows to swap runners)
govg has joined #ocaml
<ser_iously>
thanks a lot
govg has quit [Quit: leaving]
larhat has quit [Ping timeout: 265 seconds]
<companion_cube>
I have had a "todo" for months about having qtest output junit reports through OUnit
<companion_cube>
:(
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 252 seconds]
Mercuria1Alchemi has quit [Ping timeout: 244 seconds]
Mercuria1Alchemi has joined #ocaml
brunoro has joined #ocaml
brunoro has quit [Ping timeout: 244 seconds]
larhat has joined #ocaml
nomicflux has joined #ocaml
mr_foobar has joined #ocaml
ser_iously has quit [Quit: Page closed]
pierpa has joined #ocaml
zpe has quit [Remote host closed the connection]
sh0t has joined #ocaml
fraggle-boate has quit [Remote host closed the connection]
fraggle-boate has joined #ocaml
average has quit [Ping timeout: 244 seconds]
otobor has joined #ocaml
average has joined #ocaml
<otobor>
hi I'm looking for a project using Qtest/Iteml and setting it up through an _oasis file (Batteries has an _oasis file and uses qtest but the _oasis setup is essentially a facade for a good'ol Makefile). Any example?
<companion_cube>
(the nice thing with oasis is that it handles code generation properly, so yo ucan have a makefile that is partially generated)
<otobor>
thanks (right I get your point)
brunoro has joined #ocaml
brunoro has quit [Ping timeout: 272 seconds]
Algebr has quit [Ping timeout: 264 seconds]
al-damiri has joined #ocaml
mr_foobar has left #ocaml ["Leaving"]
freusque has quit [Quit: WeeChat 1.4]
<theblatte>
so I managed to link my .o file with my native code (ocamlbuild -lflags foo.o foo.o bar.native), but the same incantation doesn't work for bytecode: `ocamlbuild -lflags foo.o foo.o bar.byte` complains that it cannot find the symbol I define in foo.o
<theblatte>
whereas `ocamlbuild -lflags foo.o foo.o bar.native` compiles foo.c into foo.o and links it against bar without issue
<jstolarek>
I am generally used to the fact that things in Emacs don't work out of the box
<jmasseo_>
i used prelude to avoid painful setup processes in emacs
brunoro has quit [Ping timeout: 252 seconds]
<jmasseo_>
it mostly works?
<rightfold>
An OS where things don't work out of the box? Sounds like a nightmare
* rightfold
uses emacs on Gentoo :3
APNG has quit [Read error: Connection reset by peer]
Soni has joined #ocaml
rgrinberg has joined #ocaml
smondet has quit [Ping timeout: 244 seconds]
Soni is now known as APNG
brunoro has joined #ocaml
brunoro has quit [Ping timeout: 244 seconds]
<vapid>
In the delayed choice quantum eraser, an interference pattern will form on D0 even if which-path data pertinent to photons that form it are only erased later in time than the signal photons hit that primary detector.
Algebr has joined #ocaml
mrshark has joined #ocaml
smondet has joined #ocaml
mrshark has quit [Read error: Connection reset by peer]
mrshark has joined #ocaml
rgrinberg has quit [Read error: Connection reset by peer]
shinnya has joined #ocaml
averell has quit [Ping timeout: 248 seconds]
brunoro has joined #ocaml
averell has joined #ocaml
brunoro has quit [Ping timeout: 265 seconds]
rgrinberg has joined #ocaml
orbifx has joined #ocaml
dmbaturin has quit [Ping timeout: 250 seconds]
dmbaturin has joined #ocaml
Mercuria1Alchemi has quit [Ping timeout: 252 seconds]
<orbifx>
Quoi de neuf?
AlexRussia_ has quit [Ping timeout: 272 seconds]
octachron has joined #ocaml
sh0t has left #ocaml ["Leaving"]
sh0t has joined #ocaml
brunoro has joined #ocaml
<orbifx>
rgrinberg: is there a specific command for routing multiple paths to the same function?
AlexRussia_ has joined #ocaml
<rgrinberg>
orbifx: no. But it should be easily done with List.fold
<orbifx>
in opium's code or in user's code?
brunoro has quit [Ping timeout: 265 seconds]
fraggle_ has quit [Quit: -ENOBRAIN]
<rgrinberg>
user code
fraggle_ has joined #ocaml
<orbifx>
rgrinberg: ok. And is there a url_decoding function in opium? for params that are passed encoded?
<orbifx>
I'm going to see if adding a meta charset fixes that
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
<aantron>
orbifx: maurer: rgrinberg: in case you need html entity decoding, markup.ml has some API for this. though it may be overkill because it also handles named references, and the API that is currently exposed is not particularly efficient http://aantron.github.io/markup.ml/#VALxhtml_entity
<aantron>
if this is what you need though and cant find some other solution, ping me and i can make a proper API (the linked function is only meant to be passed as an argument to another function in markup.ml)
<orbifx>
aantron: thanks
<aantron>
(by named references i mean the several hundred entity references such as &, etc)
<orbifx>
Do you know if the <form> element can be made to submit un-encoded utf-8?
<aantron>
iirc this API only handles named entity references. so i guess the function that handles everything (including numbers) is not exposed at all, though it exists in the library. again, ping if needed
eh_eff_ has joined #ocaml
<orbifx>
I think accepted charset solved the issue
nomicflux has joined #ocaml
<orbifx>
rgrinberg: probably last question of the day :) -- does opium do anything with the HTTP headers related to the language?
<rgrinberg>
orbifx: i don't think so. opium is agnostic to that
<orbifx>
Accept-Encoding
<orbifx>
gzip, deflate
<orbifx>
Accept-Language
<orbifx>
en,en-US;q=0.5
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 248 seconds]
brunoro has joined #ocaml
brunoro has quit [Ping timeout: 272 seconds]
Heasummn has joined #ocaml
copy` has quit [Quit: Connection closed for inactivity]
mrshark has quit [Ping timeout: 264 seconds]
mrshark has joined #ocaml
zv has quit [Quit: WeeChat 1.5]
yomimono has quit [Ping timeout: 272 seconds]
smondet has quit [Ping timeout: 248 seconds]
yomimono has joined #ocaml
<orbifx>
thanks for all rgrinberg
<orbifx>
laters all
kamog` has joined #ocaml
kamog has quit [Ping timeout: 264 seconds]
yomimono has quit [Ping timeout: 264 seconds]
orbifx has quit [Ping timeout: 264 seconds]
nomicflux has quit [Quit: nomicflux]
brunoro has joined #ocaml
brunoro has quit [Ping timeout: 252 seconds]
smondet has joined #ocaml
al-damiri has quit [Quit: Connection closed for inactivity]