companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 5.0 released(!!1!): https://ocaml.org/releases/5.0.0.html | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
Tuplanolla has quit [Quit: Leaving.]
chrisz has quit [Ping timeout: 260 seconds]
chrisz has joined #ocaml
chrisz has quit [Ping timeout: 245 seconds]
chrisz has joined #ocaml
azimut has quit [Ping timeout: 240 seconds]
spip has quit [Quit: Konversation terminated!]
waleee has quit [Ping timeout: 264 seconds]
wagle has quit [Remote host closed the connection]
wagle has joined #ocaml
bgs has joined #ocaml
bgs has quit [Remote host closed the connection]
terrorjack has joined #ocaml
aljazmc has joined #ocaml
terrorjack has quit [*.net *.split]
wagle has quit [*.net *.split]
Soni has quit [*.net *.split]
MarvelousWololo has quit [*.net *.split]
anpad has quit [*.net *.split]
TrillionEuroNote has quit [*.net *.split]
John_Ivan_ has quit [*.net *.split]
noddy has quit [*.net *.split]
darchitect has quit [*.net *.split]
amk has quit [*.net *.split]
grobe0ba has quit [*.net *.split]
henrytill has quit [*.net *.split]
nfc_ has quit [*.net *.split]
oisota has quit [*.net *.split]
berberman has quit [*.net *.split]
rwmjones has quit [*.net *.split]
ds-ac has quit [*.net *.split]
infinity0 has quit [*.net *.split]
lobo has quit [*.net *.split]
troydm has quit [*.net *.split]
sleepydog has quit [*.net *.split]
immutable_ has quit [*.net *.split]
b0o has quit [*.net *.split]
Ankhers has quit [*.net *.split]
whereiseveryone has quit [*.net *.split]
jakzale has quit [*.net *.split]
ggb has quit [*.net *.split]
philipwhite_ has quit [*.net *.split]
seeg has quit [*.net *.split]
Wojciech_K has quit [*.net *.split]
CalimeroTeknik has quit [*.net *.split]
hexology has quit [*.net *.split]
SquidDev has quit [*.net *.split]
kronicma1 has quit [*.net *.split]
hsw has quit [*.net *.split]
Ekho has quit [*.net *.split]
xgqt has quit [*.net *.split]
sim642 has quit [*.net *.split]
jmcantrell has quit [*.net *.split]
quernd8 has quit [*.net *.split]
rak has quit [*.net *.split]
czy has quit [*.net *.split]
energizer has quit [*.net *.split]
haesbaert has quit [*.net *.split]
kitzman has quit [*.net *.split]
kurfen_ has quit [*.net *.split]
dstein64 has quit [*.net *.split]
hannes_ has quit [*.net *.split]
pippijn has quit [*.net *.split]
xenu has quit [*.net *.split]
theblatte has quit [*.net *.split]
companion_cube has quit [*.net *.split]
discocaml has quit [*.net *.split]
Johann_ has quit [*.net *.split]
aljazmc has quit [*.net *.split]
end^ has quit [*.net *.split]
reynir[m] has quit [*.net *.split]
Riviera has quit [*.net *.split]
justache has quit [*.net *.split]
buoy49_ has quit [*.net *.split]
emp has quit [*.net *.split]
mstevens has quit [*.net *.split]
curium has quit [*.net *.split]
Armael has quit [*.net *.split]
Exa has quit [*.net *.split]
octachron has quit [*.net *.split]
GreaseMonkey has quit [*.net *.split]
delyan_ has quit [*.net *.split]
welterde has quit [*.net *.split]
ebb has quit [*.net *.split]
_alix has quit [*.net *.split]
toastal has quit [*.net *.split]
ymherklotz has quit [*.net *.split]
richardhuxton has quit [*.net *.split]
pluviaq has quit [*.net *.split]
riverdc has quit [*.net *.split]
Leonidas has quit [*.net *.split]
gentauro has quit [*.net *.split]
cedb has quit [*.net *.split]
ns12 has quit [*.net *.split]
m5zs7k has quit [*.net *.split]
noonien has quit [*.net *.split]
tomku has quit [*.net *.split]
Everything has quit [*.net *.split]
midgard has quit [*.net *.split]
ridcully_ has quit [*.net *.split]
chrisz has quit [*.net *.split]
Putonlalla has quit [*.net *.split]
JSharp has quit [*.net *.split]
Duns_Scrotus___ has quit [*.net *.split]
caasih has quit [*.net *.split]
slothby has quit [*.net *.split]
Boarders___ has quit [*.net *.split]
thizanne has quit [*.net *.split]
conjunctive has quit [*.net *.split]
zebrag[m] has quit [*.net *.split]
mclovin has quit [*.net *.split]
lobo[m] has quit [*.net *.split]
MuqiuHan[m] has quit [*.net *.split]
farn has quit [*.net *.split]
daimrod1 has quit [*.net *.split]
greenbagels has quit [*.net *.split]
dinosaure has quit [*.net *.split]
jsoo has quit [*.net *.split]
mal``` has quit [*.net *.split]
hrberg has quit [Max SendQ exceeded]
patrick has quit [Write error: Connection reset by peer]
henrytill has joined #ocaml
richardhuxton has joined #ocaml
whereiseveryone has joined #ocaml
ymherklotz has joined #ocaml
_alix has joined #ocaml
pluviaq has joined #ocaml
immutable has joined #ocaml
philipwhite has joined #ocaml
patrick has joined #ocaml
Ankhers has joined #ocaml
ggb has joined #ocaml
jakzale has joined #ocaml
seeg has joined #ocaml
b0o has joined #ocaml
sleepydog has joined #ocaml
toastal has joined #ocaml
oisota has joined #ocaml
sim642 has joined #ocaml
hsw has joined #ocaml
grobe0ba has joined #ocaml
kronicma1 has joined #ocaml
darchitect has joined #ocaml
infinity0 has joined #ocaml
lobo has joined #ocaml
Wojciech_K has joined #ocaml
ds-ac has joined #ocaml
rwmjones has joined #ocaml
dstein64 has joined #ocaml
berberman has joined #ocaml
kurfen_ has joined #ocaml
haesbaert has joined #ocaml
czy has joined #ocaml
rak has joined #ocaml
Riviera has joined #ocaml
hannes_ has joined #ocaml
ridcully_ has joined #ocaml
midgard has joined #ocaml
tomku has joined #ocaml
Everything has joined #ocaml
m5zs7k has joined #ocaml
noonien has joined #ocaml
cedb has joined #ocaml
ns12 has joined #ocaml
riverdc has joined #ocaml
gentauro has joined #ocaml
greenbagels has joined #ocaml
jsoo has joined #ocaml
daimrod1 has joined #ocaml
mal``` has joined #ocaml
quernd8 has joined #ocaml
dinosaure has joined #ocaml
thizanne has joined #ocaml
conjunctive has joined #ocaml
Leonidas has joined #ocaml
Boarders___ has joined #ocaml
slothby has joined #ocaml
farn has joined #ocaml
Duns_Scrotus___ has joined #ocaml
caasih has joined #ocaml
Putonlalla has joined #ocaml
JSharp has joined #ocaml
TrillionEuroNote has joined #ocaml
nfc_ has joined #ocaml
John_Ivan_ has joined #ocaml
chrisz has joined #ocaml
SquidDev has joined #ocaml
hexology has joined #ocaml
CalimeroTeknik has joined #ocaml
Johann_ has joined #ocaml
theblatte has joined #ocaml
companion_cube has joined #ocaml
xgqt has joined #ocaml
pippijn has joined #ocaml
xenu has joined #ocaml
troydm has joined #ocaml
amk has joined #ocaml
noddy has joined #ocaml
MarvelousWololo has joined #ocaml
terrorjack has joined #ocaml
Soni has joined #ocaml
anpad has joined #ocaml
wagle has joined #ocaml
terrorjack has quit [Max SendQ exceeded]
Soni has quit [Max SendQ exceeded]
MarvelousWololo has quit [Max SendQ exceeded]
Soni has joined #ocaml
pieguy128 has quit [Max SendQ exceeded]
MarvelousWololo has joined #ocaml
terrorjack has joined #ocaml
welterde has joined #ocaml
ebb has joined #ocaml
delyan_ has joined #ocaml
octachron has joined #ocaml
GreaseMonkey has joined #ocaml
buoy49_ has joined #ocaml
mstevens has joined #ocaml
curium has joined #ocaml
emp has joined #ocaml
Armael has joined #ocaml
ebb has quit [Max SendQ exceeded]
Ankhers is now known as Guest1409
discocaml has joined #ocaml
Exa has joined #ocaml
justache has joined #ocaml
aljazmc has joined #ocaml
kitzman has joined #ocaml
energizer has joined #ocaml
Ekho has joined #ocaml
hrberg has joined #ocaml
mclovin has joined #ocaml
ebb has joined #ocaml
bartholin has joined #ocaml
MarvelousWololo has quit [Read error: Connection reset by peer]
spip has joined #ocaml
m5zs7k has quit [Ping timeout: 250 seconds]
m5zs7k has joined #ocaml
Serpent7776 has joined #ocaml
Tuplanolla has joined #ocaml
anpad has quit [Ping timeout: 260 seconds]
pandeyan has joined #ocaml
azimut has joined #ocaml
perrierjouet has quit [Quit: WeeChat 4.0.2]
kitzman has quit [Quit: C-x C-c]
kitzman has joined #ocaml
perrierjouet has joined #ocaml
kitzman has quit [Client Quit]
kitzman has joined #ocaml
Soni has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
Soni has joined #ocaml
bobo_ has joined #ocaml
spip has quit [Ping timeout: 245 seconds]
waleee has joined #ocaml
perrierjouet has quit [Quit: WeeChat 4.0.2]
perrierjouet has joined #ocaml
bgs has joined #ocaml
perrierjouet has quit [Quit: WeeChat 4.0.2]
waleee has quit [Ping timeout: 245 seconds]
waleee has joined #ocaml
Serpent7776 has quit [Ping timeout: 245 seconds]
wingsorc has quit [Remote host closed the connection]
Guest1409 is now known as Ankhers
MarvelousWololo has joined #ocaml
waleee has quit [Ping timeout: 264 seconds]
tomku has quit [Ping timeout: 250 seconds]
tomku has joined #ocaml
aljazmc has quit [Remote host closed the connection]
perrierjouet has joined #ocaml
<discocaml> <contificate> I'd recommend Appel's other series of books, Modern Compiler Implementation in ML (or C, or two editions in Java).
end^ has joined #ocaml
lobo[m] has joined #ocaml
reynir[m] has joined #ocaml
zebrag[m] has joined #ocaml
jmcantrell has joined #ocaml
MuqiuHan[m] has joined #ocaml
<discocaml> <contificate> Not that CwC doesn't have valuable treatment of certain topics, it's just you'd probably never faithfully lower down such a representation (as it implies a custom back-end, practically) and, to some extent, it's more of a non-beginner's pamphlet about the design of SMLNJ.
bgs has quit [Remote host closed the connection]
John_Ivan_ has quit [Ping timeout: 244 seconds]
kitzman has quit [Quit: C-x C-c]
kitzman has joined #ocaml
perrierjouet has quit [Quit: WeeChat 4.0.2]
perrierjouet has joined #ocaml
Anarchos has joined #ocaml
Serpent7776 has joined #ocaml
bartholin has quit [Ping timeout: 246 seconds]
bartholin has joined #ocaml
Anarchos has quit [Ping timeout: 245 seconds]
Anarchos has joined #ocaml
John_Ivan has joined #ocaml
perrierjouet has quit [Quit: WeeChat 4.0.2]
perrierjouet has joined #ocaml
bartholin has quit [Quit: Leaving]
<darchitect> hey guys, can someone please explain how type theory relates to the study of programming language design in laymen's terms, I think I've got a rough idea by now, but I would like to get more people's oppinions on it (i.e. more oppinions about how to best summarise the relationships between type theory and functional programming languages)
<discocaml> <contificate> I think the way Benjamin C. Pierce phrases it in the start of TAPL is apt.
<discocaml> <contificate> > A type system is a tractable syntactic method for proving the absence of
<discocaml> <contificate> > certain program behaviors by classifying phrases according to the kinds
<discocaml> <contificate> > of values they compute.
<darchitect> neat !@
<darchitect> what is TAPL ?
<discocaml> <contificate> If you're getting started, I recommend starting small. Can look at things like the Curry-Howard correspondence as it relates simple systems, like propositional logic and simply typed lambda calculus.
<discocaml> <contificate> TAPL is Pierce's book "Types and Programming Languages"
<darchitect> yeah i've done some functional programming already (Haskell + OCaml)
<darchitect> but I want to get deeper into the theory ...
<darchitect> would you recommend starting with TAPL or with PFPL (Harper)
<darchitect> ?
<discocaml> <contificate> If you want stronger theory, I recommend "Type Theory and Formal Proof". If you're a beginner beginner, TAPL is ideal.
<discocaml> <contificate> I think Harper is good but it's kind of _different_, everything in the book is Bob Harper'd in its exposition, if I recall correctly. Still a good book, and was recommended at my university.
<discocaml> <contificate> Practically speaking though, I believe earlier you said you wanted to implement a compiler/interpreter for a typed functional language in OCaml?
<darchitect> well I can code in both languages, but I still can't get throgh Edward Kmett's live coding streams without saying WTF at least 5 times in 1 minute :/
<darchitect> yeah I do !
<discocaml> <contificate> Yeah, so you can basically speedrun it.
<discocaml> <contificate> You would start by looking at simply typed lambda calculus and how its type system has a correspondence with propositional logic. Then, how to implement typechecking? You really just want a unification algorithm.
<darchitect> what is a unification algorithm ?
<discocaml> <contificate> (first-order) unification is basically trying to find "unifying" substitutions between two terms to make them equal
<discocaml> <contificate> so, this is important in polymorphic typechecking because you'll have types that have "unknowns" (type variables)
<discocaml> <contificate> and you'll need to be able to unify types together to work out which subterms ought to reflect/be the other subterm in the other term
<discocaml> <contificate> i.e. `Arrow('a, int)` and `Arrow(int, int)` have unifying substitution, `'a => int`
<darchitect> is type checking implemented manually for every type ?
<discocaml> <contificate> it does involve case analysis over type terms
<darchitect> that must be a huge case analysis
<darchitect> or is it simpler
<discocaml> <contificate> it's simpler
<discocaml> <contificate> the rules for typechecking something like simply typed lambda calculus are incredibly straightforward
<darchitect> oh so it's about decomposing everything into typed lc ?
<discocaml> <contificate> since the constraints that you collect during the algorithm are easy to express and globally propagate with destructive unification
<discocaml> <contificate> no, stlc is just a very simple type system to implement
<discocaml> <contificate> type systems have different properties which make them attractive (or not) - decidability, principality of inference, etc.
<darchitect> right it makes sense ..
<darchitect> and as part of language implementation we implement the constraints by case analysis?
<discocaml> <contificate> helps if you can read inference rules, as, when read bottom to top, they kind of mirror how many inference algorithms are shaped/implemented
<discocaml> <contificate> well, there's implicit constraints right which are captured by unification patterns
<discocaml> <contificate> for example, if you're typechecking `f x`, i.e. `App(f, x)` for some `f` and `x` (both lambda terms/expressions)
<discocaml> <contificate> you know that no matter what, `f` must have an arrow type (`x -> y` for some `x` and `y`)
<darchitect> true
<discocaml> <contificate> and you know that its domain type must match that of what it's being applied to
<darchitect> what is a domain type ?
<discocaml> <contificate> if a function is an arrow `X -> Y`, then `domain(f)` = `X`
<darchitect> oh right yeah
<darchitect> (y)
<discocaml> <contificate> so this is like trivial in many cases, and captured wholly by how we unify out the application's type
<darchitect> yeah then the rule makes sense
<darchitect> can you point me to an example implementation of simply typed lambda calculus (or even untyped lambda calculus) (as in github repo) ?
<discocaml> <contificate> ```ocaml
<discocaml> <contificate> App (f, x) ->
<darchitect> I would like to read through the code to get more understanding
<discocaml> <contificate> let f_ty = infer env f in
<discocaml> <contificate> let x_ty = infer env x in
<discocaml> <contificate> let r_ty = fresh_type_variable () in
<discocaml> <contificate> infer f_ty (Arrow (x_ty, r_ty)); (* captures case that f must be another Arrow to be unified against an Arrow *)
<discocaml> <contificate> r_ty
<discocaml> <contificate> ```
<discocaml> <contificate> ```ocaml
<discocaml> <contificate> App (f, x) ->
<discocaml> <contificate> let f_ty = infer env f in
<discocaml> <contificate> let x_ty = infer env x in
<discocaml> <contificate> let r_ty = fresh_type_variable () in
<discocaml> <contificate> unify f_ty (Arrow (x_ty, r_ty)); (* captures case that f must be another Arrow to be unified against an Arrow *)
<discocaml> <contificate> r_ty
<discocaml> <contificate> ```
<discocaml> <contificate> sorry, I meant to call `unify` in that snippet
<discocaml> <contificate> anyway, we prolly misusing this channel
<darchitect> hahah yeah
<darchitect> thanks anyway
<darchitect> I will look into the example
<discocaml> <contificate> no worries, if you understand first-order unification as a concept and why it's used
<discocaml> <contificate> you may benefit from just looking over and learning from https://okmij.org/ftp/ML/generalization/sound_eager.ml
<discocaml> <contificate> of course, should learn it from the basics (so you can read inference rules etc.) https://en.wikipedia.org/wiki/Simply_typed_lambda_calculus
<discocaml> <contificate> sound_eager is for a subset of Hindley-Milner though, but you can easily simplify it out to be an STLC impl, which just wouldn't have a generalisation or instantiation
<discocaml> <contificate> can find other treatment of what's presented in sound_eager in (French) 'Le Language Caml' or 'Functional Approach to Programming'
<darchitect> thanks !!
Serpent7776 has quit [Ping timeout: 240 seconds]
azimut has quit [Remote host closed the connection]
azimut has joined #ocaml
Tuplanolla has quit [Quit: Leaving.]
Anarchos has quit [Quit: Vision[]: i've been blurred!]
uncomfy has joined #ocaml