How much time have you invested in order to have a good grasp on Haskell?

I know this question may sound silly, but I am learning (at least trying) Haskell for about 4 days. I've already finished to read http://learnyouahaskell.com/, and now I am investing time in: The Haskell Road to Logic, Math and Programming, and things got really complicated for me. I don't have experience in functional programming, just some basic knowledge on Lisp. Even though I unde

你花了多少时间才能掌握Haskell?

我知道这个问题可能听起来很愚蠢,但我正在学习(至少尝试)Haskell大约4天。 我已经完成了http://learnyouahaskell.com/的阅读,现在我正在投入时间:Haskell逻辑,数学和编程之路,对我来说事情变得非常复杂。 我在函数式编程方面没有经验,只是一些关于Lisp的基础知识。 尽管我理解了这些概念,但是当我不得不写一些基本的代码时,总会有一片黑暗,我无法制定一个计划。 似乎有很多方法可以完成某项任务,但我无法表达自

Why sum x y is of type (Num a) => a

I've been reading about Haskell and I'm having a hard time understanding how function definitions are handled in this language. Let's say I'm defining a sum function: let sum x y = x + y if I query Haskell for its type :t sum I get sum :: (Num a) => a -> a -> a What does it mean the => operator? Does it have anything to do with lambda expressions? That's

为什么总和xy是类型(数字a)=> a

我一直在阅读关于Haskell的内容,我很难理解函数定义是如何在这种语言中处理的。 假设我正在定义一个sum函数: let sum x y = x + y 如果我查询Haskell的类型 :t sum 我明白了 sum :: (Num a) => a -> a -> a 这是什么意思=>运营商? 它与lambda表达式有什么关系? 这就是C#中的一种信号,即=>运算符后面的内容是一个。 a -> a -> a是什么意思? 通过对一些不同功能的检查,我一直在尝试,似

What's the next step to learning Haskell after monads?

I've been gradually learning Haskell, and even feel like I've got a hang of monads. However, there's still a lot of more exotic stuff that I barely understand, like Arrows, Applicative, etc. Although I'm picking up bits and pieces from Haskell code I've seen, it would be good to find a tutorial that really explains them wholly. (There seem to be dozens of tutorials on monads

单子之后学习Haskell的下一步是什么?

