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>
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
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]
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.