companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 5.2.0 released: https://ocaml.org/releases/5.2.0 | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
Tuplanolla has quit [Quit: Leaving.]
pippijn has quit [Ping timeout: 245 seconds]
pippijn has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
Mister_Magister has quit [Quit: bye]
deadmarshal_ has quit [Remote host closed the connection]
Mister_Magister has joined #ocaml
deadmarshal_ has joined #ocaml
Guest56 has quit [Ping timeout: 240 seconds]
Guest56 has joined #ocaml
agentcasey has quit [Quit: ZNC 1.10.x-git-27-bfd731cf - https://znc.in]
agentcasey has joined #ocaml
myrkraverk_ has joined #ocaml
myrkraverk__ has joined #ocaml
myrkraverk_ has quit [Read error: Connection reset by peer]
myrkraverk has quit [Ping timeout: 246 seconds]
myrkraverk has joined #ocaml
myrkraverk__ has quit [Ping timeout: 248 seconds]
myrkraverk_ has joined #ocaml
myrkraverk has quit [Ping timeout: 244 seconds]
Serpent7776 has joined #ocaml
YuGiOhJCJ has quit [Quit: YuGiOhJCJ]
hsw_ has quit [Read error: Connection reset by peer]
hsw_ has joined #ocaml
bartholin has joined #ocaml
rgrinberg has joined #ocaml
rgrinberg has quit [Client Quit]
Haudegen has joined #ocaml
olle has joined #ocaml
bartholin has quit [Quit: Leaving]
spynxic has quit [Quit: Free ZNC ~ Powered by LunarBNC: https://LunarBNC.net]
spynxic has joined #ocaml
<olle> "A list is a functor, who's associated map function is to apply a function to every element in the list."
* olle sigh
<olle> Even in Haskell parlour, this must be nonsense.
<Putonlalla> Yeah, it should say "whose".
<olle> Hehe
alexherbo2 has joined #ocaml
infinity0 has quit [Ping timeout: 252 seconds]
keyboard has quit [Ping timeout: 245 seconds]
salkin has joined #ocaml
infinity0 has joined #ocaml
spynxic has quit [Quit: Free ZNC ~ Powered by LunarBNC: https://LunarBNC.net]
pi3ce has quit [Read error: Connection reset by peer]
pi3ce has joined #ocaml
bartholin has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
Guest56 has quit [Quit: Client closed]
gentauro has quit [Read error: Connection reset by peer]
gentauro has joined #ocaml
spynxic has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
<discocaml_> <diligentclerk> It's nonsense. A list is not a functor. The list type constructor List.t is a functor.
alexherbo2 has joined #ocaml
<olle> diligentclerk, you know the haskell lingo too?
<olle> I think even C++ has its own def of "functor"
alexherbo2 has quit [Remote host closed the connection]
<discocaml_> <diligentclerk> I actually came to OCaml via mathematics and formal logic, so I know some of this language from mathematics. I haven't programmed in Haskell.
Haudegen has joined #ocaml
<olle> Mm ok, thanks :)
<discocaml_> <diligentclerk> The Haskell usage of "functor" is the closest to category theory, IMO. It can be taken literally.
<discocaml_> <diligentclerk> I suspect OCaml functors are named by analogy with category theory, because functors are functions that send "big objects" (modules, types) to "big objects", by contrast with ordinary value-level functions between types. This is a good metaphor even if module functors aren't "mappable" in the sense that the List.t type constructor is.
<discocaml_> <diligentclerk> If I had to guess, from skimming the C++ def, they are borrowing the word "functor" from Carnap and it has nothing to do with category theory.
<discocaml_> <diligentclerk> A Haskell functor is any module implementing the signature `sig type 'a t val map : ('a -> 'b) -> ('a t -> 'b a) end`.
<olle> diligentclerk, oh that's not too far off from original comment!
<olle> But completely different from OCaml usage
<discocaml_> <diligentclerk> Yes.
<discocaml_> <diligentclerk> An example of a polymorphic type constructor which is not a functor is `'type 'a t = 'a -> 'a`.
<discocaml_> <diligentclerk> But, very many polymorphic type constructors are indeed functors
<olle> Got it
<discocaml_> <diligentclerk> I guess to expand a bit, there are a few closely related signatures whose modules I would also call functors, such as:
<discocaml_> <diligentclerk>
<discocaml_> <diligentclerk> `sig type ('a, 'b, 'c) t
<discocaml_> <diligentclerk> val map : ('a0 -> 'a1) -> ('b0 -> 'b1) -> ('c0 -> 'c1) -> ('a0, 'b0, 'c0) t -> ('a1, 'b1, 'c1) t end`
<discocaml_> <diligentclerk>
<discocaml_> <diligentclerk> and so-called "contravariant functors" of module type
<discocaml_> <diligentclerk> `sig type 'a t
<discocaml_> <diligentclerk> val map ('b -> 'a) -> 'a t -> 'b t`
<discocaml_> <diligentclerk> for example, `type 'a t = 'a -> int` is a contravariant functor.
<Putonlalla> That is a good explanation, but I want to point out that (1) the mapping has to obey some laws to qualify as a functor implementation and (2) a type can sometimes admit more than one lawful functor implementation.
hwj has joined #ocaml
hwj has quit [Client Quit]
<discocaml_> <yawaramin> olle: 'Even in Haskell parlour, this must be nonsense.' where is it from?
<olle> yawaramin, ah just some guy on /r/php subreddit
<olle> or girl
<discocaml_> <yawaramin> Crell by any chance?
<olle> yawaramin, nah, Crell would know better I think ^^
<olle> diligentclerk, pretty complex :d
ygrek has joined #ocaml
olle has quit [Ping timeout: 276 seconds]
Serpent7776 has quit [Ping timeout: 252 seconds]
Haudegen has quit [Quit: Bin weg.]
Haudegen has joined #ocaml
nickiminjaj has joined #ocaml
nickiminjaj has quit [Client Quit]
nickiminjaj has joined #ocaml
nickiminjaj is now known as ol0ck
ol0ck_ has joined #ocaml
ol0ck has quit [Quit: Textual IRC Client: www.textualapp.com]
ol0ck_ is now known as ol0ck
nickiminjaj has joined #ocaml
nickiminjaj has quit [Client Quit]
ol0ck has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
ol0ck has joined #ocaml
Anarchos has joined #ocaml
szkl has joined #ocaml
bartholin has quit [Ping timeout: 248 seconds]
bartholin has joined #ocaml
Anarchos has quit [Quit: Vision[]: i've been blurred!]
Haudegen has quit [Quit: No Ping reply in 180 seconds.]
Haudegen has joined #ocaml
Everything has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
pi3ce has quit [Read error: Connection reset by peer]
pi3ce has joined #ocaml
Guest56 has joined #ocaml
ygrek has quit [Remote host closed the connection]
Tuplanolla has joined #ocaml
mange has joined #ocaml
bartholin has quit [Quit: Leaving]