学习Haskell以学习Scala [英] Learning Haskell with a view to learning Scala

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

问题描述

我读过一些问题,比如斯卡拉vs哈斯克尔讨论两种语言的优点或者学习什么,但我已经知道我想学习斯卡拉。我是uni的Java程序员,现在主要使用PHP。

我想学习Scala,因为它看起来像是个人项目的Java改进,我也想学习一种函数式语言来提高我作为程序员的知识。

我想知道学习Haskell作为函数式编程的入门是个好主意,因为它是纯粹的函数,所以我会正确地学习它,而不是随意使用不知道为什么在斯卡拉功能位?

我也想用Haskell做个人项目等,因为它看起来不错,但我真的没有看到它的许多真实世界的应用程序,似乎更多用于学术的东西,因此想学习它,以获得功能的理解,然后转移到Scala。

解决方案

,并且斯卡拉是Haskell的门户药物,我碰巧认为这是一个好主意(首先学习Haskell)!

Haskell在概念上是一种比Scala简单得多的语言,如果您的目标是学习如何在功能上进行编程,那么如果您从Haskell开始。通过设计,Scala支持一种编码的遗留模式,如果你不想要,你不必真的改变你的Java(或PHP)习惯。我认为这是一个战略决策 - 而且是一个很好的决定! - 意味着增加硬壳Java中坚分子的采用。



但那不是你!你真的对感兴趣学习新东西......为什么不全力以赴?在纯粹的环境中学习函数式编程,没有混乱和回归旧习惯的诱惑,将会使你的大脑中的概念明确化。然后通过一切手段返回到Scala并了解它与Haskell的区别。它在某些方面比较弱,而在其他方面则更强,但你们将会更好地理解这些差异。


I've read a few questions such as Scala vs Haskell discussing the merits of both languages or which to learn, but I already know that I'd like to learn Scala. I was a Java programmer at uni and now mainly use PHP.

I want to learn Scala as it looks like an improvement on Java for personal projects and I'd also like to learn a functional language to improve my knowledge as a programmer.

I am wondering if it would be a good idea to learn Haskell as an introduction to functional programming as it is purely functional so I'd properly learn it rather than haphazard using bits of functional in Scala without knowing why?

I'd also like to use Haskell for personal projects etc as it looks great, but I don't really see many real world applications of it, seems more used for academic stuff hence wanting to learn it to get the functional understanding then move on to Scala.

解决方案

Speaking as someone who came from Java, and for whom Scala was a gateway drug to Haskell, I happen to think this is a great idea (learn Haskell first)!

Haskell is conceptually a much simpler language than Scala, and if your goal is to learn how to program functionally, you can't help but do so if you start with Haskell. By design, Scala supports a kind of "legacy mode" of coding in which you don't really have to change your Java (or PHP) habits too much if you don't want to. I think this is a strategic decision--and a good one!--meant to increase adoption amongst crusty Java stalwarts.

But that's not you! You're actually interested in learning something new... so why not go all-out? Learning functional programming in a pure setting, without the clutter and the temptation to regress into old habits, will crystallize the concepts in your brain.

Then by all means return to Scala and learn how it differs from Haskell; it is both weaker in some respects and stronger in others, but you will then be on a much better foundation to appreciate these differences.

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

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