Does Haskell support object oriented programming

后端 未结 5 560
栀梦
栀梦 2020-12-13 00:03

Does it support concepts like separation of declaration and implementation (interfaces and classes in Java)?

How about restricting access (like access modifiers in J

5条回答
  •  有刺的猬
    2020-12-13 00:48

    See Haskell's Overlooked Object System by Oleg Kiselyov and Ralf Laemmel for a detailed explanation of how OO concepts can be implemented in Haskell. But as Antal said in the comments, don't try to write a Java program in Haskell.

    Remember that objects are a poor man's closure, and closures are a poor man's object.

提交回复
热议问题