adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | Upcoming OCaml MOOC: https://huit.re/ocamlmooc | OCaml 4.03.0 release notes: http://ocaml.org/releases/4.03.html | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
jpdeplaix has quit [Ping timeout: 258 seconds]
jpdeplaix has joined #ocaml
two_wheels has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
two_wheels has joined #ocaml
manizzle has joined #ocaml
pyon has joined #ocaml
<Heasummn> type 'a ast = 'a * ('a ast) top gives me the error The type constructor top expects 0 argument(s), but is here applied to 1 argument(s)
<Heasummn> top is not polymorphic, so how would I use it here?
al-damiri has quit [Quit: Connection closed for inactivity]
<Heasummn> oh wait
<Heasummn> I'm very smart
<Heasummn> nvm
<Heasummn> type 'a ast =
<Heasummn> type 'a ast = 'a * ('a ast) * top
silver has quit [Quit: rakede]
two_wheels has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<bruce_r> Heasummn: if you define your type like this you won't be able to create any element of this type.
<bruce_r> you might be able to create some infinite thing
grandy____ has quit [Ping timeout: 250 seconds]
grandy____ has joined #ocaml
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 258 seconds]
sheijk has quit [Quit: Lost terminal]
fluter has quit [Ping timeout: 250 seconds]
SilverKey has joined #ocaml
john51 has quit [Ping timeout: 240 seconds]
john51 has joined #ocaml
<Heasummn> Can I name two functions using the same polymorphic tag?
<Heasummn> types*
<Heasummn> like type 'a foo = 'a; let 'a foo = int
<Heasummn> let 'a bar = int*
govg has quit [Ping timeout: 265 seconds]
tmtwd has joined #ocaml
fluter has joined #ocaml
kdas__ has quit [Quit: Leaving]
<bruce_r> I think you mean 'type' and not 'let'
<bruce_r> in ocaml when you use the same name for 2 types or variables, it's allowed, but you can't access the first one anymore
FreeBirdLjj has joined #ocaml
M-jimt has quit [Ping timeout: 250 seconds]
M-jimt has joined #ocaml
jimt has quit [Ping timeout: 250 seconds]
jimt has joined #ocaml
l1x has quit [Ping timeout: 258 seconds]
M-martinklepsch has quit [Ping timeout: 250 seconds]
rwmjones has quit [Ping timeout: 258 seconds]
jbrown has quit [Ping timeout: 258 seconds]
l1x has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 244 seconds]
struk|desk2 has joined #ocaml
struk|desk has quit [Ping timeout: 258 seconds]
rwmjones has joined #ocaml
cr4ven has quit [Ping timeout: 258 seconds]
barkmadley[m] has quit [Ping timeout: 250 seconds]
barkmadley[m] has joined #ocaml
cr4ven has joined #ocaml
M-martinklepsch has joined #ocaml
hackwaly has joined #ocaml
jbrown has joined #ocaml
ygrek has quit [Ping timeout: 240 seconds]
<hackwaly> Is there some way to make multiple classes and types defined mutually (like `type and` or `class and` syntax does)?
<bruce_r> type yes
<bruce_r> class I'm not sure
tmtwd has quit [Ping timeout: 244 seconds]
<hackwaly> Currently I have to add extra type parameters to fight against that, but it's ugly.
shinnya has quit [Ping timeout: 244 seconds]
tmtwd has joined #ocaml
bruce_r_ has joined #ocaml
hackwaly has quit [Quit: Page closed]
bruce_r has quit [Ping timeout: 264 seconds]
hackwaly has joined #ocaml
hackwaly has quit [Client Quit]
Axle has joined #ocaml
Axle has quit [Client Quit]
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
kdas__ has joined #ocaml
kdas__ is now known as kushal
kushal has quit [Changing host]
kushal has joined #ocaml
ygrek has joined #ocaml
FreeBirdLjj has joined #ocaml
MercurialAlchemi has joined #ocaml
orbitz_ has joined #ocaml
copy`_ has joined #ocaml
wizeman_ has joined #ocaml
l1x_ has joined #ocaml
haesbaer1 has joined #ocaml
clockish_ has joined #ocaml
l1x has quit [Ping timeout: 250 seconds]
clockish has quit [Ping timeout: 250 seconds]
clockish_ is now known as clockish
wizeman has quit [Ping timeout: 250 seconds]
orbitz has quit [Ping timeout: 250 seconds]
copy` has quit [Ping timeout: 250 seconds]
maker has quit [Ping timeout: 250 seconds]
haesbaert has quit [Ping timeout: 250 seconds]
l1x_ is now known as l1x
wizeman_ is now known as wizeman
copy`_ is now known as copy`
maker has joined #ocaml
copy` has quit [Quit: Connection closed for inactivity]
tmtwd has quit [Ping timeout: 252 seconds]
xenny has joined #ocaml
govg has joined #ocaml
pierpa has quit [Ping timeout: 244 seconds]
jimt has quit [Ping timeout: 260 seconds]
jimt has joined #ocaml
tmtwd has joined #ocaml
tmtwd has quit [Ping timeout: 276 seconds]
dexterph has joined #ocaml
Pepe__ is now known as Pepe_
AltGr has joined #ocaml
soupault has joined #ocaml
kushal has quit [Quit: Leaving]
ontologiae has joined #ocaml
tane has joined #ocaml
ygrek has quit [Ping timeout: 276 seconds]
bruce_r_ has quit [Ping timeout: 260 seconds]
myst|fon has joined #ocaml
bruce_r has joined #ocaml
benjamin1 is now known as osheeta
larhat has joined #ocaml
larhat has quit [Remote host closed the connection]
xenny has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
xenny has joined #ocaml
ggole has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
xenny has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
FreeBirdLjj has joined #ocaml
bruce_r has quit [Ping timeout: 264 seconds]
silver has joined #ocaml
kakadu has joined #ocaml
TheLemonMan has joined #ocaml
tane has quit [Quit: Verlassend]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
pierpa has joined #ocaml
pierpa has quit [Ping timeout: 258 seconds]
pierpa has joined #ocaml
xenny has joined #ocaml
AltGr has left #ocaml [#ocaml]
tane has joined #ocaml
nopf has quit [Quit: leaving]
FreeBirdLjj has quit [Remote host closed the connection]
xenny has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
kdas__ has joined #ocaml
kdas__ is now known as kushal
_andre has joined #ocaml
kushal has quit [Changing host]
kushal has joined #ocaml
ChristopheT has joined #ocaml
FreeBirdLjj has joined #ocaml
sfri has quit [Remote host closed the connection]
sdothum has joined #ocaml
sfri has joined #ocaml
copy` has joined #ocaml
two_wheels has joined #ocaml
agarwal1975 has joined #ocaml
xenny has joined #ocaml
soupault has quit [Ping timeout: 265 seconds]
SIGILL has quit [Quit: .]
SIGILL has joined #ocaml
al-damiri has joined #ocaml
<tormen> gasche: Hmm. I have a problem with the deducted types: I don't understand why ocaml narrows down ... Could you possibly have a look ? https://paste.debian.net/hidden/2b83e66b/
eagleflo has quit [Ping timeout: 276 seconds]
Algebr` has joined #ocaml
<tormen> ... or anyone else :)
hyperbor1ean is now known as hyperboreean
* tormen stared at the code for 15min and just doesn't get it :(
<ggole> f is an argument, so it is monomorphic.
<ggole> Because of this, the type of x is inferred to have the same type as db_res
<ggole> (Since they are passed to the same argument of f.)
tvynr has quit [Ping timeout: 264 seconds]
eagleflo has joined #ocaml
<tormen> ggole: ok I see ... yeah I was actually wondering about that at some point ;)
<tormen> ggole: ... so I might want to loosen the type of the 3rd tuple of EEM_db in this case...
<tormen> (and put 'c)
hyperboreean has quit [Quit: leaving]
<ggole> Either that, or use a wrapper to allow a truly polymorphic argument
hyperboreean has joined #ocaml
<ggole> Which makes sense depends on what you are doing.
<tormen> a wrapper ?
<tormen> (around what)
kakadu has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
<ggole> Record fields can be polymorphic, so you can use a single field record (the wrapper) around a function type to allow what is essentially polymorphic arguments.
<ggole> eg, type poly_id = { f : 'a . 'a -> 'a } let test f = f.f 0, f.f "zonk"
<tormen> ggole: Wao. Thanks for the example as well :) Nice possibility. I'll keep that in mind :)) THAAAANKS a lot !!!! So cool !!! Now I can continue :))
<ggole> Keep in mind that it's better to avoid this stuff unless you need it
<tormen> ggole: Yes! KISS :))
<ggole> Yup.
<tormen> (keep it simple stupid)
<tormen> (I already decided that for me the loosening is sufficient and also actually more in the spirit of a Monad as I want it ;))
beginner has joined #ocaml
sheijk has joined #ocaml
sheijk has quit [Client Quit]
sheijk has joined #ocaml
freehck has quit [Remote host closed the connection]
kakadu has joined #ocaml
SilverKey has quit [Quit: Halted.]
averell has joined #ocaml
agarwal1975 has quit [Quit: agarwal1975]
agarwal1975 has joined #ocaml
MercurialAlchemi has quit [Remote host closed the connection]
silver_ has joined #ocaml
silver has quit [Ping timeout: 265 seconds]
tvynr has joined #ocaml
strykerkkd has joined #ocaml
ChristopheT has left #ocaml ["ERC (IRC client for Emacs 24.5.1)"]
pierpa has quit [Ping timeout: 244 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
two_wheels has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ontologiae has quit [Ping timeout: 258 seconds]
SilverKey has joined #ocaml
two_wheels has joined #ocaml
pkl has joined #ocaml
MercurialAlchemi has joined #ocaml
edwin has left #ocaml [#ocaml]
AlexRussia has joined #ocaml
govg has quit [Ping timeout: 265 seconds]
tane has quit [Quit: Verlassend]
pkl has quit [Ping timeout: 264 seconds]
ygrek has joined #ocaml
darkf_ has joined #ocaml
slash^ has joined #ocaml
darkf has quit [Ping timeout: 250 seconds]
darkf_ is now known as darkf
ygrek has quit [Ping timeout: 250 seconds]
tane has joined #ocaml
regnat has quit [Quit: WeeChat 1.5]
regnat has joined #ocaml
xenny has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
richi235 has quit [Quit: No Ping reply in 180 seconds.]
richi235 has joined #ocaml
<Heasummn> I need some help with polymorphic types
mcspud has quit [Ping timeout: 250 seconds]
<Heasummn> I'm building a compiler, and in the representation of the AST, I want to pass in other data
<Heasummn> Googling around, I find the solution of using polymorphic types here:
<Heasummn> lambda-the-ultimate.org/node/4170#comment-63836
<Heasummn> He only uses one type to represent the whole AST though. How would I do something similar if my AST consists of multiple types
<ia0> You would need to abstract each type on all other types, as I see it
<ia0> type t = body_t[t, s] and s = body_s[t, s]
<ia0> would become:
<Heasummn> Here's what I currently do, I'm just confused as to how to use it. https://github.com/Heasummn/Crab/blob/master/src/CrabAst/crabAst.mli
<ia0> type ('a, 'b) t = body_t['a, 'b]
<Heasummn> I don't think it's correct
<ia0> type ('a, 'b) s = body_s['a, 'b]
<Heasummn> hmm okay
mcspud has joined #ocaml
<Heasummn> How would I pass that type data down the AST?
<Heasummn> Doing that recursive definition in each type?
<ia0> http://pastebin.com/ZDtgTADc <= I would see something like this
<Heasummn> Is that Base type required?
<ia0> I assumed you needed it since you have Base of 'a in your example
<ia0> If you don't it would simplify things a bit more
<ia0> the transformation is quite mechanical
<Heasummn> Yeah I don't think I need it. So no 'b, just a single 'b
<Heasummn> 'a*
pkl has joined #ocaml
<ia0> type ('a1, 'a2, ..., 'an) t = body['a1, ..., 'an, ('a1, ..., 'an) t]
<ia0> becomes:
<ia0> type ('a1, ..., 'an, 'b) t = body['a1, ..., 'an, 'b]
<ia0> you can then define
pkl has quit [Client Quit]
<ia0> type ('a1, ..., 'an) s = Fix of data * ('a1, ..., 'an, ('a1, ..., 'an) s) t
<Heasummn> alright
<Heasummn> cool
<Drup> I agree with Sam lindley's comment in the thread, though
<Drup> this is a huge pita when your IR grows
<Drup> the "obvious" solution, which is to have several distinct IRs, is fine in practice
<Heasummn> I was considering doing that yeah.
<Heasummn> A function typecheck which takes an Ast and returns a TypedAst
pkl has joined #ocaml
<pkl> Does anyone know when we can expect multicore ocaml?
octachron has joined #ocaml
<Heasummn> Drup, do you think it'd be better to use a different AST type for the semantic analysis?
<chelfi> pkl: not now, probably not soon
<Drup> Heasummn: what do you count as "semantic analysis" ?
pkl has quit [Ping timeout: 250 seconds]
xenny has joined #ocaml
<Drup> The usual minimum, for a typed language, is AST (which mimics the source language) and then Typed AST (annotated with types). After that, it varies a lot
jackweirdy has joined #ocaml
<Heasummn> Yeah, there's the AST. Then I'm probably going to annotate types, and then locations
<Heasummn> locations being scope data
<Drup> you always keep locations everywhere anyway, that's pretty much mandatory
<Drup> (if you want half decent error messages)
<Heasummn> So I should rewrite the AST keeping types this time?
<Drup> It's up to you, you can also experiment with the other solution if you feel like it. :)
<Heasummn> I've been attempting to figure that out for about a day and a half now
<Drup> so go the obvious route
Algebr` has quit [Ping timeout: 250 seconds]
<Heasummn> yeah alright
<Drup> Using a simple design for a compiler is not always a bad thing :p
beginner has left #ocaml ["Leaving"]
<Heasummn> Are there any examples of this that I can look at. Doing type checking in a functional way is new to me
<Heasummn> Like a simple language with Type Checking
<Heasummn> doesn't have to be Ocaml
<Drup> well, there is the ocaml typechecker itself, but it's not simple :x
silver_ is now known as silver
<Heasummn> Ocaml does type inference though right? Well I guess it needs to check as well
<Drup> ah yes, the pl zoo, that's a good reference :)
<Heasummn> cool
<Heasummn> thanks
<ggole> https://github.com/tomprimozic/type-systems might also be interesting.
<Drup> which kind of language are you doing ?
darkf has quit [Read error: Connection reset by peer]
darkf has joined #ocaml
kakadu has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
pkl has joined #ocaml
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
jackweirdy has quit [Quit: Textual IRC Client: www.textualapp.com]
sdothum has joined #ocaml
zpe has quit [Remote host closed the connection]
SilverKey has quit [Read error: Connection reset by peer]
SilverKe_ has joined #ocaml
tane has quit [Quit: Leaving]
tane has joined #ocaml
seangrove has joined #ocaml
bruce_r has joined #ocaml
darkf has quit [Read error: Connection reset by peer]
<Heasummn> Drup, you still there?
<Heasummn> I made some really shitty type checking, and am looking for a code review
dexterph has quit [Ping timeout: 250 seconds]
ygrek has joined #ocaml
<Heasummn> My main problem is that there is no neat way to check if something is one of multiple types. I have to do some ugly if is_num then blah else assert false
<Heasummn> because ocaml will not figure out that an exception is being raised in is_num
Heasummn has quit [Ping timeout: 265 seconds]
LiamGoodacre has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 258 seconds]
xenny has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
soupault has joined #ocaml
octachron has quit [Quit: Leaving]
SilverKe_ has quit [Ping timeout: 252 seconds]
SilverKey has joined #ocaml
seangrove has quit [Ping timeout: 265 seconds]
xenny has joined #ocaml
DocFox has joined #ocaml
DocFox has left #ocaml [#ocaml]
seangrove has joined #ocaml
govg has joined #ocaml
zpe has joined #ocaml
pkl has quit [Ping timeout: 264 seconds]
antoro has joined #ocaml
soupault has quit [Remote host closed the connection]
zpe has quit [Ping timeout: 265 seconds]
kakadu has joined #ocaml
alexelcu has joined #ocaml
slash^ has quit [Read error: Connection reset by peer]
mattrepl has joined #ocaml
dexterph has joined #ocaml
kolko has quit [Quit: ZNC - http://znc.in]
kolko has joined #ocaml
AlexRussia has quit [Ping timeout: 250 seconds]
ggole has quit []
copy` has quit [Quit: Connection closed for inactivity]
AlexRussia has joined #ocaml
alexelcu has quit [Remote host closed the connection]
zpe has joined #ocaml
zpe has quit [Ping timeout: 258 seconds]
mcspud has quit [Ping timeout: 250 seconds]
<bruce_r> Heasummn: why do you check the type on the negation, but not on the addition for example
AlexRussia has quit [Ping timeout: 265 seconds]
mcspud has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 258 seconds]
<bruce_r> ok I get it
<bruce_r> should your else case line 34 be type error?
Xizor has joined #ocaml
Xizor has quit []
Xizor has joined #ocaml
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
Xizor has quit [Client Quit]
xenny has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ygrek has quit [Ping timeout: 258 seconds]
ygrek has joined #ocaml
zpe has joined #ocaml
thizanne has quit [Ping timeout: 276 seconds]
SilverKey has quit [Quit: Halted.]
zpe has quit [Ping timeout: 258 seconds]
SilverKey has joined #ocaml
tvynr has quit [Ping timeout: 244 seconds]
chris2 has quit [Ping timeout: 258 seconds]
chris2 has joined #ocaml
dexterph has quit [Ping timeout: 252 seconds]
tane has quit [Quit: Leaving]
kakadu has quit [Remote host closed the connection]
agarwal1975 has quit [Quit: agarwal1975]
mattrepl has quit [Quit: mattrepl]
tvynr has joined #ocaml
al-damiri has quit [Quit: Connection closed for inactivity]
LiamGoodacre has quit [Quit: Leaving]
lepoetemaudit35 has joined #ocaml
Heasummn has joined #ocaml
<Heasummn> I've got a problem, same one that I had yesterday
<Heasummn> I have a Tree, specifically an AST. I want to add some data to my AST, but I don't want to rewrite the code that uses it
<Heasummn> The AST right now is just a variant type
<Heasummn> I was thinking of making it a Record type, and then creating a new record based off of that. Making it a record wouldn't require too much work to do.
<Heasummn> I attempted to use polymorphic types, but that got confusing and ugly very fast
two_wheels has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
two_wheels has joined #ocaml
manizzle has quit [Ping timeout: 244 seconds]
SilverKey has quit [Quit: Halted.]
strykerkkd has quit [Quit: Leaving]
manizzle has joined #ocaml
silver has quit [Quit: rakede]
mrallen1_ has joined #ocaml
mrallen1 has quit [Ping timeout: 250 seconds]
mrallen1_ is now known as mrallen1
lepoetemaudit35 has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]