<Algebr`>
Is this an alternative to Jane street's Core.Std?
<Drup>
yeah
<Drup>
quite a different style, though
<dmbaturin>
I want to make a brainfuck compiler as an ocaml excercise. What is the idiomatic approach to keeping state between translate function calls to keep track of brackets; or, better, elminate the need for state?
<Drup>
use a stack ? :)
<Drup>
there is an imperative stack in the standard library, if you want a functional one, well, just use a list
<dmbaturin>
Well, I guess. The question is, where should I produce the side effect.
<dmbaturin>
Wrap the stateless translate function into an impure one?
<Drup>
you don't have to use side effects, you could pass along a state (as a record)
<dmbaturin>
Or pass the state list as an argument in the tail call?
<Drup>
I can't give you any answer, it depends on your preference
<Drup>
and of the rest of the design
<Drup>
In something as simple as a brainfuck interpretor, I would probably go the stateless route
<Drup>
when I did a graphical logo interpreter, which is pretty much the same thing, I used a state
<dmbaturin>
Ok, I'll make something and link it here for everyone to laugh at. :)
<Drup>
(mostly because graphical backends are stateful anyway)
<derek_c>
I'm trying to run a script with `ocaml <script>`
Submarine has quit [Remote host closed the connection]
hhugo has quit [Quit: Leaving.]
Eyyub has quit [Ping timeout: 260 seconds]
hhugo has joined #ocaml
hhugo has quit [Client Quit]
derek_c has quit [Ping timeout: 264 seconds]
azynheira has joined #ocaml
NoNNaN has quit [Ping timeout: 264 seconds]
alpounet has joined #ocaml
no0y has left #ocaml ["ERC Version 5.3 (IRC client for Emacs)"]
Gonzih has joined #ocaml
morphles has joined #ocaml
gal_bolle has joined #ocaml
<morphles>
Can I have arithmetinc/matematical polymorphic functions like in haskell? Say "let sq = fun x = x * x" As I understand this will be int only, if I wan't float I have to use *. But maybe there is some way to have polymorphic function? And most importantly return type polymorphism?
<whitequark>
no (not yet)
<morphles>
Thats a pitty. Somehow long time ago I read about ocalm and though it also had typeclasses like haskell, but it seems typeclasses are rather rare
tobiasBora has joined #ocaml
<whitequark>
it will have implicits soon
<Unhammer>
whitequark, is there an url or something on that? ddg is not being helpful :)
arquebus has quit [Quit: Konversation terminated!]
zpe has joined #ocaml
<Unhammer>
is there some common idiom for "line-parsing" with one line lookahead in ocaml? e.g. I have input "groupname⏎entry1⏎entry2⏎groupname2⏎entry3⏎entry4⏎" and want to call a function for each group, so when reading input I have to consume the first line of the next group in order to know that this group has ended
<Unhammer>
if I were writing a quick awk script the loop would say "{if($0~/group/){dostuff(g); g=""}; g=$0}" but I assume there's some nice functional way of doing it as well …
divyanshu has joined #ocaml
<Kakadu>
Unhammer: Sounds good for parser-combinators
<Unhammer>
http://sprunge.us/jbNS ← what I ended up doing, a bit longer code than the awk heh
BitPuffin has quit [Ping timeout: 250 seconds]
divyanshu has quit [Ping timeout: 264 seconds]
<def`>
Unhammer: about merlin, I managed to reproduce the memory leak with emacs, it is fixed in latest master, we should make a release soon
divyanshu has joined #ocaml
<Unhammer>
oh, awesome, thank you def` :-)
<Unhammer>
now I can have firefox open while coding =P
divyanshu has quit [Client Quit]
slash^ has joined #ocaml
ggole has joined #ocaml
shinnya has quit [Ping timeout: 245 seconds]
morphles has quit [Ping timeout: 245 seconds]
Anarchos has joined #ocaml
araujo has quit [Quit: Leaving]
mcclurmc has joined #ocaml
divyanshu has joined #ocaml
Eyyub has joined #ocaml
gal_bolle has joined #ocaml
jerith has quit [Quit: leaving]
jerith has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
tobiasBora has quit [Ping timeout: 245 seconds]
huza has joined #ocaml
aymeric has joined #ocaml
aymeric is now known as Aym_C
ygrek has joined #ocaml
divyanshu has quit [Ping timeout: 240 seconds]
manizzle has quit [Ping timeout: 255 seconds]
Aym_C has quit [Quit: Lost terminal]
slash^ has quit [Read error: Connection reset by peer]
<whitequark>
hmmmm
<whitequark>
all open types carry the constructor name inside them, right?
<def`>
whitequark: but afaik, there is no public api for this
<def`>
(search for "Name of the constructor")
<whitequark>
yeh
<def`>
(this public api would not be typeable, so it's quite unsafe, but would make sense in Obj)
<whitequark>
I want exceptions and open types in [@@deriving Show]
<whitequark>
probably not yet though
<def`>
so everything you need to know is probably somewhere inside these notes
<whitequark>
yeah
<whitequark>
I actually looked at Printexc already
<whitequark>
it has more or less same code
<def`>
ok
* whitequark
sighs
<whitequark>
OASIS is so very suboptimal for packaging ppx-intense stuff
<whitequark>
due to really dumb *Opt: and BuildDepends: and inflexible META generator
<whitequark>
I'm considering switching to topkg
<whitequark>
well, topkg+ocamlbuild
divyanshu has joined #ocaml
tobiasBora has joined #ocaml
<tobiasBora>
Does anyone know how to force the evaluation of a BatEnum ? I would like to convert a file in Enum, filter it, and write the result in the same file, but because some lazy operations the file is opened and troncated at the very beginning so I get only an empty file.
<tobiasBora>
I found a first solution which is convert into list, then convert back into enum, but that sound ugly...
<ggole>
Write to a new file and rename at the end
<ggole>
This will also prevent lossage in the case of powerout, crash, rogue sysadmin/OOM randomly killing processes, etc
<whitequark>
your competitors putting a screwdriver through a power bus in a datacenter
<whitequark>
(this actually happened to someone I know)
q66 has joined #ocaml
<ggole>
Was that an "oops :o" or an "oops >:)"
<tobiasBora>
Ahah ^^ Ok thank you I will do that !
<whitequark>
the latter
<whitequark>
it was completely deliberate
<ggole>
Nice
<whitequark>
after the UPS, too
<ggole>
Was this in .ru by any chance?
<whitequark>
sure
<ggole>
I figured. Uh, no offense.
<whitequark>
none taken
BitPuffin has joined #ocaml
BitPuffin has quit [Client Quit]
divyanshu has quit [Ping timeout: 240 seconds]
alpounet has quit [Remote host closed the connection]
alpounet has joined #ocaml
Thooms has joined #ocaml
hhugo has joined #ocaml
divyanshu has joined #ocaml
BitPuffin has joined #ocaml
zpe has quit [Remote host closed the connection]
BitPuffin has quit [Ping timeout: 256 seconds]
dsheets has joined #ocaml
ygrek has quit [Ping timeout: 245 seconds]
shallowest is now known as hlupe
tobiasBora_ has joined #ocaml
tobiasBora has quit [Ping timeout: 240 seconds]
ollehar has joined #ocaml
q66 has quit [Remote host closed the connection]
gal_bolle has quit [Ping timeout: 240 seconds]
dsheets has quit [Ping timeout: 245 seconds]
q66 has joined #ocaml
dsheets has joined #ocaml
divyanshu has quit [Ping timeout: 240 seconds]
divyanshu has joined #ocaml
darkf has quit [Quit: Leaving]
Hannibal_Smith has joined #ocaml
ollehar has quit [Ping timeout: 250 seconds]
gal_bolle has joined #ocaml
divyanshu has quit [Ping timeout: 260 seconds]
divyanshu has joined #ocaml
gal_bolle has quit [Ping timeout: 256 seconds]
<adrien>
bah
<adrien>
self TOFO
<adrien>
TODO*
<adrien>
revert patch in #6411 for my own uses
divyanshu has quit [Ping timeout: 250 seconds]
divyanshu has joined #ocaml
q66 has quit [Quit: Leaving]
divyanshu has quit [Ping timeout: 245 seconds]
<whitequark>
wth is Caml Light?
<adrien>
90s
<Anarchos>
whitequark it is the previous version of OCaml, with a concurrent GC.
<Anarchos>
but without objects.
<whitequark>
I see
<adrien>
nbo
<adrien>
no
<adrien>
caml super light had the concurrent gc
<adrien>
not caml light
Eyyub has quit [Ping timeout: 250 seconds]
q66 has joined #ocaml
<Anarchos>
adrien special light, not superlight.
<Anarchos>
adrien and indeed the caml light GC was monothreaded, but a direct simplification of the Doligez's concurrent GC.
dsheets has quit [Ping timeout: 260 seconds]
<adrien>
rigt, sorry :)
<adrien>
me stupid sometimes
dsheets has joined #ocaml
<adrien>
but the point being that the simplification was wanted
<gp83>
Hi, I've noticed that in OCaml type_expr's, types often are `linked' using the Tlink constructor. Does anyone know of a good source of documentation on why this is done? I'm guessing it is a byproduct of a unification process when typing the program, but it'd be great to read about the process (especially why the links aren't `removed')
<gp83>
(maybe `compressed' is a better verb than `removed')
<ggole>
Utterly uninformed guess: allows printing the original name of the type as well as an alias?
<whitequark>
jpdeplaix: LLVM/bindings version mismatch
<jpdeplaix>
ok
<def`>
there is a beginning of an explanation in Btypr.repr
<whitequark>
yep. I'll convert everything to use it
huza has quit [Quit: WeeChat 0.3.8]
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
WraithM has joined #ocaml
<Algebr`>
I can't get the type signature for |>
<Algebr`>
how is |> different from just ;?
<Kakadu>
(|>);; in toplevel
<Algebr`>
I have tried that but get an error
<Algebr`>
in both utop and regular ocaml
<Kakadu>
I have tried not exectly what I write
<Kakadu>
not exactly*
<Algebr`>
I understand that, I'm telling you I get an error. Error: Failure: "|> must be applied to two arguments"
<Kakadu>
do you have ( and ) ?
<Algebr`>
tried that too
<Kakadu>
What is your ocaml version?
<Algebr`>
The OCaml toplevel, version 4.01.0
<Kakadu>
It works for me in 4.01.0
<rks`>
Algebr`: you're using camlp4
<Algebr`>
rks`: not sure what that is, some package?
<rks`>
(I get the same error when using camlp4, otherwise I can get the signature)
<rks`>
Algebr`: it's a preprocessor
<rks`>
and apparently you modified your .ocamlinit to load it automatically
<rks`>
(I'm guessing)
<Algebr`>
ah, yes I did!
<Algebr`>
is there an unload in the top level?
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
<whitequark>
Drup: do you think the disambiguation suffix for deriving plugins should be [@deriving_show.format], [@deriving.show.format] or [@show.format] ?
<whitequark>
I'm leaning to the last one so far
<rks`>
I like the 2nd one
<Algebr`>
What is the difference between |> and just ; ?
<whitequark>
rks`: noted
<Algebr`>
aren't both for sequencing?
<whitequark>
Algebr`: no, let (|>) x f = f x
<whitequark>
and also let (@@) f x = f x
<tane>
what's the purpose of @@ then? something like $ in haskell?
<rks`>
yes
<tane>
ok, thanks, didn't knew that :)
<whitequark>
grmbl
<whitequark>
I want hygiene in ppx_tools
divyanshu has quit [Ping timeout: 250 seconds]
<Algebr`>
So the |> is basically like the shell's |?
<whitequark>
yeh
BitPuffin has joined #ocaml
BitPuffin has quit [Quit: See you on the dark side of the moon!]
pminten has joined #ocaml
dsheets has quit [Ping timeout: 260 seconds]
philtor has joined #ocaml
typedlambda has quit [Read error: Connection reset by peer]
typedlambda_ has joined #ocaml
typedlambda_ is now known as typedlambda
azynheira has quit [Ping timeout: 245 seconds]
<Algebr`>
what does: type t = int String.Map.t say?
<Algebr`>
Also, is there there a difference between doing module Foo = Map.Make(String) and module Bar = String.Map?
<zapu>
what is $ in haskell?
<Algebr`>
apply
pminten_ has joined #ocaml
<zapu>
those operators are tricky to google...
<Algebr`>
zapu: just go to ghci and do :t ($)
philtor has quit [Ping timeout: 255 seconds]
pminten has quit [Ping timeout: 264 seconds]
<Hannibal_Smith>
Or use Hoogle
<zapu>
oh, cool
<zapu>
makes sense, thanks
philtor has joined #ocaml
hhugo has quit [Quit: Leaving.]
<whitequark>
Algebr`: it (the first statement) makes an alias
<whitequark>
asfor the second one, I don't think there's a String.Map in stdlib
<whitequark>
it may be in Core
BitPuffin has joined #ocaml
tidren has joined #ocaml
q66_ has joined #ocaml
q66 has quit [Ping timeout: 240 seconds]
pminten_ has quit [Ping timeout: 255 seconds]
<def`>
it's not an alias (alias doesn't apply to functors)
<Unhammer>
can merlin tell me the module of a certain function?
<def`>
Unhammer: you can use locate of you built cmt files
<Unhammer>
like if I've done "open Pcre" and have point at "pmatch", I want Pcre back (would like to make a wrapper that then takes me to the .mli of Pcre and searches for the definition of pmatch)
<Unhammer>
ooh
<Unhammer>
:)
<Algebr`>
What does the suffix _exn usually mean?
<flux>
that the function throws an exception
<Unhammer>
it raises an exception Algebr`
<def`>
Algebr`: Map.Make(String) is like calling a functiok returning a new module
<flux>
sadly that's the only tool ocaml provides for tracking it ;)
<Unhammer>
(vs using an option or empty list or what have you)
<Algebr`>
so Map.of_alist_exn could possibly raise an exception?
<flux>
maybe. refer to its documentation.
<Algebr`>
flux: I can't get that info via the type signature?
<flux>
I think the case of duplicate keys could be interesting
<flux>
only arguments and return values are typed in the signature
<mrvn>
exceptions in the types are on several peoples wishlist but it's not so simple to implement
<Drup>
whitequark: it shouldn't be hard to automate the fact that ppx_deriving_host translate deriving.* things in * for the deriving command, or something
<Drup>
(or just provide an helper function for that)
q66_ is now known as q66
pjdelport has joined #ocaml
<whitequark>
I have a helper function, yes
<Algebr`>
def`: so Map.Make(String) is like calling a function that makes a new module, is String.Map a shortcut for that?
<whitequark>
also, it's just Ppx_deriving now, since I migrated from OASIS
<def`>
Algebr`: String.Map is just a constant whose value is the result of a previous call to Map.Make(String)
<def`>
Algebr`: so Map.Make has a runtime effect and is slightly less efficient
philtor has quit [Ping timeout: 240 seconds]
<def`>
also, while the types are compatible (for applicative functors), values can be different
<def`>
(any side effect done during the construction will be observable)
<Drup>
Map.Make as a runtime effect, wat ?
<def`>
Drup: a value is allocated
<Drup>
ah, yeah, ok, *once*
hhugo has joined #ocaml
<def`>
not once
<def`>
that's the difference between refering to String.Map and always using Map.Make
<Drup>
ok, right, but you *never* "always use Map.Make, it's silly, you do "module MapS = Map.Make(String)" and you go with that ...
<Drup>
you made it sounds like functors are computationally expensive, which they are not.
rand000 has joined #ocaml
<def`>
the questiob of Algebr` was the distinction between String.Map and Map.Make(String)
<def`>
the difference precisely this effect
<def`>
(when referring only to types, e.g. Map.Make(String).t no computation is done)
divyanshu has joined #ocaml
<Drup>
grmbl, I was going to try and find the line where "module String.Map = Map.Make(String)" but I can't find in core because it's a maze ~~
<Drup>
(I hear someone screaming "Boost" in the background)
WraithM has quit [Ping timeout: 245 seconds]
Submarine has quit [Remote host closed the connection]
morphles has joined #ocaml
<Drup>
whitequark: the one things that annoys me with topkg is the need for opam (or at least opam-install)
englishm has joined #ocaml
<def`>
Drup: second point, while any sane implementation shouldn't have side effects, other functors might
<def`>
of Map.Make*
<whitequark>
I don't really care about non-opam though
<Drup>
def`: indeed
englishm_ has joined #ocaml
<whitequark>
well, I suppose I care about Debian, but that should be able to use opam-install
<def`>
Drup: this can bite you, especially less obvious ones
<def`>
(e.g for an exception E that is not a rebind, F(A).E != F(A).E)
<Drup>
def`: I tried to use batteries with js_of_ocaml, I remember ~~
<def`>
I prefer not to know the details :)
<Drup>
whitequark: meh :/
<Drup>
whitequark: I heard you said you cared about windows, though.
<whitequark>
Drup: mhrmpf
englishm has quit [Ping timeout: 240 seconds]
<def`>
Drup: inconsistency is ok for human beings :)
hhugo has quit [Quit: Leaving.]
<whitequark>
Drup: I have a feeling that interpreting opam install files is really not hard
<Drup>
whitequark: it probably isn't, sure
<Drup>
(it's basically a list of instructions)
<Drup>
I'm more affraid of the whole env setup and path spagetti
<Drup>
(which oasis un-spaghetti for you on windows)
philtor has joined #ocaml
<Drup>
def`: Sure, that doesn't prevent me to point it out when I see it :D
<whitequark>
hmmm
<whitequark>
I dunno, but I really can't use OASIS for ppx_deriving
<whitequark>
too rigid
<Drup>
yes, I'm not surprised about that
<Drup>
we had an issue with eliom too, oasis can't do what we wanted
<whitequark>
Daniel pointed me to samoht/assemblage
<whitequark>
take a look, write Eq, or something :3
<Drup>
nice :)
<whitequark>
let me give you access...
<whitequark>
Done
<Drup>
thanks
<Drup>
I'm working on ocp-browser right now, so won't implement any ppx_deriving
Thooms has quit [Ping timeout: 260 seconds]
rand000 has quit [Ping timeout: 256 seconds]
morphles has joined #ocaml
tobiasBora_ has joined #ocaml
Eyyub has quit [Ping timeout: 240 seconds]
_0xAX has quit [Remote host closed the connection]
<whitequark>
ok
troutwine has joined #ocaml
tobiasBora_ has quit [Read error: No route to host]
tobiasBora_ has joined #ocaml
<algoriddle>
Sorry about the following idiotic question: I have two modules, a.ml and b.ml(i). A module uses some functions from B module. If I compile these, it's all fine. I use emacs with utop. I load a.ml into emacs, then send the contents to utop. It complains that it doesn't know about the definitions in b.ml(i). Can I get utop to load b.ml(i)?
<ggole>
Sure, with #load
<ggole>
Specifically, compile b.ml (and if it exists, b.mli) and then #load "b.cmo"
<algoriddle>
ah, ok, that's the part I was missing
<algoriddle>
thank you
<ggole>
By the way, be careful sending text to the toplevel in emacs
<ggole>
It's quite easy to end with up a stale definition
hhugo has joined #ocaml
ygrek has quit [Ping timeout: 260 seconds]
<Algebr`>
Say I have a Map, what's the easiest way to print it out?
<Algebr`>
would something like Map.iter print_endline <myMap> work?
Thooms has joined #ocaml
tobiasBora_ has quit [Ping timeout: 250 seconds]
<Drup>
not exactly, since Map.iter except a function that takes two arguments
<Drup>
(the key and the value)
<Drup>
print_endline takes one
<Drup>
but you should be able to figure out something using Printf easily :)
<companion_cube>
cough sequence cough
<Drup>
companion_cube: stop being stealthy :p
alpounet has quit [Remote host closed the connection]
<companion_cube>
^^
<Drup>
(and it's more of a CCPrint problème, here, but Core has something similar anyway, iirc)
alpounet has joined #ocaml
Eyyub has joined #ocaml
Thooms has quit [Ping timeout: 264 seconds]
<ggole>
printf "<abstr>"
<ggole>
Good enough for the toplevel!
tidren has joined #ocaml
alpounet has quit [Ping timeout: 256 seconds]
alpounet has joined #ocaml
tidren has quit [Ping timeout: 245 seconds]
troutwine is now known as troutwine_away
philtor has quit [Ping timeout: 260 seconds]
rand000 has joined #ocaml
Algebr` has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
troutwine_away is now known as troutwine
tidren has joined #ocaml
alpounet has quit [Remote host closed the connection]
hhugo has quit [Quit: Leaving.]
troutwine is now known as troutwine_away
zpe has joined #ocaml
derek_c has joined #ocaml
<derek_c>
what does the >>= operator do?
<companion_cube>
it's not a builtin operator, but a user function
<companion_cube>
so it depends on where it comes from
zpe has quit [Ping timeout: 245 seconds]
alpounet has joined #ocaml
Algebr` has joined #ocaml
<derek_c>
companion_cube, I suspect it's define in Lwt, but I'm not sure...
<companion_cube>
so, if you write a >>= fun x -> b, it means "once a completes, apply the function (fun x -> b) to its result" and the final result is b
<derek_c>
companion_cube, oh, that sounds useful
<derek_c>
companion_cube, thanks!
<companion_cube>
that's extremely useful, yes
divyanshu has quit [Quit: Computer has gone to sleep.]
<companion_cube>
you never block waiting for a value of type 'a Lwt.t
<companion_cube>
rather, you use (>>=) to register your computation, that will run once the future completes
<Algebr`>
Confused by this: [ `Duplicate_key of string | `Ok of 'a StringMap.t ], 1) this says its a list of Either Duplicate_key or Ok? 2) You can define variants on the fly with `? What is the type of Ok/Duplicate_key?
<companion_cube>
it's not a list, it's a polymorphic variant
<companion_cube>
that is indeed defined on the fly
<companion_cube>
both `Duplicate_key "yolo" and `Ok some_string_map are valid values of this type
<Algebr`>
companion_cube: but what exactly is the type of Duplicate_key?
divyanshu has joined #ocaml
<companion_cube>
`Duplicate_key here is a variant constructor
azynheira has joined #ocaml
<companion_cube>
(`Duplicate_key "yolo") is of type [ `Duplicate_key of string ]
<companion_cube>
look for "polymorphic variants" in OCaml's manual
<Algebr`>
companion_cube: is this something like haskell's data Maybe a = Nothing | Just a?
<companion_cube>
in this case, it's somehow isomorphic to Haskell's Either type
tidren has quit [Remote host closed the connection]
tidren has joined #ocaml
<Drup>
Algebr`: I linked you the relevant part of the manual the last time you asked the question, but I think you disconnected suddendly
<Algebr`>
ah, yes, I was having connection troubles.
morphles has quit [Ping timeout: 255 seconds]
<Algebr`>
so I can match on them too, would it be like match <somthing that gives [`Duplicate | `Ok] with | Duplicate -> <somelogic> | Ok -> <someLogic>
<companion_cube>
you need the `
<Drup>
it would be "with `Duplicate -> .. | `Ok -> ...
<companion_cube>
match x with `Duplicate_key s -> ...
tidren has quit [Ping timeout: 260 seconds]
<Algebr`>
is there an something analagous to ghci's :i in utop?
<Drup>
remind me, what does it do ?
<Algebr`>
like gives info on types, where they are defined
<Algebr`>
and what their definition is
<companion_cube>
in this case no type is defined
<Drup>
I don't think so, then
<Algebr`>
companion_cube: how can you have a variant without a type?
<companion_cube>
it's purely structural
<companion_cube>
like object types
FreeArtMan has joined #ocaml
<ggole>
Variants belong to sets of types, really
<ggole>
(Polymorphic variants, I mean.)
WraithM has joined #ocaml
alpounet has quit [Remote host closed the connection]
troutwine_away is now known as troutwine
alpounet has joined #ocaml
azynheira has left #ocaml ["Leaving"]
<algoriddle>
hmmm, I #load a module's cmo into utop, no error, yet the module remains "unbound", any idea why that might be?
axiles has quit [Remote host closed the connection]
WraithM has quit [Ping timeout: 240 seconds]
girrig_ is now known as girrig
<companion_cube>
algoriddle: I think you need to load a .cma
troutwine is now known as troutwine_away
englishm has quit [Ping timeout: 255 seconds]
Kakadu has quit [Quit: Konversation terminated!]
<algoriddle>
thanks, i tried that too, same result. is there a way to make utop or ocaml more verbose? it doesn't say anything when i execute "#load".
<companion_cube>
weird
<algoriddle>
or a way to list all modules currently loaded?
<algoriddle>
oh, I got it: it couldn't find some other file, i guess the cmti, perhaps
<algoriddle>
cmi
<algoriddle>
it needs both the cmo and the cmi, does that sound right?
<companion_cube>
to me it needs .cma :>
<algoriddle>
does the cma include the cmi as well?
<ggole>
How are you compiling the files?
<ggole>
ocamlbuild?
<algoriddle>
corebuild, which i assume calls ocamlbuild
<companion_cube>
you might need #directory commands
<companion_cube>
if it looks for the .cmi ?
<ggole>
Try #cd "_build" and then try again
<algoriddle>
ok, yes, it works for the cmo/cmi now
<ggole>
If that works, you need to add _build to the search path of utop with, say, -I on startup
<companion_cube>
or use #directory
<algoriddle>
although i wish it said something when it couldn't find the cmi
<algoriddle>
ok, will look into those
<algoriddle>
but i tried the cma loading on the compiler's ocamlcommand.cma
<ggole>
I'm guessing that you did ocamlbuild foo.cmo
<ggole>
Er, corebuild. Whatever.
<algoriddle>
yes, sort of
<ggole>
It might be easier to define a toplevel.mltop, from which you can ask whateverbuild to create a toplevel.top that contains all your junk.
<algoriddle>
i actually compiled the main executable.byte and as a byproduct it generated the cmo/cmis for the dependent module
<algoriddle>
yes, i see that is a common practice
<algoriddle>
i will look into that
<algoriddle>
but there's another thing here
<algoriddle>
when i tried the cma loading, i was playing with this compiler library called ocamlcommand.cma
<algoriddle>
which is part of the compiler package, but it's an internal library
<algoriddle>
i see there are some interesting modules there, for example, loading cmt files and so on
<algoriddle>
but none of this is exposed outside of the compiler
<algoriddle>
so people (ocp-index, merlin) just copy all these files to their projects
<algoriddle>
which is a bit bizarre, but anyway
<algoriddle>
but i wanted to load this cma into the toplevel, but again, it just silently fails
<algoriddle>
but a cma wouldn't require a separate cmi, right?
<algoriddle>
so I'm still a bit stumped why i can't load the .cma into utop
<algoriddle>
and so i'm wondering if there's a way to list what modules are loaded or to make the toplevel in any way more verbose or to log what it's doing
<ggole>
Silently fails how?
Denommus has joined #ocaml
<Denommus>
hi
Algebr` has quit [Remote host closed the connection]
<Denommus>
can you recommend me a FRP library (I have preference for signal function instead of classic FRP)?
ollehar has quit [Ping timeout: 250 seconds]
<Drup>
React
tobiasBora_ is now known as tobiasBora
<algoriddle>
silently fails as in no error, but the modules in the cma are not available
philtor has quit [Ping timeout: 250 seconds]
<Denommus>
does OCaml have a package manager?
<Denommus>
I mean, is OPAM widely used?
<jpdeplaix>
yes
<Denommus>
great
<ggole>
I'd guess that's a directory problem again
<algoriddle>
is there a way to list the contents of a cma? just to make sure i'm looking at the right thing
<Drup>
ocamlobjinfo
<ggole>
I don't know anything about this library, but it's possible that you should be using #require
<Drup>
algoriddle: the thing you are looking at right now is the exact reason why I don't even use #load for testing, I just install the library with ocamlfind and use #require
<algoriddle>
ok, thanks
<algoriddle>
ocamlobjinfo shows that i'm looking at the right cma (it includes the module i need: Cmt_format)
<algoriddle>
ok, so i will try the #require method then
<algoriddle>
(now i just need to figure out how to install a library with ocamlfind)
<Drup>
which build systems are you using
<Drup>
?
<algoriddle>
this particular library is part of the ocaml distribution, an internal library of the compiler from the look of it
<algoriddle>
i just want to play with the code that reads the cmt(i) files
<Drup>
it should be in compiler-libs then
Simn has quit [Quit: Leaving]
<Drup>
execute "ocamlfind list | grep compiler-libs" in your terminal to see them
<Drup>
you can #require them after that
<algoriddle>
it is, oh my
<algoriddle>
i got it, thanks
<Drup>
no problem
<ggole>
I don't see anything related to "command", though
FreeArtMan has quit [Ping timeout: 260 seconds]
<algoriddle>
compiler-libs.common is the one i'm talking about
<algoriddle>
it has a module called Cmt_format that i was looking for
<Drup>
:)
<algoriddle>
then why do merlin and ocp-index not use these libraries
<Drup>
ask def` :D
<ggole>
-_-
<algoriddle>
both of those projects made a copy of these modules
manizzle has joined #ocaml
<Drup>
I think it was not available on ocaml 3.12
<Drup>
(not sure)
<def`>
algoriddle: we hace our own version of the type-checker, official one + patchset
<def`>
for this reason we can't rely on compiler provided one
<algoriddle>
ok, but for reading the cmt files, you must use the version that's in the compiler, i would think
<def`>
(official one is completely stateful and we have a set of modifications big enough that it is cheaper to fork rather than work around officiel lib)
<algoriddle>
but that's ok, there might be a complex chain of dependencies here, that you have to worry about
<algoriddle>
in any case, to read the cmt files, i can safely go with the compiler-libs version, can't I?
<def`>
yes, that's why we support only 4.00, 4.01 and 4.02 in alpha
<def`>
you can
<algoriddle>
ok, thank you. and thanks for everyone for being so helpful.
philtor has joined #ocaml
<def`>
np, you're welcome :)
<Denommus>
I tried to make a simple game in a FRP library in Haskell (even trying to make my loop function being strictly evaluated), but the memory consumption was too big. Would OCaml be any better in this regard? Would strictness help?
<companion_cube>
"maybe" ? :D
<Denommus>
heh, ok
<companion_cube>
I don't know if it wil be better, but at least it should be more predictable
<Denommus>
maybe I could update the reference of the state in my top-level function, instead of generating a new state every interaction
<Denommus>
did I say interaction? I meant iteration
<Drup>
Don't fear the state.
<def`>
Denommus: I found it much easier in ocaml, but still getting FRP right is hard
<Drup>
(would make a good blog title)
<def`>
maybe it'snjust of matter of taste, I should give a second try in haskell
tidren has joined #ocaml
NoNNaN has joined #ocaml
ggole has quit []
<Denommus>
def`: there's a FRP game engine for Haskell. It's quite cool and easy. The only problem is memory consumption. I tried to bring it down, without success
<def`>
Denommus: yep in this respect, it was really easy to predict behaviors in ocaml
<Drup>
on the memory consumption side, React behaves ok
<Drup>
except when you use it in javascript, you have a small leak there
<Drup>
(because crappy javascript doesn't have proper weak pointers)
<def`>
(worst, there are weaktable proposal in es6, but it's just private symbols, not enough to implement weakpointers :()
ollehar has joined #ocaml
philtor has quit [Ping timeout: 260 seconds]
<Denommus>
meh
<Denommus>
speaking of which, is there a ocaml compiler for JS or anything of the sorts? That would be interesting
<companion_cube>
yes
<companion_cube>
js_of_ocaml
<Drup>
hey, I wouldn't say "in javascript" for an ocaml library otherwise :D)
<def`>
support is really good, whole language is covered
<def`>
(except weak pointers :))
<Denommus>
cool
<Drup>
there is an emulation for weak pointers
philtor has joined #ocaml
<Drup>
using non weak ones
<Drup>
(so, it leaks, obviously, but at least it works)
<Drup>
(and it doesn't leak too much)
tidren has quit [Remote host closed the connection]
Gonzih has quit [Ping timeout: 240 seconds]
rand000 has quit [Quit: leaving]
tidren has joined #ocaml
derek_c has joined #ocaml
philtor has quit [Ping timeout: 245 seconds]
tidren has quit [Remote host closed the connection]
philtor has joined #ocaml
t4nk892 has joined #ocaml
<t4nk892>
Hi guys, my name is Steve and I´m doing a project using OCaml. I´m a beginner so sorry for my ignorance on the subject, but I really need some help after having googled this for about a day and the interwebs have not turned up much :) How do I change a String Map into a list of [(key, value), ...] using Map.fold?
<t4nk892>
if someone could push me in the right direction that´d be great
mort___ has joined #ocaml
<Drup>
you sure you want to do it with fold ? (It's an exercise, I presume ?)
<Drup>
Otherwise, Map.bindings do what you want
tidren has joined #ocaml
derek_c has quit [Ping timeout: 250 seconds]
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
<t4nk892>
not sure i want to do it with fold, that´s just something I thought would help
<t4nk892>
how would I do it with Map.bindings?
<Drup>
what is the name of your map module ?
<t4nk892>
module MMap = Map.Make (String);;
tidren has quit [Remote host closed the connection]
NoNNaN has quit [Ping timeout: 264 seconds]
<Drup>
then "MMap.bindings my_little_map"
<Drup>
it's still a good exercise to define it with a fold yourself, though :p
<companion_cube>
learning how to do it with fold is interesting
<t4nk892>
hehe thank you so much that worked perfectly :)
<t4nk892>
using bindings
<t4nk892>
i´m going to try implementing with fold myself, I tried to find an example online but nothing came up
tidren has joined #ocaml
bo1 has left #ocaml [#ocaml]
derek_c has joined #ocaml
gal_bolle has quit [Ping timeout: 264 seconds]
philtor has quit [Ping timeout: 255 seconds]
arquebus has joined #ocaml
ollehar has quit [Ping timeout: 250 seconds]
t4nk892 has quit [Ping timeout: 246 seconds]
troutwine_away is now known as troutwine
tidren has quit [Remote host closed the connection]
demonimin has quit [Ping timeout: 256 seconds]
englishm has joined #ocaml
englishm_ has joined #ocaml
t4nk946 has joined #ocaml
englishm has quit [Ping timeout: 240 seconds]
troutwine is now known as troutwine_away
philtor has joined #ocaml
darkf has joined #ocaml
philtor has quit [Ping timeout: 245 seconds]
philtor has joined #ocaml
tidren has joined #ocaml
Armael has quit [Quit: WeeChat 0.4.2]
Armael has joined #ocaml
Armael has quit [Client Quit]
madroach has quit [Ping timeout: 250 seconds]
madroach has joined #ocaml
Armael has joined #ocaml
arquebus has quit [Quit: Konversation terminated!]