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