adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.06.0 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.06/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
olle has quit [Ping timeout: 240 seconds]
olle has joined #ocaml
dtornabene has quit [Read error: Connection reset by peer]
nullifidian__ is now known as nullifidian
tsuyoshi has quit [Ping timeout: 256 seconds]
olle has quit [Ping timeout: 248 seconds]
olle has joined #ocaml
kleimkuhler has joined #ocaml
kleimkuhler has quit [Quit: kleimkuhler]
pioneer42 has quit [Quit: Leaving.]
ziyourenxiang has joined #ocaml
envjj has quit [Ping timeout: 256 seconds]
envjj has joined #ocaml
yaewa has joined #ocaml
moei has quit [Ping timeout: 260 seconds]
mfp has quit [Ping timeout: 268 seconds]
cobreadmonster has joined #ocaml
kleimkuhler has joined #ocaml
olle has quit [Ping timeout: 264 seconds]
tormen has joined #ocaml
tormen_ has quit [Ping timeout: 264 seconds]
unyu has quit [Quit: brb]
unyu has joined #ocaml
envjj has quit [Ping timeout: 264 seconds]
<Maxdamantus> Hm .. does OCaml have something similar to the `::` construct in Haskell? `4 :: int`
<benzrf> yes, :
<Maxdamantus> That doesn't seem to work in an expression context.
<benzrf> put parens around it
<Maxdamantus> Oh, thanks.
<benzrf> np
<Maxdamantus> Hmm .. I feel like I've spent too long trying to fiddle around with this code figuring out why it doesn't compile: https://gist.github.com/Maxdamantus/121c4931aba573541130f39997dea8aa
<Maxdamantus> How does it manage to infer `('b -> 'b)` for that first argument of `map`?
unyu has quit [Quit: Reboot.]
<Maxdamantus> Oh, crap, I see.
<Maxdamantus> Error is on line 1, should have been `('s, 't) outcome`
pierpa has quit [Quit: Page closed]
<Maxdamantus> So the type variable syntax in `let` doesn't mean "forall ‹variable name›" like in Haskell, but rather just creates a variable that is not yet unified.
<Maxdamantus> but it does have the "forall" meaning in `val` declarations?
yaewa has quit [Quit: Leaving...]
<Maxdamantus> and `type` declarations, presumably.
unyu has joined #ocaml
moei has joined #ocaml
FreeBirdLjj has joined #ocaml
<benzrf> is there a good historical reason why type application is backwards compared to value application?
<Maxdamantus> I've assumed it's because it wants to look like English, but I'm not familiar with much of the history of ML.
<Maxdamantus> `int parser`, `animal list`
<benzrf> i guess
<Maxdamantus> Wonder what French people think of it.
letoh has joined #ocaml
malina has joined #ocaml
Jesin has quit [Quit: Leaving]
lopex has quit [Quit: Connection closed for inactivity]
zolk3ri has joined #ocaml
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
r3s1stanc3 has quit [Quit: ZNC 1.7.0 - https://znc.in]
r3s1stanc3 has joined #ocaml
JimmyRcom_ has quit [Ping timeout: 265 seconds]
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
olle has joined #ocaml
kroot_ has quit [Ping timeout: 256 seconds]
kleimkuhler has quit [Quit: kleimkuhler]
kakadu has joined #ocaml
cobreadmonster has quit [Quit: Connection closed for inactivity]
pierpal has quit [Remote host closed the connection]
TarVanimelde has joined #ocaml
theglass has quit [Ping timeout: 256 seconds]
theglass has joined #ocaml
theglass has quit [Changing host]
theglass has joined #ocaml
demonimin has quit [Ping timeout: 240 seconds]
TarVanimelde has quit [Quit: TarVanimelde]
Maple__12 has joined #ocaml
<Maple__12> Interested in reasonably priced GLOBAL IRC ADVERTISING? Contact me on twitter https://twitter.com/nenolod or linkedin https://www.linkedin.com/in/nenolod
Maple__12 has quit [Killed (Sigyn (Spam is off topic on freenode.))]
<reynir> oh man
<Drup> benzrf Maxdamantus: it comes from the original formulation of ML by Milner (the article is very readable, if you want to take a loot), and yeah, the original idea was to look like english.
malina has quit [Quit: Throwing apples of Montserrat]
<Drup> With insight, it was not a good idea, but that was a long time ago :)
tane has joined #ocaml
<dmbaturin> Drup: Got a link to the article?
<Maxdamantus> I'm not sure it's inherently more logical to go one way or the other, but it should at least be consistent across the type expression syntax and the value expression syntax.
<Maxdamantus> "hello" print
* Maxdamantus also feels like it's generally a good idea to use "currying" in the type system, but suspects that was probably a later realisation too.
<Maxdamantus> int string either
<Drup> Maxdamantus: currying would imply partial application, which you can't do in ML
<Maxdamantus> Hm, didn't realise that.
<dmbaturin> Drup: Thanks!
<Maxdamantus> (doesn't seem to support higher kinds at all)
<Maxdamantus> or rather, doesn't support polymorphism over things of kinds other than *
<dmbaturin> Maxdamantus: Since types and functions are different entities and can never be used interchangeable, I don't see it as a real inconsistency.
<Maxdamantus> should have just said "higher-kinded polymorphism"
<dmbaturin> Special constructor for list type in Haskell looks more offensive from consistency point of view to me. :)
<Maxdamantus> dmbaturin: well, it seems unnecessarily inelegant to consider type-level functions to be fundamentally different to .. value-level functions.
<Maxdamantus> `list` can just be a function .. a function that takes a type and returns a type (so its type/kind is `Type 0 -> Type 0`/`* -> *`)
<Maxdamantus> The list constructor isn't particularly special, it just has a funny special syntax.
<Maxdamantus> `[a]` is the same as `[] a`
<Maxdamantus> (in Haskell)
<Maxdamantus> Personally, I wouldn't design a language with that special syntax, but at least it's no more than a special syntax.
<Drup> Maxdamantus: OCaml is not a dependently typed language and doesn't aim to be, so yes, type constructors and functions are different, and it's not particularly inelegant if you value minor things like decidable type inference :p
<xvilka> Haskell is neither though
<Maxdamantus> I don't think you have to sacrifice type inference decidability, but you might have to sacrifice type equality to some extent (you might have to accept that the compiler can fail because it can't prove that two type-level terms are equivalent, even though they might be)
<Maxdamantus> eg, given `type F a = a; type G a = a;`, is `Foo F` the same as `Foo G`?
<Maxdamantus> imo it's reasonable to have a language that just says "no" there.
<xvilka> Maxdamantus: in practice it can lead to too many problems in real life programs.
<xvilka> imho
<Maxdamantus> note though that it the answer to that question might actually be "yes", if the definition of `Foo` immediately invokes its argument.
mfp has joined #ocaml
pierpal has joined #ocaml
johnelse has quit [Ping timeout: 248 seconds]
johnelse has joined #ocaml
demonimin has joined #ocaml
tizoc has quit [Quit: Coyote finally caught me]
tizoc has joined #ocaml
jack5638 has quit [Ping timeout: 240 seconds]
jack5638 has joined #ocaml
raduom has joined #ocaml
BitPuffin has joined #ocaml
r3s1stanc3 has quit [Quit: ZNC 1.7.0 - https://znc.in]
r3s1stanc3 has joined #ocaml
lopex has joined #ocaml
Haudegen has joined #ocaml
CcxWrk has quit [Quit: ZNC 1.7.1 - https://znc.in]
webshinra has quit [Remote host closed the connection]
CcxWrk has joined #ocaml
CcxWrk has quit [Max SendQ exceeded]
webshinra has joined #ocaml
ben__ has quit [Ping timeout: 268 seconds]
CcxWrk has joined #ocaml
kakadu_ has joined #ocaml
kakadu has quit [Read error: Connection reset by peer]
kakadu_ has quit [Ping timeout: 244 seconds]
kakadu_ has joined #ocaml
kakadu_ has quit [Read error: Connection reset by peer]
kakadu_ has joined #ocaml
wildsebastian has quit [Quit: Bye! See you soon!]
Exagone313 has quit [Ping timeout: 256 seconds]
dinosaure has quit [Ping timeout: 240 seconds]
eagleflo has quit [Ping timeout: 256 seconds]
envjj has joined #ocaml
dinosaure has joined #ocaml
wildsebastian has joined #ocaml
Exagone313 has joined #ocaml
winnie has joined #ocaml
eagleflo has joined #ocaml
envjj_ has joined #ocaml
olle has quit [Ping timeout: 244 seconds]
envjj has quit [Ping timeout: 256 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
<benzrf> wait, ML doesn't have partial type application?
<benzrf> D:
olle has joined #ocaml
<benzrf> but that's vital for all kinds of neat tricks
<benzrf> eg if you wanna do monad transformers w/ monads that involve extra type arguments, like State
envjj has joined #ocaml
<Drup> Yeah
<Drup> Instead we just don't do monad transformers :>
envjj_ has quit [Ping timeout: 240 seconds]
<Drup> Partial type application is only really useful when you have some form of typeclasses, otherwise, not so much
<Drup> benzrf: you are thinking in term of Haskell code. The idioms in OCaml are really different. If you do that, it's not going to work out :)
<benzrf> well...
<benzrf> monad transformers are only one example, though
<Drup> I bet all the examples you are going to come up with involve typeclasses.
<benzrf> hah
<benzrf> possibly :)
<benzrf> wait, ocaml supports infinite data structures? even tho it's strict? interesting
<Drup> It's strict *by default*
<Drup> You can still use lazyness
<octachron> and values with cycles can be perilous
<Armael> what's partial type application?
<Armael> benzrf: that's eager evaluation for you :)
FreeBirdLjj has joined #ocaml
<steenuil> Armael, for example `string result` would form a type `'a -> (string, 'a) result`
mengu has joined #ocaml
<benzrf> well, it makes more sense when your type constructors are curried
<steenuil> yeah
<Armael> ah, I see.
<benzrf> haskell has "Either" rather than "result", and type application is prefix and curried, so it looks like "Either Int String"
<benzrf> but since curried, you can do just "Either Int"
envjj has quit [Ping timeout: 244 seconds]
<steenuil> and if you want more complicated type-level computation, there's an ML dialect for that! http://impredicative.com/ur/tutorial/tlc.html
<benzrf> hah
<benzrf> this is invalid? type 'f bar = int 'f;;
<thizanne> yes
<benzrf> how come?
<thizanne> ocaml doesnt have higher kinded types
<benzrf> o wait
<benzrf> so it's not just no partial application
<benzrf> it's no non-application either
<thizanne> Drup would explain better than me why it doesn't go well with other language features (modules I think)
FreeBirdLjj has quit [Remote host closed the connection]
<benzrf> oh wow you can't quantify over type constructors at all
<benzrf> this is gonna be even more different than i thought o:
<benzrf> or can you have type constructor members of modules
<thizanne> I don't understand your question
<benzrf> o is "type constructor" not a term used in ocaml
<benzrf> i just mean a parameterized type considered as a function on types rather than in any of its instances
<benzrf> like, could i have a module signature that provides a type "f" which has parameters
<benzrf> (i haven't actually read about modules in ocaml yet - i'm working off of my knowledge from having seen modules in, e.g., coq)
<thizanne> I actually use "type constructor" when I mean "type variant" (because that's a french bad translation), so I was confused
<benzrf> ah, if by that you mean something like Some, in haskell we call those data constructors
<octachron> basically, without typeclasses, there is no enough information to have useful functions of type "f: 'a 't -> ..."
<octachron> functor provides a way to circumvent this issue, but the direct translation path "typeclass -> functor" often results in very unidiomatic Haskell-in-OCaml-clothing code
<benzrf> well, i dunno about that - you could just reify typeclass dictionaries as explicit arguments
<benzrf> im not sure how often that would be helpful, tho
<benzrf> but, 11:17 <benzrf> like, could i have a module signature that provides a type "f" which has parameters
<octachron> reifying type class dictionnaries with first class modules is another option
<Armael> yes you can have types in module signatures
FreeBirdLjj has joined #ocaml
<benzrf> octachron: yeah, i figured :)
<Armael> that's a common pattern, see e.g. the Map module http://caml.inria.fr/pub/docs/manual-ocaml/libref/Map.html
<benzrf> ah, "type +'a t"
<benzrf> is the + a variance thin
<benzrf> *thing
<thizanne> yes
<Armael> yes
<benzrf> hmm, i've never had to work much with variance before, i don't know much about it :y
<Armael> you don't really need to worry about it
FreeBirdLjj has quit [Ping timeout: 240 seconds]
* bartholin digs up some obscure ocaml feature
<bartholin> So I was toying with extensible variant types
<benzrf> man, some of these restrictions arent a problem if you just make your language pure like a sensible person ;)
<bartholin> And it seems that extending a type through a functor screws the printer in the REPL
envjj has joined #ocaml
<bartholin> ^ in this code I extend Msg.t in two different ways (which should be semantically equivalent), and I declare a value x, which shows normally in the REPL, and a value x', whose value becomes <extension>, even though I can still access it.
<bartholin> maybe it's too obscure for anyone to care about
<Drup> bartholin: actually, those restrictions are not a problem if you forgo type abstractions. </troll>
<Drup> benzrf*
<Drup> bartholin: congratulations, you found a bug in the printing routine of the toplevel :D
<Armael> :D
<benzrf> Drup: really?
<Armael> now, nobody knows how to fix it
<benzrf> i thought it was impurity that was the issue
<Drup> benzrf: not for those particular ones, no
envjj has quit [Ping timeout: 256 seconds]
envjj has joined #ocaml
gareppa has joined #ocaml
ziyourenxiang has quit [Ping timeout: 244 seconds]
kleimkuhler has joined #ocaml
gareppa has quit [Quit: Leaving]
<benzrf> Drup: ahh, i tried playing around in haskell a bit & i get it
<benzrf> is this correct: the reason we don't talk about variance in haskell is b/c you can only really have subtypes from instantiation of foralls, and you can't even use a forall'd type as an argument to a constructor w/o ghc extensions, and even then there isn't support for putting them as arguments to non-function types
<benzrf> ah, there *is* a highly experimental and probably-broken ghc extension for that, but it seems like it just assumes non-function-type type constructors are invariant in their arguments to be safe
<benzrf> hah
gareppa has joined #ocaml
TC01 has quit [Ping timeout: 264 seconds]
letoh_ has joined #ocaml
letoh has quit [Ping timeout: 240 seconds]
letoh_ is now known as letoh
kleimkuhler has quit [Quit: kleimkuhler]
kleimkuhler has joined #ocaml
gareppa has quit [Quit: Leaving]
olle has quit [Ping timeout: 240 seconds]
nullifidian has quit [Read error: Connection reset by peer]
nullifidian has joined #ocaml
reynir has quit [Ping timeout: 260 seconds]
kalio has quit [Ping timeout: 248 seconds]
nullifidian_ has joined #ocaml
kalio has joined #ocaml
theglass has quit [Ping timeout: 264 seconds]
nullifidian has quit [Ping timeout: 240 seconds]
reynir has joined #ocaml
Haudegen has quit [Ping timeout: 240 seconds]
theglass has joined #ocaml
theglass has quit [Changing host]
theglass has joined #ocaml
zolk3ri has quit [Ping timeout: 268 seconds]
Haudegen has joined #ocaml
theglass has quit [Ping timeout: 256 seconds]
envjj has quit [Quit: leaving]
tane has quit [Quit: Leaving]
env__ has joined #ocaml
mengu has quit [Remote host closed the connection]
theglass has joined #ocaml
theglass has quit [Changing host]
theglass has joined #ocaml
mengu has joined #ocaml
tsuyoshi has joined #ocaml
mengu has quit [Ping timeout: 256 seconds]
tsuyoshi has quit [Quit: bye\]
argent_smith has joined #ocaml
loli has quit [Read error: Connection reset by peer]
loli has joined #ocaml
zolk3ri has joined #ocaml
kakadu has joined #ocaml
kakadu_ has quit [Ping timeout: 268 seconds]
kleimkuhler has quit [Quit: kleimkuhler]
kleimkuhler has joined #ocaml
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
discord has joined #ocaml
pmetzger has joined #ocaml
<pmetzger> test
<discord> <Perry> @🐫 reynir 🌳 I believe I've restarted the bridge successfully. I'd forgotten that @Bluddy gave me instructions.
<reynir> ok coolio
pmetzger has quit [Client Quit]
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
olle has joined #ocaml
mengu has joined #ocaml
env__ has quit [Ping timeout: 268 seconds]
discord has quit [Remote host closed the connection]
discord has joined #ocaml
<discord> <Perry> testing again.
pmetzger has joined #ocaml
<pmetzger> test
<discord> <Perry> test
pmetzger has quit [Client Quit]
<benzrf> o.O
kleimkuhler has quit [Quit: kleimkuhler]
env__ has joined #ocaml
loli has quit [Ping timeout: 248 seconds]
Haudegen has quit [Ping timeout: 248 seconds]
loli has joined #ocaml
Haudegen has joined #ocaml
winnie has quit [Quit: Leaving]
kleimkuhler has joined #ocaml
env__ has quit [Ping timeout: 260 seconds]
kleimkuhler has quit [Quit: kleimkuhler]
kleimkuhler has joined #ocaml
env__ has joined #ocaml
mengu has quit [Remote host closed the connection]
argent_smith has quit [Quit: Leaving.]
steenuil has quit [Read error: Connection reset by peer]
steenuil has joined #ocaml
kleimkuhler has quit [Quit: kleimkuhler]
kleimkuhler has joined #ocaml
kleimkuhler has quit [Client Quit]
kleimkuhler has joined #ocaml
kleimkuhler has quit [Quit: kleimkuhler]
nymphet has joined #ocaml
theglass has quit [Ping timeout: 256 seconds]
pierpal has quit [Ping timeout: 260 seconds]
pierpa has joined #ocaml
env__ has quit [Ping timeout: 240 seconds]
kakadu has quit [Remote host closed the connection]
env__ has joined #ocaml
theglass has joined #ocaml
theglass has quit [Changing host]
theglass has joined #ocaml
JimmyRcom_ has joined #ocaml
theglass has quit [Ping timeout: 248 seconds]
olle has quit [Remote host closed the connection]
Haudegen has quit [Remote host closed the connection]
neatonk has quit [Ping timeout: 260 seconds]
zolk3ri has quit [Quit: leaving]
theglass has joined #ocaml
theglass has quit [Changing host]
theglass has joined #ocaml
dtornabene has joined #ocaml
neatonk has joined #ocaml
env__ has quit [Ping timeout: 248 seconds]