haskell

为何选择功能语言[关闭]

最后都变了- 提交于 2020-03-11 21:57:09
我在这里看到很多关于函数式语言和东西的讨论。 你为什么要使用“传统”语言? 他们做得更好? 他们更糟糕的是什么? 什么是理想的函数式编程应用程序? #1楼 我会指出你所说的关于函数式语言的所有内容,大多数人在大约20年前都在谈论面向对象的语言。 那时候听到OO很常见: * The average corporate programmer, e.g. most of the people I work with, will not understand it and most work environments will not let you program in it * It's not really taught at universities (or is it nowadays?) * Most applications are simple enough to be solved in normal IMPERATIVE ways 改变必须来自某个地方。 无论受过早期技术培训的人是否认为不需要进行变革,一项有意义且重要的变革将使自己发生。 你是否认为尽管当时所有反对它的人都对OO的改变是好的? #2楼 如果他不能看到其他艺术的价值,他就无法理解他所选艺术的完美和不完美。 遵循规则只允许在技术上达到一定程度,然后学生和艺术家必须学习更多并进一步寻求。

how to parse json with field of optional and variant type in Haskell?

假装没事ソ 提交于 2020-03-06 09:31:15
问题 How I can parse the input json inside this file ? https://github.com/smogon/pokemon-showdown/blob/master/data/moves.js For the secondary and flags properties? They are optional and contains variant type. A minimal example would be this one: [ {}, { "secondary": false }, { "secondary": { "chance": 10, "boosts": { "spd": -1 } } }, { "secondary": { "chance": 30, "volatileStatus": "flinch" } }, { "secondary": { "chance": 30 } }, { "secondary": { "chance": 10, "self": { "boosts": { "atk": 1, "def"

Error in list to tree

萝らか妹 提交于 2020-03-05 05:37:45
问题 Consider the following type: data LTree a = Leaf a | Fork (LTree a) (LTree a) build :: [(a,Int)] -> LTree a build l = fst (buildaccum 0 l)e I have a list and want to build a tree buildaccum :: Int -> [(a,Int)] -> (LTree a, [(a,Int)]) buildaccum n l@((a,b):t) |n==b = (Leaf a,t) |n<b = (Fork e d, l2) where (e,l1) = buildaccum (n+1) l (d,l2) = buildaccum (n+2) l1 In ghci, I get the following error: Couldn't match expected type (LTree a, [(a, Int)])' with actual type LTree a' Can you spot the

In aeson-schemas how do you construct an Object of a SchemaType without encoding to text and decoding back?

℡╲_俬逩灬. 提交于 2020-03-03 17:15:41
问题 I'm using aeson-schemas-1.0.3 and I want to construct values of Object Example without round-tripping through an external serialized representation. It seems like a hack and I'm worried about the performance impact. I have this schema defined: type Example = [schema| { example: Text, } |] I want to be able to write something like this: coerceJson $ object [ "example" .= ("Example" :: Text) ] I have a workaround which does allow that, but it involves encoding to a ByteString and decoding to

智能合约开发新趋势【2019】

你离开我真会死。 提交于 2020-03-01 13:02:13
智能合约开发语言已经被Solidity统治了一段时间,它用于开发可以在以太坊虚拟机EVM上运行的智能合约。不过Solidity有一些严重的问题,包括算术溢出、类型错误以及曾经冻结了3亿美元的delegatecall漏洞。所有这些漏洞都是在开发语言层面存在的问题。换句话说,如果有一个好点的开发语言,本来应该可以创造更安全的智能合约。文本将列出在2019年值得关注的区块链智能合约开发技术趋势。 上汇智网,用互动方式学习以太坊、比特币、EOS、tendermint等更多 区块链开发教程 。 2019年,Solidity的挑战者终于来了。 Waves RIDE Waves RIDE是一个图灵不完备(没有循环或递归)的、收Haskell启发的函数式编程语言, 用于Waves区块链。它的特点包括静态类型、惰性评估、模式匹配和用于决定交易是否允许 完成的断言表达式。目前图灵完备的版本也在开发中。Wave的智能合约支持目前在主网上 已经激活。我们应当可以在2019年看到第一批Waves的dApp。 官方地址: https://docs.wavesplatform.com/en/technical-details/ride-language.html Plutus (Cardano) Plutus是另一个类Haskell的函数式编程语言,用于Cardano区块链。Cardano计划在2019年

