jhaberstro has quit [Read error: Connection reset by peer]
jhaberstro has joined #ocaml
matason has joined #ocaml
mk270 has quit [Remote host closed the connection]
zump has joined #ocaml
<zump>
I installed the core and utop as required by the real world ocaml tutorial. Now when I go into ocaml REPL, i type "3+10;;" and it just hangs.. WTF?
<kakadu>
You can create dummy(empty) init file and pass it to 'ocaml -init myinit'
<kakadu>
and test it there
<kakadu>
and after that you can add some lines to new init file
<kakadu>
to check which line of your init file causes a problem
<zump>
i upgraded camlp4 from github and it workes now
<zump>
now i get a bunch of crap about "disagree over interface" argh (expected i guess)
AlexRussia has quit [Ping timeout: 245 seconds]
<kakadu>
I strongly recommned you to recompile OCaml using opam with command 'opam switch 4.02.1', AFAIR
ygrek has quit [Ping timeout: 256 seconds]
<zump>
then i can install camlp4 from OPAM?
OnkV is now known as Haudegen
<kakadu>
yes, and core too
Haudegen is now known as Guest8468
Guest8468 is now known as Haudegen
lewis1711 has joined #ocaml
jhaberstro has quit [Quit: jhaberstro]
<lewis1711>
been trying to get ocaml set up for the past few hours. a lot of compiling has happened, but I still cant get ctypes working
<lewis1711>
The dependency base-bytes of package ctypes.0.3.3 is not available for your compiler or your OS.
<lewis1711>
'opam install ctypes' failed.
<kakadu>
which ocaml version?
<lewis1711>
4.02.0
<kakadu>
It's better to switch to next bugfix release 4.02.1 btw
<lewis1711>
fair enough
ygrek has joined #ocaml
pyon-faithful is now known as pyon-free
kapil__ has joined #ocaml
<kakadu>
It installs ctypes for me
<kakadu>
maybe your opam repe is not updated? 'opam update'
<kakadu>
repo*
<lewis1711>
kakadu: It errored out on opam update, with quite a few of them
<lewis1711>
I managed to install ctypes after I switched to 4.02.1 as suggested
<kakadu>
So, let's say that problem fixed? :)
<lewis1711>
not sure. installing utop and core now
thomasga has joined #ocaml
milosn has quit [Remote host closed the connection]
AlexRussia has joined #ocaml
pyon-free is now known as pyon-cofree
<lewis1711>
I don't understand why opam installs ocamlfind again and again
<lewis1711>
every second command it's re-installing ocamlfind
<kakadu>
sounds weird
<kakadu>
maybe you forgot to do eval `opam config env`
<kakadu>
need to see some your output, anyway
<lewis1711>
do I need to do that every time before I do anything opam?
<lewis1711>
if so that explains a lot
Simn has joined #ocaml
<kakadu>
You should do it once at the beginning of shell session
<kakadu>
I have put this into ~/.zshrc
<lewis1711>
I've kept the same terminal open
<lewis1711>
I thought that getting opan gives you the option to to put into your .bashrc or zshrc or whatever, but I just checked what was in there
<lewis1711>
eval `opam config env` wasn't, so I added it in
<kakadu>
It's easier to me to make alias for this called 'evalopam' and exec when I need it
<lewis1711>
the ctypes module looks really nice. main reason I want to give ocaml a shot.
<kakadu>
maybe
<kakadu>
Do you know if that allow you to call methods of C++ classes?
<lewis1711>
hmm I haven't checke
ygrek has quit [Ping timeout: 240 seconds]
<lewis1711>
things seem to be working finally. thanks for the tips kakadu
ygrek has joined #ocaml
<kakadu>
sya
<kakadu>
cya*
<lewis1711>
wow utop is really sluggish sometimes. took about 2 seconds to return the prompt after I wrote "true;;". I wonder if it's trying to compile to machine code instead of using the bytecode VM
milosn has joined #ocaml
<kakadu>
Don't think so
<kakadu>
you need ocaml native toplevel for that
<kakadu>
I prefer just 'rlwrap ocaml' btw
jhaberstro has joined #ocaml
<nicoo>
lewis1711: This is very surprising. Do you have Core-related things automagically loaded?
<kakadu>
nicoo: very likely
<lewis1711>
nicoo: yes I do. is that the issue?
<lewis1711>
pretty much been following real world ocaml, unless I came across problems
davine has joined #ocaml
<kakadu>
I think that even with core it should not work so long
<nicoo>
lewis1711: Well, I never read RWO, but Core isn't really known for being lightweight. Even then, it seems long
<lewis1711>
it's long the first time I declare a type
<lewis1711>
then after subsequent invocations, it's fast
tane has joined #ocaml
<nicoo>
'kay. Strange
<lewis1711>
just did a count in my head, about 4 seconds on a fresh utop session to evaluate "true"
<zump>
hey lewis1711 i found that its really slow in the first command entered..
ygrek_ has joined #ocaml
ygrek has quit [Remote host closed the connection]
<kakadu>
It seems it loads modules lazily..........
<lewis1711>
hmmm it will straight up freeze on bad syntax
<lewis1711>
might just stick to rlwrap ocaml
<zump>
whats rlwrap ocaml
<lewis1711>
I'm sure I remember it being faster and less buggy last time I installed it a few months back.
<lewis1711>
something probably went wrong with the voodoo of opam
<lewis1711>
too tired now
<kakadu>
maybe we should report it
<lewis1711>
kakadu: it's probably my fault. got impatient and opam is fussy
<kakadu>
While your were hacking opam I have had hard time with compiling popcorn-time
<kakadu>
this npm stuff is weird
<kakadu>
I execute command, it returns 1 and prints nothing
<zump>
Does anyone like FRAMA C
<kakadu>
I don't know anything how to debug it
<kakadu>
That's why I think that opam is fine :)
<Drup>
the initial sluginesh of utop is known, but I don't know the cause
<Drup>
kakadu: no C++ with ctypes
<Drup>
lewis1711: are you using aspcud ?
<lewis1711>
Drup: no clue. I'll install it. (couldn't get it working on arch if you remember me from a few hours ago btw, using an ubuntu partition)
<Drup>
yeah, use aspcud, it's much better with it
<lewis1711>
how do you mean "use"?
<lewis1711>
I mean it's installed now
<Drup>
opam will use it automatically if it's installed
<lewis1711>
hmmm, still chokes on "utop # List.map [1; 2] (* 3);;"
<lewis1711>
will I need to reinstall utop?
<kakadu>
I don't think that aspcud is related to utop issues
<Drup>
no, it was releated to the "install ocamlfind all over again"
<lewis1711>
ahh
manud__ has quit [Quit: Be back later ...]
ygrek_ has quit [Remote host closed the connection]
ygrek has joined #ocaml
<zump>
lewis1711: wtf! Just tried that code and utop just hangs..??
<kakadu>
It doesn't
<kakadu>
is sees comments and waits for the end of comments
<pyon-cofree>
The types "type 'a foo = <head: 'a; tail: 'b> as 'b;;" and "type
<pyon-cofree>
And "type 'a bar = <head: 'a; tail: <head: 'a; tail: 'b> > as 'b" are the same, right?
<lewis1711>
kakadu: don't know why I didn't think of that. I think F# had some syntax sugar where you could do a similar expression and I was messing around
zump has quit [Quit: Page closed]
ygrek has quit [Ping timeout: 258 seconds]
zwer has quit [Remote host closed the connection]
zwer has joined #ocaml
<kakadu>
You can also can give a show ocaml-top
<kakadu>
s/show/shot/
BitPuffin has joined #ocaml
ygrek has joined #ocaml
lewis1711 has quit [Quit: Konversation terminated!]
Submarine has quit [Quit: Leaving]
nadako has joined #ocaml
ggole has joined #ocaml
jhaberstro has quit [Quit: jhaberstro]
mk270 has joined #ocaml
mk270 has quit [Ping timeout: 240 seconds]
mk270 has joined #ocaml
davine has quit [Quit: Leaving]
huza has joined #ocaml
rand000 has joined #ocaml
Whitticker has joined #ocaml
jbrown has joined #ocaml
AlexRussia has quit [Ping timeout: 250 seconds]
AlexRussia has joined #ocaml
chambart has joined #ocaml
kakadu has quit [Quit: Konversation terminated!]
kakadu has joined #ocaml
keen____ has joined #ocaml
BitPuffin has quit [Ping timeout: 250 seconds]
keen___ has quit [Ping timeout: 258 seconds]
pyon-cofree is now known as pyon
ChristopheT has joined #ocaml
davine has joined #ocaml
huza has quit [Ping timeout: 264 seconds]
chambart has quit [Ping timeout: 256 seconds]
mcclurmc has joined #ocaml
dav_ has joined #ocaml
dav has quit [Ping timeout: 255 seconds]
mcclurmc has quit [Ping timeout: 265 seconds]
milosn has quit [Quit: Lost terminal]
chambart has joined #ocaml
<MercurialAlchemi>
I'd like to randomly praise 'opam pin'
<MercurialAlchemi>
that's really awesome
chambart has quit [Ping timeout: 244 seconds]
chambart has joined #ocaml
thomasga has quit [Quit: Leaving.]
chambart has quit [Ping timeout: 245 seconds]
q66 has joined #ocaml
_5kg has quit [Ping timeout: 255 seconds]
<hannes>
how would I hook custom actions to lambda-terms readline functionality? (I'd like to consume some key presses for other actions than shell stuff)
<Drup>
hannes: you create a class than inherites the readline widget and overwrite the right class
<Drup>
the right method*
<hannes>
Drup: aha.. thanks! you're aware of some concrete code samples on the internetz?
<Drup>
hannes: there are examples in lambda-term sources, I think
<hannes>
yeah... I'm that far already.. will dig further, thx!
kapil__ has quit [Quit: Connection closed for inactivity]
<hannes>
ah, there's even a `bind` provided by lTerm_read_line.mli
darkf has quit [Quit: Leaving]
lu324___ has joined #ocaml
lu324__ has quit [Ping timeout: 244 seconds]
expo873 has joined #ocaml
lordkryss has joined #ocaml
pgomes has joined #ocaml
_5kg has joined #ocaml
BitPuffin has joined #ocaml
<MercurialAlchemi>
I need to tell OCaml to tell when a given float is equivalent to an integer (eg, 1.)
<adrien>
epsilon
<adrien>
val epsilon_float : float
<adrien>
The difference between 1.0 and the smallest exactly representable
<MercurialAlchemi>
(well, = is there for safety reason, and I have to combine it with abs_float)
<struktured>
ggole: isn't that kind of expesenive though?
<ggole>
What do you propose?
<adrien>
MercurialAlchemi: which precision do you need/want?
<MercurialAlchemi>
adrien: technically? the same precision that %F uses to decide when X.Y should be printed as X.
<MercurialAlchemi>
in practice, modf x |> fst |> abs_float <= epsilon_float should work, I think
<struktured>
ggole: let equal_precision ~epsilon a b = abs_float (a-.b) < epsilon
<ggole>
That is an equality test. Not an "is-integral" test.
<struktured>
ggole: yeah but use that with floor function of the value and the original value, and epsilon = episolon_float. then its not doing any mod arithmetic
<ggole>
I don't think that will actually work on large values, though.
<struktured>
ggole: what becomes inaccurate as the values become large?
<ggole>
let test x = equal_precision epsilon_float x (floor x)
<ggole>
test 1000000000000.000001;; - : bool = true
<ggole>
Hmm, but maybe that's actually integral.
<MercurialAlchemi>
ggole: modf is just as unhappy with this one
<whitequark>
struktured: "if let p = e then x" ≡ "match e with p -> x | _ -> ()"
<struktured>
whitequark: ah I see, thanks.
<gasche>
indeed, it looks like a nested match in this case
<gasche>
and the nested match is more readable
<ggole>
I wonder if the "ref" is problematic
<gasche>
but still "if let" is not a bad idea
<mrvn>
or: try let p = e in x with Match_error -> ()
<whitequark>
yes, I think it is in the same domain as "match with exception"
<gasche>
well (ref p) should be a pattern in OCaml, equivalent to {contents = p}
<ggole>
That would be nice. We have lazy patterns, refs are probably more common.
<whitequark>
is ref a keyword?
<gasche>
on the other hand, beginners that write "let ref x = 1" would scream to death about the error messages
<ggole>
No.
<whitequark>
so it can't be a pattern
<ggole>
It's just a function let ref contents = { contents }
<gasche>
this syntax used to work in Caml light, which had mutable constructor arguments
<gasche>
(but we're probably better off without them still)
<ggole>
Er, doesn't 4.03 add those?
BitPuffin has quit [Ping timeout: 264 seconds]
<ggole>
Unless there's some distinction.
<gasche>
only in named argument positions, which doesn't allow you to implement "ref" as it was in Caml Light
<whitequark>
not for regular constructors
<gasche>
basically (type 'a ref = ref of mutable 'a)
<ggole>
Ah.
expo873 has quit [Quit: Connection closed for inactivity]
<gasche>
and people would write stuff like (match foo with ref x -> (x <- x + 1)), the horror
<ggole>
That's a bit off-putting.
<gasche>
on the other hand whitequark
<gasche>
beginners complain about the if-without-else when they write a rhs with type other than unit
<gasche>
if-let would have the same problem
thomasga has joined #ocaml
<whitequark>
sure
<gasche>
also a better expansion would be
<gasche>
match ... with ... -> ... | _ -> default
<gasche>
with
<gasche>
class Default a where default :: a
<ggole>
Is that actually better?
<whitequark>
mmmm, assuming implicits get merged
<gasche>
ggole: it's better as soon as you use monads rather than the unit type
<whitequark>
PR6685
<ggole>
I'm more concerned about what happens to ordinary values
<ggole>
Somebody adds a Default instance for Int and all of a sudden there are magic zeros in your program.
<ggole>
It's probably very convenient, but blargh.
<gasche>
hm
<gasche>
alternatively, you could have (return ()) be the default case
<Drup>
whitequark: not 666 :(
<gasche>
(or (pure ()), whatever)
<ggole>
Wouldn't that fail to unify with regular ()?
<ggole>
I guess that wouldn't matter if you were all-monads-all-the-time.
<Drup>
whitequark: if let sounds easy to do with a ppx, but meh
<whitequark>
it does not, surely
BitPuffin has joined #ocaml
<Drup>
?
<whitequark>
well, maybe if [%let? patt] = x then, but this is really ugly
<Drup>
yes, that's what I was thinking
<gasche>
ggole: the type-checker would have to be smart enough to see that (Monad m => m unit) unifies with (unit) for the identity monad
<Drup>
hence "meh"
<Drup>
easy, but meh.
<ggole>
You can add syntax until the cows come home, really.
<gasche>
? was added to ppx when I mentioned the use-case of rwjones's pa_matches syntax extension
<ggole>
I've wanted if x = Foo (_, 1) then ... a few times.
<gasche>
if [%matches? p] e then ... else ..
<Drup>
gasche: yes, I was thinking about that too.
<gasche>
this is almost reasonable because it is a local transformation
<whitequark>
oh, that's not bad
<ggole>
Mmm, that might be nicer than if (match x with Foo (_, 1) -> true | _ -> false) then ...
<gasche>
whereas if-let adds an environment to the then-case, making it a primitive construct
<gasche>
(on the other hand of course naming thing is one of the strengths of if-let compared to matches?)
<SuperNoeMan>
Unhammer: oh ok. Does ocsigen eliom facilitate construction of RPC mechanisms? I have things thing where I want to be able to call a function from another language or machine
<mrvn>
you don't just want to see if it matches but also use the match.
<SuperNoeMan>
I've got the part about data serialization-I am using piqi, which compiles to protobuf
<SuperNoeMan>
But right now, I'm sort of... selecting the function by manually writing on the RPC server side what functions are available and selecting them with an integer
<whitequark>
should I write ppx_matches?..
<Drup>
No
<gasche>
whitequark: I think it's a bad idea if the pattern variables are bound in the "then" case
<whitequark>
gasche: I don't think they would be
<gasche>
then feel free to
<ggole>
You would disallow variables, surely
<whitequark>
(and it's easy to make them not to?)
<Drup>
It sounds easy to make them not to, yeah
<Drup>
my "opposition" is sort of different
<gasche>
well
<Drup>
the same I have about ppx_type_notrec
<gasche>
[%matches? p] should expand to (function p -> true | _ -> false)
<gasche>
also, after looking at the occurences of "_ -> ()" in some codebase, I have a suggestion that I prefer over if..let
<gasche>
match .. with default -> ... | ...
<Drup>
I don't feel like such comodities should be a macro
<whitequark>
gasche: default isn't a keyword I think?
<gasche>
(the problem is "default" which is a valid identifier, and I don't think "_" is a good idea)
<companion_cube>
o/
<Drup>
SuperNoeMan: RPC inside your eliom program is handle almost transparently
<gasche>
in particular (if let p = e then foo) would be (match e with default -> () | p -> e)
<gasche>
but this also handles multi-case matches and non-unit types
<gasche>
it just follows the "shorter case first" principle for pattern-matching
<gasche>
(it's really tempting to use "_" instead of "default" but also a bad idea I think)
<ggole>
gasche: what's the difference between default and _, exactly?
<gasche>
default means "at the end I'm _"
<gasche>
but it comes first
<gasche>
so it gives better code in the cases where the default case is much shorter than the other
<gasche>
in particular, you can write it on the same line as "with", with a "|" before
<ggole>
Hrm, I see
<gasche>
s/with/without/
Hannibal_Smith has joined #ocaml
Whitticker has quit [Quit: Leaving]
<gasche>
y lies madness)
Thooms has joined #ocaml
<gasche>
(another way to do this would be to specify that more-specific patterns are always tested first, with a top-to-bottom order only on incomparable patterns, but this wa
<companion_cube>
btw gasche, maybe you know: is there something in the compiler to check whether a type is recursive?
<ggole>
One of the earlier pattern matching languages did that IIRC
<gasche>
I'm not sure what you mean
<gasche>
do you have some context, companion_cube?
<gasche>
whitequark: what do you think of "with default" vs. "if let" ?
romildo has joined #ocaml
<companion_cube>
gasche: many ppx_deriving instances need to know, when generating a function for a type t, whether t is recursive
<companion_cube>
because the function will be recursive or not as well
<gasche>
can't you make it recursive each time?
<companion_cube>
it's ugly (warning 39) and no, not in my case, I have specific combinators for fixpoints
<companion_cube>
currently I use a hack :>
<companion_cube>
if you're interested, I write ppx_deriving_cconv
<gasche>
so I don't know; and I suspect it would be at the typedtree level anyway, while I suppose you work on asttree
<gasche>
cconv?
<companion_cube>
I work on parsetree, indeed
<companion_cube>
the "universal conversion" thingie
<whitequark>
gasche: "with default" would be very nice
<whitequark>
but I think the keyword thign makes it problematic
<gasche>
what about
<gasche>
(match e with -> e_default | ...)?
igstan has joined #ocaml
igstan has quit [Client Quit]
<gasche>
(I feel dirty)
<Drup>
is there a reason not [%default] ?
oscar_toro has joined #ocaml
<whitequark>
ew
<gasche>
I suspect the keystrokes are expansive here
<gasche>
*expensive
<whitequark>
[%default], huh
<Drup>
gasche: [%default] is probably less keystrokes on average than e_default
<gasche>
not for () at least
<Drup>
not even talking about the cases where you match on an expression, not an identifier
<gasche>
if the default-case rhs is so large, it *should* go at the end of the matching
<Drup>
(or I don't understand what you mean by "e_default"
<gasche>
any expression
<Drup>
Oh.
<gasche>
(if let <p> = <e> then <e'>) => (match <e> with -> () | <p> -> <e'>)
<ggole>
e isn't necessarily an identifier, though
<pippijn>
Drup: [%] is expensive for me
sheijk has joined #ocaml
<gasche>
hi pippijn!
<pippijn>
it's RAlt+8, Shift+5, RAlt+9
<pippijn>
hi gasche
<Drup>
pippijn: same here
<gasche>
(in pratice the "| <p> -> <e'>" part is expected to go on its own line most of the time)
<Drup>
not the same numbers, but still
<pippijn>
would be better on english programmer dvorak, but I'm used to german normal dvorak (II)
MercurialAlchemi has quit [Ping timeout: 255 seconds]
<gasche>
how's life at Google?
<pippijn>
busy
<pippijn>
and fast
<pippijn>
my life here passes by much faster than in paris
<struktured>
companion_cube: is there something like this in CCOpt already that I missed? "let get_lazy f t = match t with Some t -> t | None -> f () end"
<gasche>
pippijn: you may be interested in knowing that I've worked a bit with def-lkb on his Menhir patches for incrementality and error reporting
<pippijn>
ah, in what direction?
<gasche>
we may get them upstream eventually, but I think def-lkb is too busy right now
<SuperNoeMan>
Drup: I just want RPC capability in ocaml
<SuperNoeMan>
the best way possible
<Drup>
SuperNoeMan: did you look at what I linked you ?
<pippijn>
I have failed in (and given up on) getting mine upstream
<SuperNoeMan>
Yeah just now opened it
<gasche>
the direction was to get upstream whatever features were necessary to play with error reporting
<SuperNoeMan>
Is there a way to use piqi
<SuperNoeMan>
and serialize to whatever format I want?
<pippijn>
all you need is stuff in the exception object
<pippijn>
token/state pairs
<companion_cube>
struktured: I don't think so (not the lazy part)
<Drup>
SuperNoeMan: why do you care ? eliom handles the serialization for you.
<pippijn>
it's about 10 lines diff, I think
<pippijn>
for error reporting, that's all
<gasche>
yes and no
<pippijn>
for specific error recovery, it's a bit more
<gasche>
exactly
<gasche>
def-lkb's work allows to inspect the parsing stack, which allows for more error reporting techniques
matason has quit [Quit: Leaving...]
<pippijn>
does it hook into the parser or does the exception carry the stack?
<gasche>
he adds a step-by-step execution interface to the parser
<pippijn>
ah
<pippijn>
push parsing
<gasche>
meaning the user can react to parser transitions (failure in particular)
<pippijn>
nice
<gasche>
which is also useful for Merlin's handling of incrementality
<pippijn>
I like that
matason has joined #ocaml
<gasche>
well I think it'll take a few more months because we're all busy on something else, but I hope we can get this upstream
<pippijn>
sounds good
tane has quit [Quit: Verlassend]
<companion_cube>
whitequark: so, with ppx_deriving_cconv, which seems to start working, encoding/decoding to/from sexplib and bencode should now be possible!
<whitequark>
cool
<Drup>
SuperNoeMan: we agree you want to call, from the client written in OCaml, a server side OCaml function written by you, right ?
<Drup>
basically, you say that fpclass is an alias of Pervasive.fpclass *and* you give the definition, so that the constructors are defined in the module too.
<struktured>
oh that seems pretty useful. I suppose as a side effect it ensures that the assignments are sound at compile time, so that helps maintain the relationship.