<chouser>
so confused. Ok, so I tried just "OT.t" instead of "t OT.t", and now it's complaining about line 18 again. I don't know if that means I fixed that problem, or make something else worse.
rwmjones has joined #ocaml
cartwright has joined #ocaml
<Drup>
"MalType" is a functor, not a module type, you can't use it like that
<Drup>
you need to define a module type that correspond to the result of the application of the MalType functor
ente has joined #ocaml
ente has quit [Changing host]
ente has joined #ocaml
<chouser>
ok, I think I understand, thanks.
dbp has joined #ocaml
rfv has quit [Ping timeout: 245 seconds]
msch has quit [Read error: Connection reset by peer]
cojy_ has quit [Ping timeout: 276 seconds]
Averell has quit [Ping timeout: 250 seconds]
msch has joined #ocaml
Averell has joined #ocaml
Tekk_` is now known as Tekk_
cojy_ has joined #ocaml
rfv has joined #ocaml
uberboy has joined #ocaml
enitiz has joined #ocaml
oriba_ has quit [Quit: Verlassend]
uberboy has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
chouser has quit [Ping timeout: 245 seconds]
jneen has joined #ocaml
pdewacht_ has joined #ocaml
maurer has joined #ocaml
rks` has joined #ocaml
jonludla` has joined #ocaml
<sdegutis_>
chouser was here?
<sdegutis_>
ha
j0sh_ has joined #ocaml
keen__________41 has quit [Ping timeout: 415 seconds]
moviuro has quit [Ping timeout: 415 seconds]
adrien has quit [Read error: Connection reset by peer]
maurer_ has quit [Ping timeout: 628 seconds]
jneen_ has quit [Ping timeout: 628 seconds]
rks`_ has quit [Ping timeout: 628 seconds]
jonludlam has quit [Ping timeout: 628 seconds]
pdewacht has quit [Ping timeout: 628 seconds]
moviuro has joined #ocaml
j0sh has quit [Ping timeout: 628 seconds]
keen__________41 has joined #ocaml
chouser has joined #ocaml
adrien has joined #ocaml
antkong has joined #ocaml
Averell has quit [Changing host]
Averell has joined #ocaml
q66 has quit [Quit: Leaving]
lambdahands has joined #ocaml
antkong has quit [Ping timeout: 245 seconds]
psy_ has quit [Read error: No route to host]
psy has joined #ocaml
lambdahands has quit [Ping timeout: 276 seconds]
sdegutis_ has quit [Quit: Leaving...]
AlexRussia has quit [Ping timeout: 272 seconds]
AlexRussia has joined #ocaml
ontologiae has joined #ocaml
badkins has quit []
<chouser>
Ok, really close now. Drup, you're help has been very valuable.
<chouser>
Now I need to figure out how to refer to the variant types, if that's what they're called.
<chouser>
I thought that since MalVal was no longer abstract, its constructors would be available.
jao has quit [Ping timeout: 246 seconds]
<Drup>
so, the issue here is that you made the construct back abstract when constraining the type of MalVal to Map.OrderedType
<Drup>
because, in Map.OrderedType, the type t is abstract
<Drup>
you need to give another module type where the type t is not abstract
<chouser>
So MalVal does satisfy OrderedType, which is why that part is not an error. But OrderedType is too general (t is abstract) so I lost there the specific type of t that is actually defined in MakeVal. Is that right?
BitPuffin has quit [Ping timeout: 264 seconds]
<Drup>
yes
<chouser>
whew. Ok, so I can't cheat and use Map.OrderedType. I need my own sig that is very similar, but has all those variant constructors in it.
<chouser>
...in order to make t be the right concrete type.
<chouser>
But the types of the variant constructors are based on with_meta which is based on the module parameter. I don't see how this can possibly be described in a concrete sig.
<chouser>
Ah, I can just say "type 'a with_meta" and not say *what* with_meta really is. That gets me most of the way.
<chouser>
aaand by pulling the other reference to MapType.t on line 8 out into another type alias, I've got it working.
<Tekk_>
I never would've looked for it under that name
<Tekk_>
(and didn't)
<blech__>
it's pretty common
<blech__>
List.mem is the same
MercurialAlchemi has quit [Ping timeout: 272 seconds]
<blech__>
(mem)bership
<Tekk_>
mhm
ousado_ has quit [Ping timeout: 246 seconds]
elfring has joined #ocaml
alpen has quit [Remote host closed the connection]
antkong has joined #ocaml
chinglish has joined #ocaml
reem has joined #ocaml
reem has quit [Remote host closed the connection]
reem has joined #ocaml
<flux>
tekk_, btw, the reason why your function dosen't work is that you are first cathing Not_found, if risen, and then some other exception
reem has quit [Remote host closed the connection]
<flux>
but in other cases you just erturn what Hashtbl.find returns
reem has joined #ocaml
<flux>
so you should write it like: try ignore (Hastbl.find htbl key); true with Not_found -> false
<ggole>
Hashtbl.mem does that...
<flux>
because you actually don't care about the return value; if it returns at all, you return 'true'
<flux>
ggole, I realize that but wouldn't it be great for one to understand why the posted code doesn't work?-)
<Tekk_>
mhm
<Tekk_>
thanks flux
<Tekk_>
right now I've moved onto a module scoping mystery..
<ggole>
Oh, OK
<flux>
there is actually a new syntax I would rather use in similar case: match Hashtbl.find htbl key with exception Not_found -> false | _ -> true
reem has quit [Ping timeout: 256 seconds]
<Tekk_>
found my issue, just need to fix it..
<Tekk_>
So why is it that a function isn't allowed to access the members of a struct defined in a module when that struct isn't explicitly declared in the function declaration? like module Test = struct type t = {x:int} end;; let func thing = Printf.printf "%d\n" thing.x
<Tekk_>
it says that there's no such struct member x
<Tekk_>
record, sorry :)
* Tekk_
has been jumping between C and ocaml today
<Tekk_>
where if you declare it with let func : Test.t -> unit = func thing -> Printf.printf "%d\n" thing.x it lets you go with a warning
<Tekk_>
I would've figured that as long as the type and its contents are present in the module signature it'd be fair game
<Tekk_>
but the signature thing doesn't seem to help if you declare it as part of the signature as a model
Hannibal_Smith has joined #ocaml
<flux>
tekk_, you need to use thing.Test.x
<Tekk_>
huh
<flux>
or the way you noticed
<flux>
you can also use: let func (thing : Test.t) = ..
<Tekk_>
why is that?
<flux>
the thing is, you could easily have a local record with field x
<Tekk_>
I'd kinda noticed it earlier in having to declare it as {Test.x=} in other stuff
<Tekk_>
mhm
<flux>
but ocaml needs to know which record type you are accesing
<Tekk_>
but why doesn't it know that from the type of thing?
<Tekk_>
if I declared it in the sig
<Tekk_>
that was the thing that really tripped me up
<flux>
well, it's in another module
<flux>
let's say I have code: module A = struct type t = { x : int } end module B = struct type t = { x : string} end let get_x t = t.x
<flux>
what is the type of argument 't' for get_x?
<flux>
so you need to use some way to disambiguate. let get_x (t : A.t) = t, or let get_x x = t.A.x, or let get_x x = let open A in x, or let get_x x = A.(x), or let get_x : B.t -> _ = fun t -> t.x
<flux>
(the second way (t.A.x) is the oldest way ocaml has supported)
<flux>
you can just disable the warning 40 if you want to use the way #1 or #5 :)
<Tekk_>
flux: sorry, was working on getting this to work
<Tekk_>
I completely understand it in the case of declaring it outside of the modules and without a type annotation
<Tekk_>
but why doesn't the type annotation in the module signature do? Like putting get_x in module B with a signature declaring it as A.t -> int
<flux>
tekk_, ah, I didn't realize that you referred to that. I think it's because the implementation is only checked to match the interface afterwards.
tanguy` has joined #ocaml
<flux>
perhaps this behavior could be changed in the future, and perhaps it should be.
<flux>
the whole t.x (without needing t.A.x or scoping tricks) is relatively new feature altogether in OCaml
Simn has joined #ocaml
demonimin has quit [Remote host closed the connection]
Haudegen has quit [Ping timeout: 246 seconds]
<Tekk_>
one more thing before I finally sleep. not a big one
<Tekk_>
is it possible to have a variant type which means "any of the other variants"?
<Tekk_>
or or them together
<Tekk_>
actually that may be it..
* Tekk_
tests
Haudegen has joined #ocaml
<ggole>
With polymorphic variants, yes
antkong has quit [Ping timeout: 244 seconds]
<Tekk_>
hm
<Tekk_>
not seeing how it fits in my particular case
<Tekk_>
I'll try to explain and then if not try again in the morning, given that it's 5:30
<Tekk_>
so I'm doing an sdl binding, and for a higher level thing I have event bindings on keys. You register for a key+modkey and your function is called whenever that happens. modkey is a variant with things like Ctrl | Alt | Shift, etc.
<Tekk_>
it'd be nice to define an Any modkey, so that no matter what modkeys (if any) are pressed when the key is pressed, you get called
<Tekk_>
would that be like..
<Tekk_>
`ModAny of modkey ?
<Tekk_>
assuming that modkey is the variant name
nopenope has joined #ocaml
<Tekk_>
hm, no
<ggole>
You can match any constructor easily enough
<ggole>
But there's no way to make a named abstraction over constructors yet
<Tekk_>
alright, and that's what I was looking for
<ggole>
An alternative is to define, say, a record { modifier : modifier; any_mod : bool; } which explicitly stores what you want
<Tekk_>
still a bit hairy since it's being used as a key for a hash
<ggole>
It should be fine for that.
<Tekk_>
but I could define my own hash and then use a custom compare for it I suppose
<Tekk_>
would it?
<ggole>
Yep.
<Tekk_>
how does that work? O.o
<ggole>
Hash tables work using structural hash and comparison by default
<Tekk_>
exactly
<ggole>
eg, look at all the parts
nopenope has left #ocaml ["Konversation terminated!"]
<Tekk_>
so if I put in a modifier: ModNone and any_mod: true
<Tekk_>
and I receive modifier: ModShift and anymod: true
<Tekk_>
it'll still compare wrong
<ggole>
That would be a badly formed value
<ggole>
Yeah, gotta avoid those.
<Tekk_>
how so to the badly formed?
<Tekk_>
the entire point of the Any modifier is that it's considered to be true whether it's ModNone, ModShift, ModCtrl, etc.
<ggole>
Er?
<ggole>
I must have misunderstood.
<Tekk_>
ah, okay
<ggole>
I thought you wanted a bit of information that indicated that one of the modifiers was on (don't care which one)
<Tekk_>
oh no
<Tekk_>
I want to indicate that I don't care what modifier it is :)
<Tekk_>
or if there's none
<ggole>
I'd just make a case for that then
<Tekk_>
which would be writing my own compare: if event.scancode = table.scancode then (if table.modifier = Any then true else table.modifier = event.modifier) else false
<Tekk_>
approximately
<Tekk_>
like I said, not a big deal, just something else to add to the list if I think it's worth it
<ggole>
Right.
<Tekk_>
and now I should probably sleep since it's nearly 6 am
<AeroNotix>
I can't seem to see anything related to dllunix in the OCaml libs, so I assume I need to install some library or whatnot.
skinkitten has joined #ocaml
uberboy has joined #ocaml
Thooms has quit [Ping timeout: 265 seconds]
tane has quit [Quit: Verlassend]
ousado_ has joined #ocaml
ousado_ is now known as ousado
ousado has quit [Changing host]
ousado has joined #ocaml
justinfront has quit [Ping timeout: 276 seconds]
justinfront has joined #ocaml
ingsoc has joined #ocaml
tanguy` has quit [Ping timeout: 265 seconds]
darkf_ has joined #ocaml
darkf has quit [Ping timeout: 245 seconds]
antegallya has joined #ocaml
rand000 has joined #ocaml
ebzzry has joined #ocaml
mearnsh has quit [Ping timeout: 272 seconds]
mearnsh has joined #ocaml
justinfront has quit [Ping timeout: 265 seconds]
ingsoc has quit [Quit: Leaving.]
justinfront has joined #ocaml
aluuu has quit [Ping timeout: 264 seconds]
<MercurialAlchemi>
AeroNotix: at a guess, the ocamljava version you got requires a version of ocaml more recent than the one you have installed
<MercurialAlchemi>
AeroNotix: you'd probably run into less trouble with opam
raphaelss has joined #ocaml
BitPuffin has joined #ocaml
Rebelion has joined #ocaml
raphaelss has left #ocaml [#ocaml]
chris2 has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 246 seconds]
justinfront has quit [Ping timeout: 264 seconds]
ontologiae has joined #ocaml
enitiz has joined #ocaml
skinkitten has quit [Ping timeout: 245 seconds]
justinfront has joined #ocaml
enitiz has quit [Ping timeout: 244 seconds]
skinkitten has joined #ocaml
enitiz has joined #ocaml
q66 has joined #ocaml
antegallya1 has joined #ocaml
antegallya has quit [Read error: Connection reset by peer]
enitiz has quit [Ping timeout: 276 seconds]
struktured has quit [Ping timeout: 245 seconds]
mobajm_ has joined #ocaml
<pippijn>
has anybody tried running ocaml on low memory platforms, before?
<pippijn>
as in, 2mb
<adrien_znc>
for the whole system or?
<adrien_znc>
is there a kernel or is this bare metal?
<pippijn>
2mb free memory
mobajm has quit [Ping timeout: 264 seconds]
<pippijn>
there is a linux kernel and OS
<adrien_znc>
sounds doable if you tweak the GC settings
chouser has joined #ocaml
<pippijn>
okay
struktured has joined #ocaml
Thooms has joined #ocaml
tanguy` has joined #ocaml
<pippijn>
https://paste.xinu.at/beDF/ <- these are my build rules for ocaml compilation (no linking, no C code, etc.)
<chinglish>
!doge
<pippijn>
any general advice on the ocaml code itself? do I have unnecessary complexity?
Kakadu has joined #ocaml
zwer_w is now known as zwer
<struktured>
looking for a small stats library to do things like sample from a gaussian distribution. ideally it's alread yin opam and is not a binding. any recommendations?
Hannibal_Smith has quit [Quit: Leaving]
justinfront has quit [Ping timeout: 276 seconds]
justinfront has joined #ocaml
slash^ has quit [Read error: Connection reset by peer]
slash^ has joined #ocaml
ingsoc has joined #ocaml
darkf_ has quit [Ping timeout: 245 seconds]
aluuu has joined #ocaml
thomasga has joined #ocaml
IbnFirnas has quit [Read error: Connection reset by peer]
ggherdov has quit [Ping timeout: 272 seconds]
justinfront has quit [Ping timeout: 246 seconds]
tane has joined #ocaml
tnguyen1 has joined #ocaml
tnguyen has quit [Ping timeout: 246 seconds]
struktured has quit [Ping timeout: 256 seconds]
ggherdov has joined #ocaml
MercurialAlchemi has joined #ocaml
thomasga has quit [Quit: Leaving.]
thomasga has joined #ocaml
IbnFirnas has joined #ocaml
terry852 has quit [Ping timeout: 240 seconds]
struktured has joined #ocaml
smtb has joined #ocaml
<smtb>
Does anybody use ltrace?
<whitequark>
I've used ltrace a few times
<smtb>
Does anybody use #trace?
<ggole>
Occasionally
<smtb>
Basically I have a thread that gets hung up on some with an error that I have too many fds open. I was told to use ltrace but im not sure how to use it.
<smtb>
Sorry meant to ask does it work similarly to #trace.
<ggole>
You mean strace, or ltrace?
<smtb>
ltrace.
<adrien_znc>
strace sounds better
<smtb>
How does strace work? I have only used #trace in the toplevel.
<adrien_znc>
but you don't get a backtrace
<adrien_znc>
ah
<adrien_znc>
#trace and strace and ltrace are _very_ different
<adrien_znc>
are you always working on the toplevel?
<ggole>
Because strace -e trace=desc is probably roughly what you want
<smtb>
I would like to debug in the toplevel if possible but it is not necessary.
<smtb>
I really just need to find where I am leaking fds.
<adrien_znc>
which is roughly the same as ggole's trace=desc
<adrien_znc>
basically it will show you each open() syscall performed
<ggole>
If you are working with the unix module and suspect that is the source of the leak, #trace Unix.openfile #trace Unix.close *might* be helpful
<ggole>
But there are other ways than that of opening an fd
<adrien_znc>
you can you can run that to get an idea of how this works: LANG=C strace -f -e trace=open cat /dev/null
<smtb>
ok thanks, I will try this
chinglish has quit [Quit: Nettalk6 - www.ntalk.de]
rock_neurotiko has joined #ocaml
fds_ is now known as fds
rock_neurotiko has quit [Remote host closed the connection]
<smtb>
So I see a bunch of opens but no closes. Should I see closes?
<adrien_znc>
no
<adrien_znc>
try
<adrien_znc>
-e trace=open,close
<adrien_znc>
smtb: ^
<adrien_znc>
open() returns a file descriptor which is an int and that's what is passed to close()
yaewa has joined #ocaml
<smtb>
Is the best way to proceed to allow the process to get to the point where it hangs?
<ggole>
If you see many opens without closes, you are seeing your leak
chris2 has quit [Quit: trotz alledem!]
<adrien_znc>
smtb: yes
chris2 has joined #ocaml
moei has quit [Ping timeout: 276 seconds]
enitiz has joined #ocaml
Tekk_` has joined #ocaml
mobajm__ has joined #ocaml
frankjeager has joined #ocaml
SuperNoeMan_ has joined #ocaml
j0sh has joined #ocaml
ggole_ has joined #ocaml
ousado_ has joined #ocaml
rks`_ has joined #ocaml
natrium1970 has joined #ocaml
stux has joined #ocaml
hsuh_ has joined #ocaml
mobajm_ has quit [Ping timeout: 240 seconds]
ousado has quit [Ping timeout: 240 seconds]
Tekk_ has quit [Ping timeout: 240 seconds]
ggole has quit [*.net *.split]
j0sh_ has quit [*.net *.split]
rks` has quit [*.net *.split]
SuperNoeMan has quit [*.net *.split]
stux|away has quit [*.net *.split]
frankjea1er has quit [*.net *.split]
hsuh has quit [*.net *.split]
so has quit [*.net *.split]
SuperNoeMan_ is now known as SuperNoeMan
<natrium1970>
I’m having problems with a bit of code. http://pastebin.com/KDMzAaM9 When I try to compile it, I get the error: “This expression has type int but an expression was expected of type IntToken.t”
<natrium1970>
I’ve read about similar issues, but I can’t figure out this case.
divyanshu has quit [Read error: Connection reset by peer]
msch has quit [Read error: Connection reset by peer]
rfv has quit [Ping timeout: 265 seconds]
cojy_ has quit [Ping timeout: 272 seconds]
<adrien_znc>
natrium1970: you need to show the code and tell which libraries are being used
<natrium1970>
I did.
<natrium1970>
Plain old stdlib.
psy has quit [Read error: Connection reset by peer]
<struktured>
natrium1970: you are masking the type of int for no reason basically. The module functor will do that for you, if you have it adhere to some signature of your choice
vanila has quit [Remote host closed the connection]
<natrium1970>
How am I masking the type? I’m sorry if I seem stupid, but I really don’t understand this.
rfv has joined #ocaml
divyanshu has joined #ocaml
<struktured>
natrium1970: the TOKEN sig makes the type t opaque
<struktured>
natrium1970: you could also do something like : " module IntToken : TOKEN with type t = int = struct ... end "
<natrium1970>
Some of these books seem to say that I should make everything possible opaque.
<struktured>
natrium1970: there's truth to that, but it's also common to expose the type somewhat using the "with type t = ... " or " with module Foo = ", etc.
n1ftyn8 has joined #ocaml
<natrium1970>
I kept seeing “with type…” and “with module…” but it’s kind of overwhelming, and every book seems to show things a little differently.
<natrium1970>
Thank you.
msch has joined #ocaml
psy has joined #ocaml
cojy_ has joined #ocaml
<struktured>
natrium1970: yeah it took me a while to get it all, especially functors and whatnot. good luck.
<natrium1970>
I can deal with modules that don’t interact with other in subtle ways.
aluuu has quit [Ping timeout: 272 seconds]
<AeroNotix>
MercurialAlchemi: well I have ocaml 4.02
<companion_cube>
in ocamlbuild, anyone knows how to force 2 libraries to be linked in a given order?
<AeroNotix>
MercurialAlchemi: I got that bit working, turned out I needed to properly set the ocaml load path
<AeroNotix>
now I have a diff problem
<companion_cube>
(because one depends on the other but ocamlbuild doesn't seem to notice)
natrium1970 has quit [Quit: natrium1970]
aluuu has joined #ocaml
<struktured>
companion_cube: curious, is it because one of the libraries in question have bugs in their package descriptions?
<companion_cube>
they are libraries that belong to the same project and have just been built :/
<companion_cube>
so they don't have a META yet
<struktured>
companion_cube: that setup typically works with oasis right? with pure ocamlbuild you're having a problem..or?
<companion_cube>
my problem is with oasis :(
<struktured>
companion_cube: so oasis is broken in your case? because I have multilib projects that work fine and I know you do too.
lambdahands has joined #ocaml
<companion_cube>
it links everything it should, just not in the right order
Hannibal_Smith has joined #ocaml
<companion_cube>
no idea on how to force ocamlbuild to change order?
<struktured>
companion_cube: ah yeah. hmm. reminds me of how I'd like oasis to make ppx_import go before ppx_* anything else, just by my declared ordered in the oasis file
<companion_cube>
:/
<struktured>
companion_cube: no I can't do it, but I think its doable in a _tags file
<chouser>
Hi, I'm still trying to build a variant type that can be map whose keys and vals are of that same variant type. I think I may have the type right now, but I don't know how to use it: https://gist.github.com/Chouser/15bb2a380520c6b46fc7
natrium1970 has joined #ocaml
<chouser>
Or maybe the fact that I can't construct one means my type is broken? Do I need a completely different approach?
<struktured>
companion_cube: whitequark showed me some trick to do that with ppx_import, but I didn't really understand it
<companion_cube>
can you show me? your _tags file e.g.
<struktured>
companion_cube: one sec I can gig up his example I think
<struktured>
companion_cube: *dig
<chouser>
Also, I'm completely new at this, so if my terminology or names are incorrect, please correct me. I'm trying to learn!
shinnya has quit [Ping timeout: 272 seconds]
<companion_cube>
aww, recursive modules
<companion_cube>
struktured: I can show you the code that fails, if you want
yaewa has quit [Quit: Leaving...]
martintrojer has quit [Ping timeout: 255 seconds]
moei has joined #ocaml
<struktured>
companion_cube: aww so your module graph was recursive by accident or w/o using module rec keyword?
<companion_cube>
no, it's chouser's problem
<chouser>
companion_cube: yeah, I was all "I'm gettin' the hang of this map functor", but ... um, no.
<struktured>
companion_cube: oh
<companion_cube>
chouser: does your current stuff compile?
<chouser>
that code I posted does not pass the type-check
<companion_cube>
I think it might be because you don't have constraints in your recursive modules' signatures
<chouser>
The recursive modules compile, but I can't figure out the right types to actually add values to the map.
<companion_cube>
you probably want and OrderedValMap : Map.S with type key = OrderedVal.t = ...
<chouser>
companion_cube: whoa, new syntax. Didn't know about "<module> with type ..." I'll try it!
<companion_cube>
it's <module type>
martintrojer has joined #ocaml
<companion_cube>
struktured: well, I can try...
pyon has quit [Read error: Connection reset by peer]
<struktured>
companion_cube: my problem is I don't understand how people maintain a manually edited _tags file. I guess like everything else. you commit derived. bleh
<companion_cube>
you mean, with oasis ?
<companion_cube>
you have several options, including : having (* oasis start *) (* oasis stop *) your content here
<companion_cube>
well, it strangely doesnt work with use_foo, but it works with pkg_foo
<companion_cube>
so I'll need to install the package before running tests...
<struktured>
companion_cube: oh thanks for that tip! and thats not great but better than nothing I guess
<companion_cube>
it also works for META, and so on
<companion_cube>
and myocamlbuild.Ml
<struktured>
thats not suprising, as it can do dep management
<whitequark>
how do ocaml objects look inside?
<whitequark>
in-memory representation
<companion_cube>
you mean proper objects? I think they have a vtable, methods are accessed by the hash of their name
<whitequark>
why do they include a reference to debug info, or something?
antegallya1 has quit [Ping timeout: 276 seconds]
<companion_cube>
I don't know much, the OO module might give you more insights
<thomasga>
any idea why I could get "xxx unbound at toplevel" in the toplevel? (after I install some printers)
<thomasga>
(after doing 'let xxx = adas')
<companion_cube>
is xxx a module name?
ingsoc has quit [Ping timeout: 264 seconds]
<thomasga>
# let f () = Git_unix.FS.create () >>= fun x -> Git_unix.FS.references x ;;
<thomasga>
>> Fatal error: f unbound at toplevel
<thomasga>
well actually it's even simpler
<thomasga>
#require "git.top" ;;; let x = 3;; gives the same result
<thomasga>
I guess I'm doing something dumb when registering the printers
<whitequark>
this raises Invalid_argument since 4.00.1
<whitequark>
shouldn't it work?
<companion_cube>
I really have no idea
<companion_cube>
why do you need marshal when you have good serializers?
natrium1970 has quit [Quit: natrium1970]
<whitequark>
something in the testsuite fails and i need to fix it
<companion_cube>
:(
mcclurmc_ has joined #ocaml
mcclurmc has quit [Ping timeout: 272 seconds]
so has joined #ocaml
lu324_ has quit [Remote host closed the connection]
justinfront has joined #ocaml
lu324_ has joined #ocaml
tanguy` has quit [Ping timeout: 256 seconds]
aluuu has quit [Ping timeout: 244 seconds]
pyon has joined #ocaml
<whitequark>
lol
<whitequark>
toplevel can't marshal closures for a decade
aluuu has joined #ocaml
cdidd has quit [Ping timeout: 272 seconds]
mobajm__ has quit [Remote host closed the connection]
tanguy` has joined #ocaml
swgillespie has joined #ocaml
justinfront has quit [Ping timeout: 245 seconds]
swgillespie has quit [Client Quit]
Haudegen has quit [Ping timeout: 256 seconds]
mobajm has joined #ocaml
Haudegen has joined #ocaml
sdegutis has joined #ocaml
<sdegutis>
Since OCaml's |> is basically Clojure's ->> does OCaml have Clojure's -> ?
<sdegutis>
chouser: oh hi there
<sdegutis>
chouser: didn't realize you were into static typing
vanila has joined #ocaml
<Drup>
sdegutis: what does "->" do ? :)
jcloud has joined #ocaml
<sdegutis>
Drup: it does partial application of the thing on the left to the function on the right, making it the first argument
<sdegutis>
Drup: it's just like |> except instead of making it the last argument, it makes it the first
<Drup>
can you give it a type ?
<whitequark>
isn't that · ?
<Drup>
there is @@, which is defined as [f @@ x ≡ f x]
<sdegutis>
In Clojure, (->> foo (bar quux)) is the same as (bar quux foo) which thus mirrors OCaml's |> operator.
<sdegutis>
In Clojure, (-> foo (bar quux)) is the same as (bar foo quux) which is what I'm looking for in OCaml.
<Drup>
yeah
<Drup>
that's not really typable.
dsheets has joined #ocaml
<sdegutis>
Oh well. Not a huge deal.
<sdegutis>
fun is a fine solution.
<Drup>
at least not in OCaml's type system
<sdegutis>
What does "struct" mean/do in module M = struct let foo = 3 end;; ?
arboris has joined #ocaml
<Drup>
you could maybe imagine typing that with some variadic magic
<Drup>
but variadic magic is almost always a bad solution
<sdegutis>
(I'm on Chapter 4 of Real World OCaml and OCaml is awesome so far, but I really don't see myself using Core.)
<Drup>
sdegutis: it's just the delimiters for a module
<Drup>
struct ... end
<sdegutis>
Okay.
<sdegutis>
Drup: are you long learning OCaml, or new with it?
<rks`_>
he's an OCaml expert.
<chouser>
I believe that last night I found an answer to an OCaml question from Drup in 2011
<sdegutis>
Ah.
<sdegutis>
chouser: so you're not into Clojure anymore?
<Drup>
rks`_: I think I would take the comment as a nice compliment from anyone but you =')
<chouser>
sdegutis: no no, totally into Clojure. Just trying to learn some OCaml.
<sdegutis>
I think Clojure is a neat experiment, in the sense that you can add "language features" with macros. But other than that I prefer static typing and all the benefits of a well-integrated static-type-supporting compiler.
<rks`_>
Drup: :D
<whitequark>
Drup: why?
<sdegutis>
Plus it's *really* frustrating that I have to write unit tests in CLojure to get the rough-equivalent of OCaml's sum types.
<Drup>
whitequark: rks`_ restrains himself on this channel, you don't know him ^^'
dsheets has quit [Read error: Connection reset by peer]
justinfront has joined #ocaml
<rks`_>
alright
<rks`_>
well, you're right, it wasn't as much of a compliment as it is a joke about the "long learning"
<rks`_>
but still
hellofunk has joined #ocaml
<Drup>
(plus, I don't really consider myself an expert)
<sdegutis>
The chapter on modules is kind of glossing over the various syntaxes of 'module'
<Drup>
sdegutis: you can use "lazy" (or suspend the evaluation with a function) to achieve the same behavior
<sdegutis>
Drup: meh im ok with that
<sdegutis>
i never need that
<sdegutis>
So the RWO book often says "Consider the following simple" [setup for some explanation]. And it's usually *not* simple.
<sdegutis>
I'd like to not have to learn new algorithms *while* learning a new language.
BitPuffin has quit [Quit: See you on the dark side of the moon!]
Tekk_` is now known as Tekk_
tane has quit [Ping timeout: 264 seconds]
BitPuffin has joined #ocaml
<dch>
I’m usually a FreeBSD user, and finding getting ocaml + core_extended etc set up on 10.1 *extremely* painful. RWO implies that FreeBSD is a supported platform, but I am having my doubts for at least the modules used in the book.
<dch>
re2, core_extended, bin_prot, all don’t work atm. I’ve found hacks or work-arounds for re2 + bin_prot, but core_extended looks like its a bit much for me personally to deal with.
<dch>
Is this normal for ocaml packages in general on *BSD or is this just something specific to janestreet libraries, that they are assuming gcc and linux?
<dch>
finally, I can see that the myocamlbuild.ml and makefiles for each package are wildly different. Where would be the best place to raise this point and ask if there’s a widely respected standard to refer to for these 2 build system components?
manu3000 has joined #ocaml
<dch>
I’m very new to ocaml so its pretty difficult to try and understand what’s actually broken in each one.
<Drup>
dch: just ask the on the mailing list
ousado_ is now known as ousado
ousado has quit [Changing host]
ousado has joined #ocaml
<Drup>
all these projects are part of core anyway, so you could bug report on core itself.
<Drup>
avsm/anil uses freeBSD on a regular basis, he should be quite aware of any issues
<dch>
caml-list@inria.fr ?
<Drup>
yes
slash^ has quit [Read error: Connection reset by peer]
<dch>
Drup: thanks, I will do. I have reported bugs since October or earlier last year and there’s little practical movement. Maybe a wee bump will help.
<dch>
perhaps I can contribute to some CI work in this area.
<chouser>
The type of example_map_val and the error on example_map suggest to me that I don't quite yet have the same type for both the key and value of my map type.
<chouser>
BTW, I'm finding "ocamlc -i" very helpful. Props to whoever added that tool.
tani is now known as tane
Thooms has quit [Ping timeout: 265 seconds]
ingsoc has joined #ocaml
<flux>
chouser, btw, do you use vim/emacs? if so, you have access to an even more mindblowing tool, namely retrieving compiler-inferred types..
<Drup>
I'm annoyed by the need to give the type t twice
<Drup>
wonder how we could get around that
justinfront has joined #ocaml
ivan\ has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
ivan\ has joined #ocaml
oriba has joined #ocaml
malc_ has joined #ocaml
Kakadu has quit [Remote host closed the connection]
psy has quit [Read error: Connection reset by peer]
<adrien>
gasche: RE PR 5887 and name clashes in headers
<ingsoc>
does anyone on here use ocalide
<adrien>
it makes no sense to add that to 4.02.x imho; it's a major change that also requires packaging changes at least
<sdegutis>
Given module Person = struct type t = { name: string; } end, how is it that I can write Person.name instead of having need to type person.t.name?
<ingsoc>
anyone ?
<ingsoc>
I have no clue how to set a project up and don't know if i am configuring it to use opam installation
<sdegutis>
What am I doing wrong here? module Person = struct type t = { name: string; } end let x = { name = "foo" }
<sdegutis>
This says unbound record field name.
<sdegutis>
haaaaaalp
pdewacht has joined #ocaml
<vanila>
name is right there though
milosn has joined #ocaml
<mfp>
sdegutis: open Person or { Person.name = "foo" }
ThePawnBreak has joined #ocaml
<sdegutis>
Thanks mfp; that works;;
<sdegutis>
And now I can do x.Person.name which is kind of strange that I can't just do x.name tbh.
<ingsoc>
ok, i am getting somewhere now. had to modify all paths from /usr/bin/ocaml etc. to ~/.opam/<version>/ etc.
<ingsoc>
still having problems finding Core libs though
<mfp>
ingsoc: are you doing eval `opam config env` ? This should update the PATH and stuff
<mfp>
and ocamlc ocamlopt ocamlfind and so on would pick the ones in .opam/... according to the currently selected env (opam switch)
<sdegutis>
Is there a built-in alternative to Core's fieldslib syntax extension?
<sdegutis>
I like the concept of this, but I would love to not have to pull in any third party library to get it.
elfring has quit [Quit: Konversation terminated!]
<Drup>
no
<sdegutis>
oh well
<Drup>
(except defining everything your self, of course)
<sdegutis>
Onto chapter 6: variants
<Drup>
you will quickly understand that, in the ocaml ecosystem, having small dependencies is perfectly fine and you should restrict yourself to the built-in capabilities.
<sdegutis>
Drup: does that mean it's common to roll your own helper functions/etc when you need that functionality, instead of pulling in a third party library?
<Drup>
you should NOT
<Drup>
typo.
<Drup>
lot's of people do that though, and keep redefining an stdlib
<sdegutis>
oh
<sdegutis>
ok then
<sdegutis>
but i just dont like Core
<sdegutis>
first of all because i dont like label-based functions
<thizanne>
use Batteries then
<sdegutis>
and also because it looks like it does too many things
<sdegutis>
and finally because it looks to be not very idiomatic OCaml
<sdegutis>
thizanne: thank you for the kind suggestion; does Batteries fit all three of my criteriums?
<Drup>
it's opinionated OCaml. I wouldn't say it's non idiomatic
<sdegutis>
Drup: i would
<sdegutis>
Drup: did you write Core?
<Drup>
ahahahah
<Drup>
pfrr x)
<sdegutis>
Drup: because i will be quite to not offend you if so
<thizanne>
sdegutis: I answered only after the first one, and yes, it does
<Drup>
do you realize how big core is ? nobody could write that alone reasonably :D
<sdegutis>
thizanne := !thizanne + 1
<thizanne>
I don't really understand the second one, so I don't know (I think batteries is smaller than full core)
<sdegutis>
that typoing was more due to laziness than irony
<sdegutis>
but the irony fits too
<thizanne>
and do as if this module didn't exist for now
Hannibal_Smith has quit [Quit: Leaving]
doobi-sham-5008 has joined #ocaml
rgrinberg has joined #ocaml
strmpnk has joined #ocaml
<sdegutis>
Does stdlib not have an alternative to List.map ?
<adrien>
"alternative"?
<sdegutis>
yes
<sdegutis>
alternative: [adjective] "available as another possibility"
mcclurmc has joined #ocaml
<Drup>
I don't understand what you mean either.
<companion_cube>
sdegutis: is it the non-tailrec aspect of List.map that bothers you?
<sdegutis>
Does the standard OCaml library have any function to map a list to another list?
<Drup>
yeah, List.map
<sdegutis>
oh
<companion_cube>
rev_map + rev works, too
<sdegutis>
I thought that was part of Core
<companion_cube>
Core shadows many parts of the stdlib
<Drup>
Core redefine the list modules
<sdegutis>
I have no idea which List functions are part of Core and which are part of stdlib
<sdegutis>
I should probably stop reading Real World OCaml then.
<sdegutis>
It's confusing me.
<Drup>
it's a common problem when reading Core
<Drup>
but it's not that much of an issue really
mcclurmc_ has quit [Ping timeout: 244 seconds]
<ingsoc>
looks like this eclipse plugin uses ocamlbuild under the covers to compile code. I seem to be referencing the opam installed libraries correctly "~/.opam/<version>/lib" but ocamlbuild still outputs "Error: Unbound module Core"
oriba_ has joined #ocaml
<ingsoc>
do i need to compile files in "~/.opam/<version>/lib" first ?
<ingsoc>
i am still a bit cluless as to what constitutes compiling to bytecode
doobi-sham-5008 has quit [K-Lined]
IbnFirnas has joined #ocaml
pdewacht has quit [Ping timeout: 256 seconds]
oriba has quit [Ping timeout: 276 seconds]
Kakadu has joined #ocaml
vanila has quit [Quit: Leaving]
pdewacht has joined #ocaml
rgrinberg has quit [Quit: Leaving.]
shinnya has joined #ocaml
oriba__ has joined #ocaml
AlexRussia has quit [Ping timeout: 265 seconds]
oriba_ has quit [Ping timeout: 245 seconds]
tane has quit [Quit: Verlassend]
MercurialAlchemi has quit [Ping timeout: 272 seconds]
AlexRussia has joined #ocaml
ggherdov has joined #ocaml
AlexRussia has quit [Excess Flood]
AlexRussia has joined #ocaml
thomasga has joined #ocaml
pdewacht has quit [Ping timeout: 264 seconds]
labichn has joined #ocaml
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
moomin-aba has joined #ocaml
moomin-aba has quit [Remote host closed the connection]
ivan\ has quit [Read error: Connection reset by peer]
ivan\ has joined #ocaml
cdidd has joined #ocaml
tanguy` has quit [Quit: J’ai piscine.]
rgrinberg has joined #ocaml
labichn has quit [Quit: Page closed]
Kakadu has quit [Remote host closed the connection]
ingsoc has quit [Quit: Leaving.]
skinkitten has quit [Quit: Leaving]
Simn has quit [Quit: Leaving]
ingsoc has joined #ocaml
<chouser>
Drup: I think I understand both your solutions, though I'm very far from being able to develop either myself.
<chouser>
It would indeed be nice to specify t only once, since my real one is 10 variants instead of just 2. :-P
<Drup>
the second solution is just the first with the functor manually applied
<chouser>
cleans it up a lot
<Drup>
since you don't really need the functor more than once, it's shorter to apply it
<chouser>
Could t be stuffed into a third module and referred to by both the sig and struct of OrderedVal?
<Drup>
I tried that, didn't managed to make it work
<Drup>
didn't try very hard, though
<chouser>
heh, well, I doubt there's much hope for me, then. But perhaps I'll try, so at least I can see the errors myself. :-)
swgillespie has joined #ocaml
<Drup>
you start hitting sharp corners of the module system quite quickly when doing weird recursive manipulations like that
<chouser>
that's certainly what I feel like I've been doing. :-)
<Drup>
It's not a solution that I consider really satisfying
<mfp>
essentially the same, just with a non-broken compare
<mfp>
(same as the above gist)
<Drup>
what I would prefer is to be able to define once a module that contains only types and the associated module types, since they are basically the same
<chouser>
heh. mfp, any references I can read on the dangers of using Pervasives.compare?