我一直在逐渐学习Haskell,甚至觉得我有一堆monad。 然而,我仍然有很多很难理解的奇特东西,比如Arrows,Applicative等等。虽然我从Haskell代码中汲取了一些我见过的东西,但最好找到一个真正解释的教程他们完全。 (似乎有数十个关于单子的教程..但是一切似乎都是在那之后完成的!) 下面是我在“获取monad”之后发现的一些有用的资源: 正如SuperBloup指出的那样,Brent Yorgey的Typeclassopedia是不可或缺的(事实上它确

Haskell vs. procedural programming in the real world

These days I'm getting seriously into functional programming. While I'm really excited about Haskell and the possibilities it seems to offer, I can also see now that it is going to take me a while to learn. In an SO question on How to learn Haskell an answer states that it'll take months if not years to actually "master" it. Now, I know C, PHP, some object oriented stuf

Haskell与现实世界中的程序编程

这些天我正在认真研究函数式编程。 尽管我对Haskell以及它似乎提供的可能性非常兴奋,但我现在也可以看到,它需要我花一些时间来学习。 在关于如何学习Haskell的SO问题中,一个答案指出,如果不是几年,实际“掌握”它将需要几个月的时间。 现在,我知道C,PHP,一些面向对象的东西等等。有人告诉我,Haskell在“真实世界”中用处不大,我是否更擅长提高我熟悉的常规语言的技能? 哈斯克尔值得奋斗吗? 在这个关于为什么人们

Find function source in Haskell (workflow)

I'm learning Haskell for a while, so I've decided to inspect some popular project to get a feeling how it looks like in reality and perhaps reverse-engineer the process. I've picked Hakyll because it does something I'm familiar with and is moderately complex. And then I've stucked immediately with the question: how to backtrace imports? Say, In JavaScript every import is

在Haskell中查找函数源(工作流)

我正在学习Haskell一段时间,所以我决定检查一些受欢迎的项目,以感受它在现实中的外观,并可能对该过程进行逆向工程。 我选择了Hakyll,因为它做了我熟悉的事情,并且适度复杂。 然后我马上回答了这个问题:如何回溯进口? 说,在JavaScript中,每个导入都是明确的。 let Q = require("Q") // namespace let {foo} = require("Q/foo") // value Haskell默认为 import Q 这一次破坏了一切,人们似乎真的会滥用

Is there a nice way to make function signatures more informative in Haskell?

I realize that this could potentially be considered a subjective or maybe an off-topic question, so I hope that rather than have it closed it would get migrated, maybe to Programmers. I'm starting to learn Haskell, mostly for my own edification, and I like a lot of the ideas and principles backing the language. I became fascinated with functional languages after taking a language theory cl

有没有一种很好的方法可以让函数签名在Haskell中更丰富?

我意识到这可能被认为是一种主观的或者是一个脱离主题的问题,所以我希望它不会被封闭,而是会被迁移,也许会被程序员所接受。 我开始学习Haskell,主要是为了我自己的启发,我喜欢支持这种语言的很多想法和原则。 在参加Lisp的语言理论课之后,我开始对函数式语言着迷,而且我听到很多关于Haskell生产效率的好消息,所以我想我会自己调查一下。 到目前为止,我喜欢这种语言,除了我无法摆脱的一件事:那些母亲正在执行功能

Prolog vs. Haskell

This is not a homework question, rather an exam study guide question. What is the difference between pattern matching in Prolog Vs Haskell? I've done some research and reading up on the theories behind them doesn't really give me a solid understanding between the two. I read that in Prolog, pattern matching is different because it has the ability to unify variables and thus be able to

Prolog与Haskell

这不是一个家庭作业问题,而是考试学习指导问题。 Prolog与Haskell中的模式匹配有什么区别? 我已经做了一些研究,阅读其背后的理论并不能让我在两者之间有一个明确的理解。 我在Prolog中读到,模式匹配是不同的,因为它具有统一变量的能力,从而能够通过分辨率推断并吐出可能的答案 eg ?- [a,b] = [a,X] X = b 现在我不确定如何在Haskell中显示模式匹配。 我知道在Prolog中显示的同一个查询在Haskell中不起作用,因为

What language to learn after Haskell?

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 lear

Haskell学什么语言?

作为我的第一门编程语言,我决定学习Haskell。 我是分析哲学专业,Haskell允许我快速正确地创建感兴趣的程序,例如自然语言分析的转换器,定理证明器和解释器。 尽管我只编写了两个半月的编程,但我发现Haskell的语义和语法比传统的命令式语言更容易学习,并且对其大部分结构感到舒适(现在)。 Haskell编程就像巫术一样,然而,我想扩大我对编程的知识。 我想选择一种新的编程语言来学习,但我没有足够的时间去选择一种任

Haskell counted list type

So, just for fun, I've been playing with a CountedList type in Haskell, using Peano numbers and smart constructors. Type-safe head and tail just seem really cool to me. And I think I've reached the limit of what I know how to do {-# LANGUAGE EmptyDataDecls #-} module CountedList ( Zero, Succ, CountedList, toList, ofList, empty, cons, uncons, head, tail, fmap, map, foldl,

Haskell计算列表类型

所以,为了好玩,我一直在Haskell中使用CountedList类型,使用Peano数字和智能构造函数。 类型安全的head和tail对我来说似乎很酷。 我想我已经达到了我知道如何去做的极限 {-# LANGUAGE EmptyDataDecls #-} module CountedList ( Zero, Succ, CountedList, toList, ofList, empty, cons, uncons, head, tail, fmap, map, foldl, foldr, filter ) where import qualified List (foldr, foldl, filter) import P

Sufficient conditions for foldl and foldr equivalence

Consider the expressions E1 = foldl op acc l and E2 = foldr op acc l . What are some natural sufficient conditions for op , acc and/or l that guarantee the equivalence of E1 and E2 ? A naive example would be that if op is constant then both are equivalent. I'm pretty sure there must be precise conditions involving commutativity and/or associativity of op , and/or finitude of l , and/or

foldl和foldr等价的充分条件

考虑表达式E1 = foldl op acc l和E2 = foldr op acc l 。 op , acc和/或l自然充分条件是什么保证了E1和E2的等价性? 一个天真的例子是,如果op是不变的,那么两者是等价的。 我非常肯定,必须有精确的条件,包括交换性和/或op关联性,和/或l有限性,和/或acc中立性。 如果op是关联操作, acc是op的中性元素, l是有限的,那么它们是等价的。 的确, foldr的结果是 (l1 `op` (l2 `op` ... (ln `op` acc))) 而foldl是