<Drup>
but the constraints in the blog post are ridiculous
<Drup>
"no external libraries, no C bindings" and then start using the standard library, who all implement this stuff in a pluggable way, half of them using C bindings.
<ggole>
ebzzry: add the src directory to the searched paths (with -I, or however your build system likes to do that)
darkf has quit [Quit: Leaving]
<ggole>
Drup: before looking at it, I'm gonna guess that this version uses Zarith
<ggole>
Oh, it just calls GMP
<ggole>
I like PHP's solution though. It's uniquely fitting.
<companion_cube>
:D
<companion_cube>
it's so php
<companion_cube>
it would be nice to have something pluggable for Ocaml, though (defaults to num, but uses GMP/Zarith if available)
<ebzzry>
ggole: like this? ocamlfind ocamlc -o test -package core,oUnit -linkpkg -thread -I ../src test.ml
<ggole>
Um, I think so? I don't really remember how to use ocamlfind directly.
<def`>
companion_cube: what would be the benefits? when you realize you need suddenly to switch bigint implem?
<ggole>
When you look at a profile of your messy megaline program and see bigint ops at the top
<ebzzry>
I tried that but I get 'Reference to undefined global `Foo''
<ggole>
ebzzry: oh, you have to link foo.cmo too
<ggole>
Best guess: ocamlfind ocamlc -o test -package core,oUnit -linkpkg -thread -I ../src foo.cmo test.ml
<ebzzry>
let me try that.
* ggole
can't help but think that the error message could be a lot more helpful
tane has joined #ocaml
<companion_cube>
def`: to use bigints without worrying about the particular implementation
<companion_cube>
better implementation means better performance, but you wouldn't have to rewrite the code
ustunozgur has joined #ocaml
badkins has joined #ocaml
ontologiae has quit [Ping timeout: 245 seconds]
<Unhammer>
ebzzry, if you want to try ocamlbuild, I think you can do
<Drup>
bernardo1pc: because ~fancy javascript zoom~
eikke has quit [*.net *.split]
testcocoon has quit [*.net *.split]
ygu has quit [*.net *.split]
ygu has joined #ocaml
<ebzzry>
the command that works is 'ocamlbuild -r -use-ocamlfind -package core,oUnit -tag thread -I src test/test.native' while the command that make (from oasis) uses is: 'ocamlfind ocamlc -c -g -package oUnit -I test -o test/test.cmo test/test.ml'
<ebzzry>
is there a way to modify the build flags/command that oasis executes?
c74d has quit [Remote host closed the connection]
Hannibal_Smith has quit [Quit: Sto andando via]
testcocoon has joined #ocaml
segmond has quit [Ping timeout: 265 seconds]
<companion_cube>
ebzzry: in oasis, you need something like BuildDepends: core,oUnit
maurer has joined #ocaml
<bernardo1pc>
Drup: yeh, and the graph doesn't even *display* without js
<bernardo1pc>
I'm teaching num analysis this semester, and if there's one thing my students will learn is when to use log scales for errors / time / ...
c74d has joined #ocaml
<ebzzry>
companion_cube: I do have that:https://transfer.sh/U5QlD/-oasis
<ggole>
Handy tricks like "everything looks flat on a log-log graph"?
<bernardo1pc>
well, you still get curves for Newton's method ;-)
<bernardo1pc>
(which is probably the best display of how fast it goes)
<companion_cube>
ebzzry: try adding core,threads to the dependencies of test?
ustunozgur has quit [Remote host closed the connection]
<ebzzry>
companion_cube: it still complains 'Error: Unbound module Foo'
<companion_cube>
did you do "oasis setup; ocaml setup.ml -clean" or something like this?
<companion_cube>
ohhhhhhhhhhhh wait
<companion_cube>
Foo is not in the path of the test
<companion_cube>
it's in another directory
<ebzzry>
companion_cube: yup.
<companion_cube>
maybe you can put "<../src>: include" in test/_tags
<companion_cube>
or something like this
maurer has quit [Ping timeout: 258 seconds]
<ebzzry>
I tried that, but the error message that it gives is still the same.
maurer has joined #ocaml
pharpend_ has quit [Ping timeout: 240 seconds]
paddymahoney has joined #ocaml
samrat has joined #ocaml
pharpend_ has joined #ocaml
elfring has quit [Quit: Konversation terminated!]
eikke has joined #ocaml
George___ has joined #ocaml
rand000 has joined #ocaml
<George___>
Hi, when I run "opam install xxx", it requires root permission. What I can do so opam installs packages with current user's permission, so installing a new package in current user's home, or updating log/loc directory doesn't require root privilage?
morphles has joined #ocaml
<George___>
I use ubunut
<George___>
ubuntu
<Drup>
did you run "opam init" yourself ?
<George___>
yes. what I did again is, I totally deleted .opam from home, and run opam init again without sudo. still running opam install requires root priv
<Drup>
that's weird.
<Drup>
which package are you trying to install ?
bytbox has quit [Remote host closed the connection]
<George___>
tcpip
jonludlam has quit [Ping timeout: 255 seconds]
rand000 has quit [Ping timeout: 258 seconds]
morphles has quit [Ping timeout: 255 seconds]
AlexRussia has quit [Ping timeout: 246 seconds]
jonludlam has joined #ocaml
avoidthemonoid has joined #ocaml
AlexRussia has joined #ocaml
<avoidthemonoid>
does anyone here use Js_of_OCaml? The resultant code seems more or less uneditable. Is there a way to build things in API like fashion so Js_of_OCaml code can interact with hand written javascript?
<mrvn>
It's generated code. It's not supposed to be editable.
<avoidthemonoid>
sure... but is there something like a generated interface?
<mrvn>
Do you want hand written code to use your compiled code or use hand written code from the compiled code?
<avoidthemonoid>
The handwritten code will use the compiled code
<mrvn>
Or even have callbacks?
jonludlam has quit [Ping timeout: 265 seconds]
isomorphismes has quit [Remote host closed the connection]
<mfp>
avoidthemonoid: you can wrap OCaml functions with Js.wrap_callback and then register them somewhere so that other (hand-written) Javascript code can find it
slash^ has joined #ocaml
<avoidthemonoid>
Ahh, ok thats very good to hear. Do you find the generated code to be reliable on most browsers? Are they fairly on top of fixes when browser updates break things?
AlexRussia has quit [Ping timeout: 258 seconds]
elfring has joined #ocaml
<mfp>
AFAIK the compiled code corresponding to your OCaml sources is solid.
<mfp>
there can be a problem depending on the APIs you use (there's minimal/no browser-specific hackery in the js_of_ocaml lib)
<mfp>
_but_ you can also use JQuery or whatever shim lib from OCaml
martintrojer has quit [Ping timeout: 246 seconds]
Khady has quit [Quit: No Ping reply in 180 seconds.]
Khady has joined #ocaml
Khady has joined #ocaml
Khady has quit [Changing host]
martintrojer has joined #ocaml
AlexRussia has joined #ocaml
boogie has joined #ocaml
parcs has quit [Remote host closed the connection]
pharpend_ has quit [Ping timeout: 260 seconds]
parcs has joined #ocaml
jbalnit has quit [Ping timeout: 245 seconds]
Simn has quit [Read error: Connection reset by peer]
jbalnit has joined #ocaml
<ebzzry>
what should I put in _tags when ocamlfind says: ocamlfind: Error from package `threads': Missing -thread or -vmthread switch
<tane>
true: thread
badkins has quit [Remote host closed the connection]
boogie has quit [Remote host closed the connection]
araujo has joined #ocaml
bytbox has joined #ocaml
bytbox has quit [Remote host closed the connection]
<ebzzry>
tane: it now complains 'Reference to undefined global `Core'' This is the _tags file: https://transfer.sh/EuDsE/-tags
oscar_toro has joined #ocaml
<tane>
ebzzry, you could try package(core), or use corebuild command, which supplies the right commands to ocamlbuild anyway
WraithM has quit [Quit: leaving]
WraithM has joined #ocaml
avoidthemonoid has quit [Ping timeout: 246 seconds]
boogie has joined #ocaml
pharpend_ has joined #ocaml
malc_ has quit [Ping timeout: 245 seconds]
boogie has quit [Remote host closed the connection]
Intensity has quit [Ping timeout: 246 seconds]
mbac_ has quit [Ping timeout: 250 seconds]
badon has quit [Ping timeout: 250 seconds]
badon has joined #ocaml
mcclurmc has joined #ocaml
ontologiae has joined #ocaml
<seliopou>
bit of a noob question: is there a way to alias a module in an .mli file?
<adrien>
no
<seliopou>
meh
<seliopou>
thanks
ousado has quit [Changing host]
ousado has joined #ocaml
pharpend_ has quit [Quit: WeeChat 0.4.3]
<ggole>
seliopou: what are you trying to do? .mlis are really for signature, not implementation
<seliopou>
ggole: yes I'm aware
ysz has quit [Ping timeout: 244 seconds]
<seliopou>
I'm a decent ocaml programmer, but I'm dealing with a situation where aliasing modules in mli files would make them more readable
<seliopou>
so noob question from an experienced programmer
<seliopou>
:)
<Drup>
you can alias modules in a mli with 4.02
<seliopou>
Sup Drup
<Drup>
but not before :)
<ggole>
More readable? Are you having to duplicate a huge data type or something?
koderok has joined #ocaml
<seliopou>
is that out yet?
bytbox has joined #ocaml
<seliopou>
I'm behind on the times
<Drup>
sure it's out
<Drup>
even 4.02.1
<seliopou>
ah ok
<ggole>
It's out but still a bit new: latest is 4.02.1
koderok has quit [Client Quit]
AlexRussia has quit [Ping timeout: 244 seconds]
<seliopou>
ggole: just trying to shorten a name
<ggole>
Oh, I see
mbac has joined #ocaml
Thooms has quit [Quit: WeeChat 1.0.1]
bytbox has quit [Remote host closed the connection]
ollehar1 has joined #ocaml
boogie has joined #ocaml
jwatzman|work has joined #ocaml
ysz has joined #ocaml
ontologiae has quit [Ping timeout: 250 seconds]
<def`>
seliopou: module M : (module Aliased);;
<adrien>
hmpf
<seliopou>
def`: in 4.01?
<adrien>
I really need to update myself to more than 3.12
<def`>
4.02
<def`>
4.01 would be
<seliopou>
gotta explicitly dump the names in a new sig?
<def`>
module M : sig include module type of Aliased end
<def`>
humm wait, no
<seliopou>
hmmmm
Kakad has quit [Ping timeout: 246 seconds]
ysz has quit [Ping timeout: 245 seconds]
<def`>
module M : module type of struct include Aliased end
<def`>
in the mli
<def`>
module M = Aliased
<def`>
in the ml
<def`>
but that's not really an alias, behind the scene the compiler will copy the definitions, though this shouldn't matter for small projects
<jpdeplaix>
def`: isn't it the same thing as: « module M : module type of Aliased » ?
<def`>
jpdeplaix: no
keen____ has joined #ocaml
<ggole>
Just to save typing :(
<def`>
module M = struct type t end
<def`>
module type of M : sig type t end
keen___ has quit [Ping timeout: 265 seconds]
<def`>
module type of struct include M end : sig type t = M.t end
<def`>
you see? type equalities are introduced
<jpdeplaix>
oh right, I see
<jpdeplaix>
I didn't know it
AlexRussia has joined #ocaml
Intensity has joined #ocaml
jonludlam has joined #ocaml
hausdorff has joined #ocaml
hausdorf_ has joined #ocaml
hausdorff has quit [Read error: Connection reset by peer]
rand000 has joined #ocaml
hausdorff has joined #ocaml
hausdorf_ has quit [Read error: Connection reset by peer]
hausdorff has quit [Remote host closed the connection]
<Leonidas>
let%lwt user_id = (match user with
<Leonidas>
| Some u -> let%lwt v = id_of_user token u in Lwt.return (Some v)
<Leonidas>
| None -> Lwt.return None) in
<Leonidas>
any idea how to make this less ugly?
<Leonidas>
I think I am too dumb
badon has quit [Ping timeout: 255 seconds]
<Leonidas>
or too tired. So I have an option type that I'd like to Lwt.bind, but of course only if it exists. So this is the best I could come up with, but that is ugly because of layers of wrapping
WraithM has quit [Quit: leaving]
<jpdeplaix>
Leonidas: first you can avoid the parenthesis around the match
<ggole>
Pull the Lwt.return out of the match, and then factor out the option map bit?
<ggole>
Then it'd be something like let%lwt user_id = Lwt.return (option_map_lwt (id_of_user token) user) in
badon has joined #ocaml
<Leonidas>
ggole: can't pull the Lwt.return out, since let%lwt returns the rvalue to be of Lwt.t type
<Leonidas>
s/returns/requires/
<ggole>
Isn't that what Lwt.return does?
<ggole>
By pull it out I don't mean remove it entirely, just write it once rather than in each arm of the match.
<Leonidas>
ggole: I understand what you mean (I hope), but I can't just do let%lwt v = id_of_user token u in Some v because that would have string option as value, but let%lwt requires 'a Lwt.t, in my case string option Lwt.t.
<Drup>
Leonidas: match%lwt ?
<ggole>
Oh, I see :/
hausdorff has joined #ocaml
<Leonidas>
Drup: thought about it, but I always match on non-Lwt.t values, so match%lwt doesn't help me there, I think.
<Drup>
also, "id_of_user token u >|= (fun x -> Some x)"
<Drup>
(that's the point were you curse on caml for not having constructor-function
Simn has joined #ocaml
<Leonidas>
yeah, in Haskell I could've just used Some
<Leonidas>
Drup: >|= ? not >>=?
<Drup>
yeah, map, not bind
<Leonidas>
oh, you're right
<Leonidas>
didn't know this existed
George___ has quit [Quit: Page closed]
badkins has joined #ocaml
claudiuc has quit [Remote host closed the connection]
MasseR_ has quit [Quit: leaving]
badkins_ has joined #ocaml
badkins__ has joined #ocaml
badkins has quit [Ping timeout: 255 seconds]
badkins_ has quit [Ping timeout: 245 seconds]
ontologiae has joined #ocaml
dsheets has quit [Ping timeout: 245 seconds]
Hannibal_Smith has joined #ocaml
kakadu has joined #ocaml
Anarchos has joined #ocaml
larhat has quit [Quit: Leaving.]
claudiuc has joined #ocaml
dlowe has left #ocaml ["Leaving"]
sheijk has quit [Quit: .]
pharpend has quit [Quit: WeeChat 0.4.3]
pharpend has joined #ocaml
bytbox has joined #ocaml
bytbox has quit [Remote host closed the connection]
ontologiae has quit [Ping timeout: 272 seconds]
WraithM has joined #ocaml
jbalnit has quit [Ping timeout: 244 seconds]
pharpend has quit [Quit: WeeChat 0.4.3]
c74d has quit [Remote host closed the connection]
tizoc has quit [Quit: Coyote finally caught me]
tizoc has joined #ocaml
c74d has joined #ocaml
bytbox has joined #ocaml
sheijk has joined #ocaml
boogie has quit [Quit: Leaving...]
hausdorff has quit [Remote host closed the connection]
srcerer has joined #ocaml
ollehar1 has quit [Ping timeout: 240 seconds]
bytbox has quit [Remote host closed the connection]
samrat has quit [Quit: Computer has gone to sleep.]
luzie has joined #ocaml
bytbox has joined #ocaml
hausdorff has joined #ocaml
jabesed has joined #ocaml
shinnya has joined #ocaml
pharpend has joined #ocaml
bytbox has quit [Remote host closed the connection]
dsheets has joined #ocaml
larhat has joined #ocaml
slash^ has quit [Read error: Connection reset by peer]
jbalnit has joined #ocaml
r0ok has quit [Quit: leaving]
hausdorff has quit [Remote host closed the connection]
dav has quit [Ping timeout: 240 seconds]
dav has joined #ocaml
hausdorff has joined #ocaml
jonludlam has quit [Quit: Coyote finally caught me]
dav_ has joined #ocaml
hhugo1 has joined #ocaml
dav has quit [Ping timeout: 260 seconds]
AlexRussia has quit [Quit: WeeChat 1.1-dev]
AlexRussia has joined #ocaml
hausdorff has quit [Remote host closed the connection]
ivan\ has quit [Ping timeout: 244 seconds]
hausdorff has joined #ocaml
hhugo1 has quit [Quit: Leaving.]
bytbox has joined #ocaml
sheijk_ has joined #ocaml
sheijk has quit [Ping timeout: 260 seconds]
axiles has quit [Remote host closed the connection]
AlexRussia has quit [Ping timeout: 246 seconds]
rand000 has quit [Ping timeout: 265 seconds]
sheijk has joined #ocaml
lordkryss has quit [Quit: Connection closed for inactivity]
elfring has quit [Quit: Konversation terminated!]
sheijk_ has quit [Ping timeout: 265 seconds]
AlexRussia has joined #ocaml
starless has joined #ocaml
morphles has joined #ocaml
jabesed has quit [Ping timeout: 265 seconds]
Submarine has quit [Remote host closed the connection]
badkins__ has quit []
jabesed has joined #ocaml
jwatzman|work has quit [Quit: jwatzman|work]
<starless>
hello. definitely a noob question: how come when I try to load up a file in the OCaml interpreter I get the error "Unbound value use"? Is that deprecated functionality or something?
<starless>
to be clear, I'm trying to load the file like this: use "test.sml";;
<companion_cube>
#use, not yse
<starless>
ah. okay. why is that?
<dsheets>
also ocaml usually uses the file extension ".ml" not ".sml"
<dsheets>
it's a toplevel directive, not part of the language proper