Haskell学什么语言? [英] What language to learn after Haskell?

查看:106
本文介绍了Haskell学什么语言?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为我的第一门编程语言,我决定学习Haskell。我是分析哲学专业,Haskell允许我快速正确地创建感兴趣的程序,例如自然语言分析的转换器,定理证明器和解释器。虽然我只编程了两个半月,但我发现Haskell的语义和语法比传统的命令式语言更容易学习,并且对于其大部分构造而言(现在)感到舒适。



然而,Haskell中的编程就像巫术一样,我想扩大编程知识。我想选择一种新的编程语言来学习,但我没有足够的时间去选择一种任意的语言,放弃它,然后重复。所以我想我会在这里提出这个问题,以及关于我正在寻找的语言类型的几个规定。有些是主观的,有些旨在缓解从Haskell的转换。




  • 强类型系统。 Haskell编程中我最喜欢的部分之一是编写类型声明。这有助于构建我对个人职能及其与整个计划的关系的思考。它也使得我的程序的正确性更容易推理。我关心正确性,而不是效率。

  • 强调递归而不是迭代。我在Haskell中使用迭代构造,但递归地实现它们。但是,理解递归函数的结构要比复杂的迭代过程容易得多,特别是在使用组合器和更高阶函数(如地图,折叠和绑定)时。
  • 奖励学习。 Haskell是一种有益的语言,有点像阅读康德。然而,我几年前与C的经历并非如此。我不是在寻找C.语言应该强化一个概念上有趣的范例,在我的完全主观的观点中,C-likes没有。



称重答案:当然,这些只是笔记。我只想回复给出格式正确的回复。你有很大的帮助。
$ b $ 1)几个回应表明,强调递归的静态类型语言意味着另一种功能语言。虽然我想继续与Haskell强烈合作,但Camccann和larsmans正确地指出,另一种这样的语言将缓解过渡太多。这些评论非常有帮助,因为我不打算在Caml编写Haskell!在证明助理中,Coq和Agda看起来都很有趣。特别是,Coq将为建构逻辑和形式类型理论提供一个坚实的介绍。我花了一点时间用一阶谓词和模态逻辑(Mendellsohn,Enderton,一些辛曼的),所以我可能会有很多与Coq的乐趣。



< 2)其他人非常青睐Lisp(Common Lisp,Scheme和Clojure)。从我收集的内容来看,Common Lisp和Scheme都有很好的介绍材料( On Lisp The Reasoned Schemer SICP )。 SICP 中的材料使我倾向于Scheme。特别是,通过 SICP 的计划将涵盖不同的评估策略,实施懒惰以及专注于延续,解释器,符号计算等主题的机会。最后,正如其他人所指出的,Lisp对代码/数据的处理将是全新的。因此,我倾向于选择(2),一个Lisp。

第三,Prolog。 Prolog有很多有趣的材料,它的 primary 域正是我感兴趣的域。它有一个简单的语法并且易于阅读。目前我无法评论更多,但在阅读了Prolog的概述并略读了一些介绍性材料之后,它与(2)进行了排名。而且似乎Prolog的回溯总是被黑客攻入Haskell! 4)在主流语言中,Python看起来最有趣。蒂姆耶茨使语言听起来非常有吸引力。显然,Python经常被教给第一年的CS专业;所以它在概念上很丰富或者易于学习。我必须做更多的研究。



谢谢大家的建议!它看起来像一个Lisp(方案,Clojure的),PROLOG,或者证明助理等Coq的或阿格达是被推荐的主要langauages。


解决方案


我想扩大编程知识。 (...)我想我会在这里提出这个问题,以及关于我正在寻找的语言类型的几个规定。有些是主观的,有些是为了缓解Haskell的过渡。



强类型系统。 (...)它也使我的程序的正确性非正式推理更容易。我关心正确性,而不是效率。



强调递归而不是迭代。 (...)