2019年需要关注的区块链智能合约开发平台

孤街醉人 提交于 2020-03-01 13:01:58
智能合约开发语言已经被Solidity统治了一段时间,它用于开发可以在以太坊虚拟机EVM上运行的智能合约。不过Solidity有一些严重的问题,包括算术溢出、类型错误以及曾经冻结了3亿美元的delegatecall漏洞。所有这些漏洞都是在开发语言层面存在的问题。换句话说,如果有一个好点的开发语言,本来应该可以创造更安全的智能合约。文本将列出在2019年值得关注的区块链智能合约开发技术趋势。 上汇智网,用互动方式学习以太坊、比特币、EOS、tendermint等更多 区块链开发教程 。 2019年,Solidity的挑战者终于来了。 Waves RIDE Waves RIDE是一个图灵不完备(没有循环或递归)的、受Haskell启发的函数式编程语言,用于Waves区块链。它的特点包括静态类型、惰性评估、模式匹配和用于决定交易是否允许完成的断言表达式。目前图灵完备的版本也在开发中。Wave的智能合约支持目前在主网上已经激活。我们应当可以在2019年看到第一批Waves的dApp。 官方地址: https://docs.wavesplatform.com/en/technical-details/ride-language.html Plutus (Cardano) Plutus是另一个类Haskell的函数式编程语言,用于Cardano区块链

Haskell data structure for SKOS (semantic web)

本小妞迷上赌 提交于 2020-03-01 09:15:51
问题 Introduction I am programming a semantic web application in haskell. With hsparql http://hackage.haskell.org/package/hsparql I can access my Tripple Store. Currently I use http://4store.org/ (mainly because it was easy to install). I use snap http://snapframework.com/ to do the servlet programming (Yesod is very cool too!!). Currently I use SKOS to represent bookmarks categories in RDF. Links on SKOS: http://www.w3.org/TR/skos-reference/ http://www.athenaeurope.org/athenawiki/index.php/SKOS

Haskell data structure for SKOS (semantic web)

孤街浪徒 提交于 2020-03-01 09:13:29
问题 Introduction I am programming a semantic web application in haskell. With hsparql http://hackage.haskell.org/package/hsparql I can access my Tripple Store. Currently I use http://4store.org/ (mainly because it was easy to install). I use snap http://snapframework.com/ to do the servlet programming (Yesod is very cool too!!). Currently I use SKOS to represent bookmarks categories in RDF. Links on SKOS: http://www.w3.org/TR/skos-reference/ http://www.athenaeurope.org/athenawiki/index.php/SKOS

Different behaviors of Applicative on tuples and lists in Haskell

久未见 提交于 2020-03-01 06:06:52
问题 For example, -- Num a => ([Char], a -> a) <*> ([Char], a) > ("hello ",(*6)) <*> ("world",7) ("hello world",42) -- Num a => [a -> a] <*> [a] > [(*7),(*6)] <*> [6,7] [42,49,36,42] -- Num a => [[Char], a -> a] <*> [[Char], a] > ["hello ",(*6)] <*> ["world",7] <interactive>:17:2: Couldn't match expected type ‘[Char] -> [Char]’ with actual type ‘[Char]’ In the expression: "hello " In the first argument of ‘(<*>)’, namely ‘["hello ", (* 6)]’ In the expression: ["hello ", (* 6)] <*> ["world", 7] For

Different behaviors of Applicative on tuples and lists in Haskell

故事扮演 提交于 2020-03-01 06:05:22
问题 For example, -- Num a => ([Char], a -> a) <*> ([Char], a) > ("hello ",(*6)) <*> ("world",7) ("hello world",42) -- Num a => [a -> a] <*> [a] > [(*7),(*6)] <*> [6,7] [42,49,36,42] -- Num a => [[Char], a -> a] <*> [[Char], a] > ["hello ",(*6)] <*> ["world",7] <interactive>:17:2: Couldn't match expected type ‘[Char] -> [Char]’ with actual type ‘[Char]’ In the expression: "hello " In the first argument of ‘(<*>)’, namely ‘["hello ", (* 6)]’ In the expression: ["hello ", (* 6)] <*> ["world", 7] For