mengu has quit [Read error: Connection reset by peer]
shinnya has quit [Ping timeout: 258 seconds]
jnavila has joined #ocaml
maarhart has quit [Ping timeout: 276 seconds]
mengu has joined #ocaml
mengu_ has quit [Read error: Connection reset by peer]
samrat_ has quit [Ping timeout: 255 seconds]
tane has joined #ocaml
mengu has quit [Read error: Connection reset by peer]
mengu has joined #ocaml
KeyJoo has joined #ocaml
slash^ has joined #ocaml
samrat_ has joined #ocaml
ygrek_ has joined #ocaml
davidkrauser_ has joined #ocaml
malina has quit [Ping timeout: 268 seconds]
malina has joined #ocaml
samrat_ has quit [Ping timeout: 255 seconds]
ryanartecona has quit [Quit: ryanartecona]
TheLemonMan has joined #ocaml
dhil has joined #ocaml
Merv__ has joined #ocaml
Merv_ has quit [Ping timeout: 240 seconds]
malina has quit [Ping timeout: 268 seconds]
AltGr has left #ocaml [#ocaml]
kakadu_ has joined #ocaml
malina has joined #ocaml
govg has quit [Quit: leaving]
govg has joined #ocaml
kakadu__ has joined #ocaml
kakadu_ has quit [Ping timeout: 260 seconds]
slash^ has quit [Read error: Connection reset by peer]
malina has quit [Remote host closed the connection]
olibjerd has quit [Quit: olibjerd]
frefity has joined #ocaml
sepp2k has quit [Quit: Leaving.]
average has quit [Remote host closed the connection]
nojb has joined #ocaml
jlam_ has joined #ocaml
_andre has quit [Quit: leaving]
jlam__ has quit [Ping timeout: 240 seconds]
shinnya has joined #ocaml
enterprisey has quit [Read error: Connection reset by peer]
davidkrauser_ has quit [Quit: Leaving]
davidkrauser has joined #ocaml
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
dhil has quit [Ping timeout: 240 seconds]
frefity has quit [Quit: Ex-Chat]
jnavila has quit [Remote host closed the connection]
shinnya has quit [Ping timeout: 240 seconds]
nojb has quit [Remote host closed the connection]
nojb has joined #ocaml
Algebr has quit [Ping timeout: 240 seconds]
rdutra has quit [Quit: Leaving.]
tormen has joined #ocaml
sh0t has quit [Remote host closed the connection]
barcabuona has quit [Ping timeout: 276 seconds]
barcabuona has joined #ocaml
pierpa has joined #ocaml
ryanartecona has joined #ocaml
tane has quit [Quit: Leaving]
Simn has quit [Quit: Leaving]
mlnoob has joined #ocaml
enterprisey has joined #ocaml
nojb has quit [Ping timeout: 260 seconds]
hannes` has joined #ocaml
hannes has quit [Disconnected by services]
hannes` is now known as hannes
<mlnoob>
Hi. I am new to Ocaml and I need help understanding the type error. I have implemented (shameless copying) a leftist heap shown here - https://codeshare.io/5ok9NY. Basically, the module LeftistHeap takes a parameter of type ordered. And returns a heap.
<mlnoob>
Now, lets say I want to extend this module. E.g. I want to pretty print the contents of a heap of type int. The signature at line 74 shows the module inclusion with destructive substitution.
kevinqiu has quit [Ping timeout: 260 seconds]
<mlnoob>
And Ocaml returns the correct signature with the type heap substibuted by the type heap' in the intheap module signature
<mlnoob>
However, when I include the module in the implementation, I am getting a signature mismatch error.
<mlnoob>
However, when I include the module in the implementation, I am getting a signature mismatch error. See lines 80 - 91
kmicinski has joined #ocaml
<kmicinski>
Does anyone have any experience building Z3 on linux and installing the ocaml bindings? I can't get the installed package to be found by ocamlfind.
<octachron>
mlnoob, signature constraints applied to a module can only hide information
<octachron>
mlnoob, when you write LeftistHeap(Element: …): (HEAP …) = struct … end
<octachron>
you are hiding the implementation of the type heap by making it an abstract type
ryanartecona has quit [Quit: ryanartecona]
<octachron>
once the implementation of the type head hidden away, you cannot recover it from the exterior of the functor definition
<mlnoob>
octachron: Correct. So, what would be the idiomatic way of extending a module?
<mlnoob>
I started down this path when I wanted to access the abstract type.
kmicinski has quit [Ping timeout: 260 seconds]
<Drup>
the simple answer is that you don't.
<Drup>
(access the abstract type)
<Drup>
For a printer, for example, the usual way is to use one of the iter functions
john51_ has quit [Ping timeout: 255 seconds]
john51 has joined #ocaml
john51 has quit [Read error: Connection reset by peer]
<mlnoob>
Drup: I agree with you. But, lets say I create a queue using the LeftistHeap.fromList method. And this would be shown as an abstract type. Is that correct to say?
<mlnoob>
How can I do pattern matching on this abstract type?
<mlnoob>
E.g. I want to recursively parse this heap. And I want to match the type constructors E and T.
<octachron>
mlnoob, you cannot pattern match an abstract type: an abstract type can only be manipulated through its exposed API
<mlnoob>
octachron: I see what you mean.
john51 has joined #ocaml
<mlnoob>
So, it is better to fix the Heap signature as compared to what I am trying to do
<Drup>
if you really need something to be done under the abstraction boundary, it should indeed be done under the abstraction boundary ;)
<mlnoob>
LOL. That makes total sense
<Drup>
It does, but so few languages enforces it that your confusion is very understandable
<mlnoob>
Exactly. I was going to say that years of oop has polluted my mind.
<mlnoob>
octachron: Thanks for the help.
<mlnoob>
Drup: Thanks
<octachron>
mlnoob, you are welcome
<mlnoob>
I have been banging on this since morning and was about to rage quit. It is nice to understand the underlying concept.
mlnoob has left #ocaml [#ocaml]
<orbifx[m]>
are OCaml binaries built with ocamlbuild self-contained? or do the have runtime dependencies from the system?
jlam__ has joined #ocaml
jlam_ has quit [Ping timeout: 240 seconds]
cranmax has quit [Quit: Connection closed for inactivity]
kakadu__ has quit [Remote host closed the connection]
cranmax has joined #ocaml
<Drup>
orbifx[m]: libc + the lib C against which you dynamically link
<Drup>
it doesn't depend on the build system
nojb has joined #ocaml
nojb has quit [Ping timeout: 255 seconds]
<orbifx[m]>
ok thanks :)
andreas_ has quit [Quit: Connection closed for inactivity]