adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.02.2 announced http://ocaml.org/releases/4.02.html | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
jao has quit [Ping timeout: 272 seconds]
<ollehar> nm, asked on stackoverflow
jeffmo has joined #ocaml
nullcatxxx_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
AltGr has joined #ocaml
sepp2k has quit [Quit: Leaving.]
mcclurmc has joined #ocaml
empyrean has quit [Remote host closed the connection]
empyrean has joined #ocaml
igoroliveira has quit [Quit: Connection closed for inactivity]
rgrinberg has joined #ocaml
empyrean has quit [Remote host closed the connection]
antkong has quit [Quit: antkong]
tmtwd has joined #ocaml
rand___ has quit [Quit: leaving]
ollehar has quit [Remote host closed the connection]
kandu has quit [Remote host closed the connection]
kandu has joined #ocaml
kandu is now known as Guest73112
Guest73112 is now known as kandu
empyrean has joined #ocaml
Algebr has joined #ocaml
<Algebr> Is it possible to create a signature for a module but then still be able to add and have other functions in the module still be exported?
<Algebr> Like have a module implement a module signature but still have more exported as well.
<Drup> sig inlude S .... end
<Algebr> didn't know include also worked with module types as well
tmtwd has quit [Ping timeout: 256 seconds]
rgrinberg has quit [Ping timeout: 255 seconds]
empyrean has quit [Ping timeout: 264 seconds]
darkf has joined #ocaml
mac10688 has quit [Ping timeout: 272 seconds]
samrat has joined #ocaml
shinnya has quit [Ping timeout: 272 seconds]
kushal has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
rgrinberg has joined #ocaml
MercurialAlchemi has joined #ocaml
rgrinberg has quit [Ping timeout: 250 seconds]
Algebr has quit [Ping timeout: 240 seconds]
Algebr has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 264 seconds]
rgrinberg has joined #ocaml
samrat has quit [Ping timeout: 250 seconds]
rgrinberg has quit [Ping timeout: 255 seconds]
mea-culpa has quit [Read error: Connection reset by peer]
contempt has quit [Disconnected by services]
contempt has joined #ocaml
tnguyen has quit [Read error: Connection reset by peer]
tnguyen has joined #ocaml
Algebr has quit [Remote host closed the connection]
ggole has joined #ocaml
slash^ has joined #ocaml
rgrinberg has joined #ocaml
rgrinberg has quit [Ping timeout: 246 seconds]
jeffmo has quit [Ping timeout: 250 seconds]
jeffmo has joined #ocaml
ely-se has joined #ocaml
octachron has joined #ocaml
nyon has quit [Ping timeout: 250 seconds]
jeffmo has quit [Read error: Connection reset by peer]
jeffmo_ has joined #ocaml
sh0t has joined #ocaml
<johnf> hi, is there a good a way to check two variables have the same type?
<johnf> I have some sort of very verbose match x with | match x ... pattern now but thought there might be something better I missed.
<ely-se> what should happen if they do not have the same type?
<ely-se> let x: T = y will error if they have incompatible types. I don't think you can do better than that
<ely-se> uh, let mutable x = y; x <- z
<johnf> its a branch statement, if equiv then ... else ...
<ely-se> types are only known at compile-time, so I don't think you can do that. it'd always be a constant expression
<johnf> where equiv is my x ~ y type equality check
rgrinberg has joined #ocaml
<johnf> hmm I think it works out with some nested match ... with statements.
<ely-se> match can't compare types
<zozozo> johnf: what do your code looke like ?
<ely-se> it can only compare values to patterns
oscar_toro has joined #ocaml
<johnf> ely-se, I have something like this 'type basic = | ref of string | value of int | ... '
<ely-se> ooh you want to compare whether both values are constructed with the same constructor?
<johnf> what I was trying to figure out is how people do the type inference. And then I run into a state where I need to check to see if you don't use the same variable and try to have it has two different types
rgrinberg has quit [Ping timeout: 250 seconds]
<johnf> ely-se, yeah that would do it.
<zozozo> johnf: you can do pattern matching on tuples instead of nested patter matching, for instance, match x,y with | ref s, ref s' -> ... | ...
<ely-se> I think you can't do better than this: https://gist.github.com/rightfold/14f509d4fa39b66fe5eb
AlexRussia has quit [Ping timeout: 246 seconds]
<johnf> zozozo, ah yeah of course that is better than my nested match statement, at least more compact.
<ely-se> those are called constructors, not types
<ely-se> "basic" is the type here
pyon has joined #ocaml
<johnf> ely-se, ah thanks sorry for the confusion.
<johnf> ely-se, that sample is what I was looking for.
<ely-se> 'ref "x"' and 'value 42' have the same type
<johnf> in this example ref and value are constructors
<ely-se> yep
<johnf> is there a way to see if just the constructor is equal? I'm just playing around with this seeing if I can make it more compact
pyon is now known as nyon
<ely-se> if you do this only once, write a match on tuples
<ely-se> if you need to do this for a lot of different types, you should probably write a code generator
<flux> johnf, I guess the way would be to write a plugin to ppx_deriving..
Haudegen has quit [Ping timeout: 252 seconds]
<johnf> flux, thanks I'll take a look
slash^ has quit [Read error: Connection reset by peer]
Haudegen has joined #ocaml
<ggole> Abstraction over patterns is needed here, really
<ely-se> Piet is my favourite abstract programming language.
ely-se has quit [Quit: leaving]
ely-se has joined #ocaml
zpe has joined #ocaml
nullcatxxx_ has joined #ocaml
sh0t has quit [Ping timeout: 264 seconds]
ely-se has quit [Quit: leaving]
ely-se has joined #ocaml
rgrinberg has joined #ocaml
ontologiae has joined #ocaml
ygrek has joined #ocaml
rgrinberg has quit [Ping timeout: 252 seconds]
schoppenhauer has quit [Ping timeout: 255 seconds]
johnf has quit [Read error: Connection reset by peer]
Submarine has joined #ocaml
ontologiae has quit [Ping timeout: 272 seconds]
nullcatxxx_ has quit [Quit: gone...]
nullcatxxx_ has joined #ocaml
ygrek has quit [Ping timeout: 264 seconds]
schoppenhauer has joined #ocaml
rgrinberg has joined #ocaml
rgrinberg has quit [Ping timeout: 252 seconds]
rand__ has joined #ocaml
teiresias is now known as cbrannon
cbrannon has quit [Changing host]
cbrannon has joined #ocaml
ely-se has quit [Quit: leaving]
cbrannon is now known as teiresias
teiresias has quit [Changing host]
teiresias has joined #ocaml
ollehar has joined #ocaml
nyon has quit [Quit: F...ix you... something other than Emacs.]
Kakadu has joined #ocaml
pyon has joined #ocaml
mort___ has joined #ocaml
LnL has joined #ocaml
ely-se has joined #ocaml
ygrek has joined #ocaml
<ollehar> no LLVM wrapper function for gcwrite or gcroot?
<ollehar> whitequark did the ocaml llvm library, right?
mort___ has left #ocaml [#ocaml]
rgrinberg has joined #ocaml
tane has joined #ocaml
rgrinberg has quit [Ping timeout: 250 seconds]
pyon is now known as nyon
Kakadu has quit [Ping timeout: 246 seconds]
xikuuky has joined #ocaml
Hetu has joined #ocaml
sepp2k has joined #ocaml
_andre has joined #ocaml
zaquest has quit [Ping timeout: 256 seconds]
zaquest has joined #ocaml
nullcatxxx_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
jeffmo_ has quit [Ping timeout: 246 seconds]
monod has joined #ocaml
ely-se has quit [Quit: leaving]
ely-se has joined #ocaml
<Leonidas> ollehar: he maintains the llvm ocaml bindings, yes.
* Leonidas hat lots of problems getting them to run on windows, which is mostly windows' fault.
slash^ has joined #ocaml
<ollehar> and I guess he's a busy man?
ely-se has quit [Quit: leaving]
Kakadu has joined #ocaml
<ollehar> ok, there's an ocaml-llvm compiler, guess I could look into that for tips.
<ollehar> even if it's 4 years old ><
jbrown has quit [Remote host closed the connection]
jbrown has joined #ocaml
ely-se has joined #ocaml
<Drup> ollehar: whitequark did a version of it too
<Drup> ask him
<Drup> not sure if he's following stack overflow
<ollehar> Drup: ah cool, will check out his git
<ollehar> yeah, I'm having huge problems with this. but babysteps...
<Leonidas> ollehar: the issue was that starting with 3.6 the bindings use ctypes and getting this to work with ocaml and llvm on windows is hard.
<ollehar> Leonidas: ok
<ollehar> afraid I can't help you
<Leonidas> no worries, I just stopped caring about windows.
oscar_toro has quit [Ping timeout: 256 seconds]
uu has quit [Ping timeout: 250 seconds]
xikuuky has quit [Ping timeout: 265 seconds]
xikuuky has joined #ocaml
xikuuky has quit [Client Quit]
ely-se has quit [Quit: leaving]
ely-se has joined #ocaml
Leonidas is now known as Leonidas_
Leonidas_ is now known as Leonidas
Haudegen has quit [Ping timeout: 240 seconds]
BitPuffin has joined #ocaml
nullcatxxx_ has joined #ocaml
rgrinberg has joined #ocaml
psy_ has quit [Ping timeout: 256 seconds]
ely-se has quit [Quit: leaving]
rgrinberg has quit [Ping timeout: 240 seconds]
Haudegen has joined #ocaml
jao has joined #ocaml
monod has quit [Ping timeout: 250 seconds]
ontologiae has joined #ocaml
ely-se has joined #ocaml
<ollehar> package llvm_X86 not found? anyone knows about that package?
<ollehar> hm, maybe a typo in the config
Haudegen has quit [Remote host closed the connection]
AltGr has left #ocaml [#ocaml]
Haudegen has joined #ocaml
Kakadu has quit [Quit: Page closed]
Haudegen has quit [Ping timeout: 250 seconds]
jeffmo has joined #ocaml
ely-se has quit [Quit: leaving]
rgrinberg has joined #ocaml
Haudegen has joined #ocaml
jeffmo_ has joined #ocaml
jeffmo has quit [Ping timeout: 255 seconds]
jeffmo has joined #ocaml
Kakadu has joined #ocaml
jeffmo__ has joined #ocaml
jeffmo_ has quit [Ping timeout: 255 seconds]
jeffmo_ has joined #ocaml
jeffmo has quit [Ping timeout: 246 seconds]
jeffmo has joined #ocaml
jeffmo__ has quit [Ping timeout: 256 seconds]
jeffmo_ has quit [Ping timeout: 246 seconds]
octachron has quit [Quit: Leaving]
ely-se has joined #ocaml
tizoc has quit [Ping timeout: 260 seconds]
ygrek has quit [Ping timeout: 240 seconds]
tizoc has joined #ocaml
ygrek has joined #ocaml
Hetu has quit [Ping timeout: 265 seconds]
pmderodat has joined #ocaml
mcclurmc has joined #ocaml
Topher512 has joined #ocaml
empyrean has joined #ocaml
ely-se has quit [Quit: leaving]
MercurialAlchemi has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
xet7 has joined #ocaml
mcclurmc has joined #ocaml
jeffmo has quit [Read error: Connection reset by peer]
lolisa has joined #ocaml
ely-se has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
lolisa has quit [Client Quit]
ontologiae has quit [Ping timeout: 246 seconds]
mcclurmc has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
fluter has quit [Ping timeout: 252 seconds]
andrewalker has quit [Quit: leaving]
mcclurmc has joined #ocaml
zpe has quit [Remote host closed the connection]
ygrek has quit [Ping timeout: 256 seconds]
jeffmo has joined #ocaml
fluter has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
mcclurmc has joined #ocaml
Kakadu has quit [Quit: Page closed]
mcclurmc has quit [Remote host closed the connection]
Submarine has quit [Quit: Leaving]
ely-se has quit [Quit: leaving]
<nyon> whats the name of the ocaml bytecode interpreter process?
<nyon> s/process/program/
<companion_cube> ocamlrun
<nyon> ty!
psy has joined #ocaml
creichert has quit [Read error: Connection reset by peer]
johnf has joined #ocaml
psy has quit [Disconnected by services]
psy_ has joined #ocaml
struk|work has joined #ocaml
nullcatxxx_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
nullcatxxx_ has joined #ocaml
ely-se has joined #ocaml
nullcatxxx_ has quit [Client Quit]
nullcatxxx_ has joined #ocaml
jwatzman|work has joined #ocaml
empyrean has quit [Ping timeout: 255 seconds]
maurer is now known as maurer_
maurer_ is now known as maurer
<apache2> I have a list of ids
<apache2> | id :: _ | [id] ->
<apache2> is this the most compact way to extract the first id in the list using pattern matching, provided the list contains one or more entries?
<ggole> You don't need both of those, the first will do
<adrien> [ id ] is the same as id :: []
<ggole> And if you are quite certain the list is populated, you could use List.hd
<apache2> I'm not, that's why I do the pattern matching
<Drup> then you are missing the [] case
<apache2> I have that above
<apache2> if I do [id] I get a warning that I'm not matching
<apache2> Warning 8: this pattern-matching is not exhaustive.
<apache2> Here is an example of a value that is not matched:
<apache2> _::_::_
<apache2> | id :: ([] | _)
<apache2> this seems to do the trick
<Drup> apache2: _ already handles []
<enjolras_> | id :: _ -> Some id | [] -> None ?
<enjolras_> oh, one or more
<apache2> Drup: ah indeed you're right. id :: _ it is, thanks
<enjolras_> | id :: _ -> id | _ -> failwaith "kittens have died"
<enjolras_> but that's basically list.hd
<apache2> yeah, my [] just returns a Rresult error
<apache2> in the process of removing "failwith" messages from my prototype here
<Topher512> try List.hd ls with Failure x -> "Kittens have died" ?
* enjolras_ prefers match in this case
<apache2> I have two lists and need to return different error codes depending on which list is empty
<Topher512> I suppose it might help to understand the goal there
<enjolras_> catching Failure is good for printing log message but you have to match on strings if you want to distinguish
<apache2> so I think match is better there, but now it works -- thanks
<enjolras_> and matchin string is a miss practice imo
<apache2> yeah, I use variants (type errors = A | B)
<enjolras_> i mean, like it works, but let's say someone later replace ls with my_fun_returning_list ()
<apache2> that's called a variant, right?
<enjolras_> and this function raises failure
<enjolras_> apache2: or constructors
<enjolras_> it's really usually better fore long term readability to use match instead of catching Failure
<enjolras_> i see Failure as "something unexpected happened, abort the whole operation and log error with the Failure message"
darkf has quit [Quit: Leaving]
<Topher512> I would think finding the most compact way to do something implies sacrificing readability
<enjolras_> sounds like a bad tradeoff :)
JuggleTux has joined #ocaml
<Topher512> See perl for more details
<enjolras_> i'd rather not :D
Haudegen has quit [Ping timeout: 250 seconds]
<apache2> fine for 200 lines of code, Enjolras_, sucks for anything longer
<Topher512> I suspect we're trying to make the same point Enjolras_. But I think the original constrains of the question were that it should be the most compact way
Haudegen has joined #ocaml
nullcatxxx_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
average has joined #ocaml
average has left #ocaml [#ocaml]
Haudegen has quit [Ping timeout: 255 seconds]
john has joined #ocaml
john is now known as Guest28478
johnf has quit [Ping timeout: 250 seconds]
BitPuffin has quit [Ping timeout: 252 seconds]
dalastboss has joined #ocaml
<dalastboss> I'm trying to create a hashtable with custom key type using the core library
<dalastboss> I attempted to copy the example at the top of this page
<dalastboss> My code is thus http://pastebin.com/dmiqt14s
Haudegen has joined #ocaml
<dalastboss> Thats in temp.ml. But when I do Temp.Table.create it says Temp.Table not found
ollehar has quit [Ping timeout: 252 seconds]
<dalastboss> Oh, my mistake, the last line after comparable.make is a hashable.make
<dalastboss> ie "include Hashable.Make (T)"
<dalastboss> does anyone know why this doesnt work?
<dalastboss> this is the actual source http://pastebin.com/nkZSmhKc
<rks`> dalastboss: what doesn't work?
<dalastboss> I attempt to make a Hashtable with the call "Temp.Table.create () ~size:20"
<dalastboss> it says module Temp.Table not found
<dalastboss> the above being the source code for temp.ml
ncthom91 has joined #ocaml
<rks`> and you have no .mli?
<rks`> (and temp.cmi exists?)
<dalastboss> oh fuck
<dalastboss> need to update the signature
ontologiae has joined #ocaml
<dalastboss> rks`: working now!
<dalastboss> thanks a ton
<rks`> you're welcome
Submarine has joined #ocaml
Submarine has joined #ocaml
shinnya has joined #ocaml
nullcatxxx_ has joined #ocaml
Guest28478 has quit [Read error: Connection reset by peer]
pmderodat has left #ocaml ["WeeChat 0.3.9.2"]
dalastboss has quit [Ping timeout: 246 seconds]
samrat has joined #ocaml
kushal has quit [Quit: Leaving]
mort___ has joined #ocaml
jao has quit [Ping timeout: 252 seconds]
rgrinberg has quit [Ping timeout: 240 seconds]
<zol> wtf, how do you change keyboard layout on ubuntu these days? I want to be able to switch between se_SV and en_GB
<adrien> setxkbmap :P
Kakadu has joined #ocaml
* zol tries restarting gnome-terminal.
<sgeisenh> we should advise to write an OCaml wrapper for setxkbmap
<zol> Oh, sorry! I was asking in the wrong channel.
xet7_ has joined #ocaml
<ely-se> yes
<ely-se> you should be banned
xet7_ has quit [Read error: Connection reset by peer]
xet7_ has joined #ocaml
xet7 has quit [Ping timeout: 246 seconds]
Guest28478 has joined #ocaml
ollehar has joined #ocaml
yomimono has joined #ocaml
<companion_cube> let setxkbmap lang = system ("setxkbmap " ^ lang)
<companion_cube> there you are, ocaml binding :-)
rgrinberg has joined #ocaml
mort___ has quit [Quit: Leaving.]
psy_ has quit [Ping timeout: 268 seconds]
MercurialAlchemi has quit [Ping timeout: 246 seconds]
MercurialAlchemi has joined #ocaml
Guest28478 has quit [Read error: Connection reset by peer]
samrat has quit [Ping timeout: 240 seconds]
obadz has quit [Read error: Connection reset by peer]
obadz has joined #ocaml
<ollehar> what do you think about this idea: a string will be promoted to a string buffer during runtime if it's big enough.
<ollehar> and maybe to a rope if it's even bigger.
Guest28478 has joined #ocaml
<ggole> So string accesses involve branches to decide how to access the right storage? :/
<ollehar> ggole: hm? is that a comment on me or someone else?
<ollehar> oh wait, I understand.
<ollehar> yes, if it's in runtime, it would have to be that way. still O(1), though, right?
<ggole> I would expect that to suck a fair amount
<ollehar> hm
<ollehar> guess I would have to benchmark it.
<ollehar> thanks for your input.
ygrek has joined #ocaml
ontologiae has quit [Ping timeout: 265 seconds]
ontologiae has joined #ocaml
mort___ has joined #ocaml
malc_ has joined #ocaml
empyrean has joined #ocaml
ontologiae has quit [Ping timeout: 268 seconds]
ncthom91 has quit [Quit: Textual IRC Client: www.textualapp.com]
mort___ has quit [Quit: Leaving.]
Topher512 has quit [Quit: This computer has gone to sleep]
moei has quit [Quit: Leaving...]
nullcatxxx_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
enamex has joined #ocaml
<enamex> What is this " 'a list " syntax referring to in Ocaml? I know it's like the moral cousin of generics but just searching for "Ocaml generics" turns up a whole lot of nothing.
<ggole> ML family languages call it polymorphism.
<ollehar> +parametric
<ggole> The terminology isn't great either way, really.
moei has joined #ocaml
<enamex> still getting really bad results :/
<malc_> Enamex: can you restate your question somehow?
<vbmithr> yo
<enamex> I don't think so. I'm looking for the constructs in Ocaml that use that syntax. So my question primarily relies on the syntax, which apparently doesn't belong to one nicely named feature...
<ggole> Oh, you mean the 'a? I guess 'type variable' then.
ontologiae has joined #ocaml
yomimono has quit [Ping timeout: 240 seconds]
ontologiae has quit [Ping timeout: 250 seconds]
jeffmo has quit [Quit: jeffmo]
obadz- has joined #ocaml
obadz has quit [Ping timeout: 255 seconds]
ggole has quit []
jao has joined #ocaml
Haudegen has quit [Ping timeout: 260 seconds]
slash^ has left #ocaml [#ocaml]
travisbrady has joined #ocaml
<sgeisenh> if you want to go really far down the rabbit hole, search for "system f"
<ely-se> Enamex: look up parametric polymorphism
Haudegen has joined #ocaml
_andre has quit [Quit: leaving]
empyrean has quit [Remote host closed the connection]
MercurialAlchemi has quit [Ping timeout: 252 seconds]
ygrek has quit [Ping timeout: 246 seconds]
jeffmo has joined #ocaml
jeffmo has quit [Client Quit]
jeffmo has joined #ocaml
enamex has quit [Ping timeout: 272 seconds]
struk|work has quit [Quit: Page closed]
jeffmo has quit [Read error: Connection reset by peer]
JuggleTux has quit [Ping timeout: 264 seconds]
ncthom91 has joined #ocaml
AlexRussia has joined #ocaml
mac10688 has joined #ocaml
xet7_ has quit [Read error: Connection reset by peer]
xet7_ has joined #ocaml
empyrean has joined #ocaml
swgillespie has joined #ocaml
Hetu has joined #ocaml
Hetu has quit [Remote host closed the connection]
ontologiae has joined #ocaml
enamex has joined #ocaml
rbocquet has quit [Quit: WeeChat 1.1.1]
swistak35_ has quit [Quit: ZNC - http://znc.in]
noplamodo has quit [Remote host closed the connection]
regnat has quit [Read error: No route to host]
noplamodo has joined #ocaml
jun_ has quit [Ping timeout: 252 seconds]
JuggleTux has joined #ocaml
jun_ has joined #ocaml
shinnya has quit [Ping timeout: 265 seconds]
regnat has joined #ocaml
scriptdevil has joined #ocaml
Topher512 has joined #ocaml
<scriptdevil> Hi, I installed ocaml-4.02.3 with "opam switch 4.02.3". Now, my distro upgraded the packages from ncurses 5.9 to ncurses 6 and utop doesn't start any more.
rgrinberg has quit [Ping timeout: 240 seconds]
<scriptdevil> How do I rebuild and install ocaml and utop
<scriptdevil> Looks like opam switch reinstall 4.02.3 works.
Topher512 has quit [Client Quit]
LnL has quit [Ping timeout: 240 seconds]
ely-se has quit [Quit: Leaving]
malc_ has quit [Quit: leaving]
ncthom91 has quit [Quit: Textual IRC Client: www.textualapp.com]
jun_ has quit [Ping timeout: 264 seconds]
travisbrady has quit [Quit: travisbrady]
travisbrady has joined #ocaml
rgrinberg has joined #ocaml
JuggleTux has quit [Ping timeout: 252 seconds]
tane has quit [Quit: Verlassend]
ontologiae has quit [Ping timeout: 255 seconds]
creichert has joined #ocaml
travisbrady has quit [Quit: travisbrady]
madroach has quit [Ping timeout: 264 seconds]
jwatzman|work has quit [Quit: jwatzman|work]
madroach has joined #ocaml
Kakadu has quit [Remote host closed the connection]
empyrean has quit [Remote host closed the connection]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]