“there's a paper on it that actually is readable instead of just all whitepapery and overly-theoretical”
Modular implicits
为 OCaml 加入类型驱动的隐式模块参数,实现特设多态
论文提出 modular implicits,一种受 Scala implicits 和模块化 type class 启发的 OCaml 语言扩展,用于特设多态(ad-hoc polymorphism)。它基于类型驱动的隐式模块参数,可直接展开为 OCaml 的一等 functor,因此天然支持继承、实例约束、constructor class 和 associated types 等其他语言中的特性。
HN 上的人把它当作在 ML 模块的灵活性和 type class 的便利重载之间取得务实平衡的方案,并称论文本身好读、不空谈理论。
HN 书评
推荐在前,同类按时间 · 每篇最多保留 20 条,统计用全部提及“if anyone's keen on reading the paper behind modular implicits in OCaml, its a fun read”
“This is really exciting because modular implicits represent a pragmatic balance between the flexibility of ML modules and the convenient overloading of type classes.”
“One nice solution is modular implicits/instance arguments [1][2].”
“check out this lovely paper about Modular Implicits in OCaml [1]. The paper is quite accessible if you have some FP background.”
“I hadn't seen a great type-safe way to support ad hoc polymorphism until I read about [modular implicits][1] in OCaml.”
看全部 12 条 →
“Modular implicits are described here: Modular implicits.”
“modular implicits aim to make this better (see Modular implicits)”
“As a layman I would describe them as implicits like in current Scala [0] but better (easier to reason about).”
“There's more to it than that [7].”
“The original paper was published in 2014.”
“No typeclasses, yes, for the moment but the first step of Modular implicits is under review”
- Modular implicits for ad-hoc polymorphism in OCaml ↗eatonphil · 2015-12-12 · 1 分