恐怕您可能在这里稍稍缓解了一些过渡。非常严格的类型系统和纯粹的功能风格是Haskell的特点,几乎任何类似于主流编程语言的东西都需要对其中的一种进行妥协。所以,考虑到这一点,下面是一些广泛的建议,旨在保留你对Haskell的看法,但有一些重大转变。



'UL>
  • 否认实用性和去 比哈斯克尔更多的哈斯克尔:Haskell的类型系统是千疮百孔,由于nontermination和其他乱七八糟的妥协。清理混乱并添加更强大的功能,并且您可以使用 Coq Agda 等语言,其中函数的类型包含其正确性的证明(您甚至可以阅读函数arrow - > 作为逻辑含义!)。这些语言已被用于数学证明和具有极高正确性要求的程序。 Coq可能是该风格中最突出的语言,但Agda拥有更多的Haskell-y感觉(以及Haskell自己写的)。 strong>无视类型,添加更多魔力:如果Haskell是巫术, Lisp 是创造的原始魔力。 Lisp-family语言(还包括 Scheme Clojure )具有极其灵活的极致风格。这些语言基本上没有语法,直接以树数据结构的形式编写代码;元语言编程在Lisp中比在某些语言中使用非元编程更容易。

  • 稍微折服一下并向主流靠拢: Haskell属于广泛受ML影响的语言家族,其中任何一种你都可以在没有的情况下转移到很多难度上。 Haskell是关于类型和功能风格使用的正确性保证的最严格的方法之一,其他方面往往是混合风格和/或出于各种原因做出务实的妥协。如果您想要接触OOP并访问大量主流技术平台,则JVM上的 Scala 或.NET上的 F#与Haskell有许多共同之处,同时提供了简单与Java和.NET平台的互操作性。 F#由Microsoft直接支持,但与Haskell相比有一些令人讨厌的局限性,并且在非Windows平台上存在可移植性问题。 Scala有直接的同行更多Haskell的类型系统和Java的跨平台的潜力,但有一个更重量级的语法和缺乏强大的第一方支持,F#享有。




    这些建议中的大部分也在其他答案中提及,但希望我对它们的理由提供了一些启示。


    As my first programming language, I decided to learn Haskell. I'm an analytic philosophy major, and Haskell allowed me to quickly and correctly create programs of interest, for instance, transducers for natural language parsing, theorem provers, and interpreters. Although I've only been programming for two and a half months, I found Haskell's semantics and syntax much easier to learn than more traditional imperative languages, and feel comfortable (now) with the majority of its constructs.

    Programming in Haskell is like sorcery, however, and I would like to broaden my knowledge of programming. I would like to choose a new programming language to learn, but I do not have enough time to pick up an arbitrary language, drop it, and repeat. So I thought I would pose the question here, along with several stipulations about the type of language I am looking for. Some are subjective, some are intended to ease the transition from Haskell.

    • Strong type system. One of my favorite parts of programming in Haskell is writing type declarations. This helps structure my thoughts about individual functions and their relationship to the program as a whole. It also makes informally reasoning about the correctness of my program easier. I'm concerned with correctness, not efficiency.
    • Emphasis on recursion rather than iteration. I use iterative constructs in Haskell, but implement them recursively. However, it is much easier to understand the structure of a recursive function than a complicated iterative procedure, especially when using combinators and higher-order functions like maps, folds and bind.
    • Rewarding to learn. Haskell is a rewarding language to work in. It's a little like reading Kant. My experience several years ago with C, however, was not. I'm not looking for C. The language should enforce a conceptually interesting paradigm, which in my entirely subjective opinion, the C-likes do not.

    Weighing the answers: These are just notes, of course. I'd just like to reply to everyone who gave well-formed responses. You have been very helpful.

    1) Several responses indicated that a strong, statically typed language emphasizing recursion means another functional language. While I want to continue working strongly with Haskell, camccann and larsmans correctly pointed out that another such language would "ease the transition too much." These comments have been very helpful, because I am not looking to write Haskell in Caml! Of the proof assistants, Coq and Agda both look interesting. In particular, Coq would provide a solid introduction to constructive logic and formal type theory. I've spent a little time with first-order predicate and modal logic (Mendellsohn, Enderton, some of Hinman), so I would probably have a lot of fun with Coq.

    2) Others heavily favored Lisp (Common Lisp, Scheme and Clojure). From what I gather, both Common Lisp and Scheme have excellent introductory material (On Lisp and The Reasoned Schemer, SICP). The material in SICP causes me to lean towards Scheme. In particular, Scheme through SICP would cover a different evaluation strategy, the implementation of laziness, and a chance to focus on topics like continuations, interpreters, symbolic computation, and so on. Finally, as others have pointed out, Lisp's treatment of code/data would be entirely new. Hence, I am leaning heavily towards option (2), a Lisp.

    3) Third, Prolog. Prolog has a wealth of interesting material, and its primary domain is exactly the one I'm interested in. It has a simple syntax and is easy to read. I can't comment more at the moment, but after reading an overview of Prolog and skimming some introductory material, it ranks with (2). And it seems like Prolog's backtracking is always being hacked into Haskell!

    4) Of the mainstream languages, Python looks the most interesting. Tim Yates makes the languages sound very appealing. Apparently, Python is often taught to first-year CS majors; so it's either conceptually rich or easy to learn. I'd have to do more research.

    Thank you all for your recommendations! It looks like a Lisp (Scheme, Clojure), Prolog, or a proof assistant like Coq or Agda are the main langauages being recommended.

    解决方案

    I would like to broaden my knowledge of programming. (...) I thought I would pose the question here, along with several stipulations about the type of language I am looking for. Some are subjective, some are intended to ease the transition from Haskell.

    Strong type system. (...) It also makes informally reasoning about the correctness of my program easier. I'm concerned with correctness, not efficiency.

    Emphasis on recursion rather than iteration. (...)

    You may be easing the transition a bit too much here, I'm afraid. The very strict type system and purely functional style are characteristic of Haskell and pretty much anything resembling a mainstream programming language will require compromising at least somewhat on one of these. So, with that in mind, here are a few broad suggestions aimed at retaining most of what you seem to like about Haskell, but with some major shift.

    • Disregard practicality and go for "more Haskell than Haskell": Haskell's type system is full of holes, due to nontermination and other messy compromises. Clean up the mess and add more powerful features and you get languages like Coq and Agda, where a function's type contains a proof of its correctness (you can even read the function arrow -> as logical implication!). These languages have been used for mathematical proofs and for programs with extremely high correctness requirements. Coq is probably the most prominent language of the style, but Agda has a more Haskell-y feel (as well as being written in Haskell itself).

    • Disregard types, add more magic: If Haskell is sorcery, Lisp is the raw, primal magic of creation. Lisp-family languages (also including Scheme and Clojure) have nearly unparalleled flexibility combined with extreme minimalism. The languages have essentially no syntax, writing code directly in the form of a tree data structure; metaprogramming in a Lisp is easier than non-meta programming in some languages.

    • Compromise a bit and move closer to the mainstream: Haskell falls into the broad family of languages influenced heavily by ML, any of which you could probably shift to without too much difficulty. Haskell is one of the strictest when it comes to correctness guarantees from types and use of functional style, where others are often either hybrid styles and/or make pragmatic compromises for various reasons. If you want some exposure to OOP and access to lots of mainstream technology platforms, either Scala on the JVM or F# on .NET have a lot in common with Haskell while providing easy interoperability with the Java and .NET platforms. F# is supported directly by Microsoft, but has some annoying limitations compared to Haskell and portability issues on non-Windows platforms. Scala has direct counterparts to more of Haskell's type system and Java's cross-platform potential, but has a more heavyweight syntax and lacks the powerful first-party support that F# enjoys.

    Most of those recommendations are also mentioned in other answers, but hopefully my rationale for them offers some enlightenment.

    这篇关于Haskell学什么语言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