Haskell

来自开放百科 - 灰狐
(版本间的差异)
跳转到: 导航, 搜索
(链接)
(现状)
 
(未显示1个用户的101个中间版本)
第1行: 第1行:
 
{{SeeWikipedia|Haskell (programming language)}}
 
{{SeeWikipedia|Haskell (programming language)}}
  
Haskell,一门通用型纯粹函数式编程语言。其特性有:静态类型,高阶函数,多态,型别类,以及单子式副作用等。Haskell编译器几乎在每一种计算机上都可以运行。
+
Haskell
 +
[[文件:haskell-logo.png|right]]
  
C++11的Concepts、C#的LINQ、Java中的泛型、Scala、CoffeeScript、F#、Python、Swift 等语言都从中受到启发和得到灵感。
+
==简介==
 +
[[文件:Haskell-Logo.png|right]]
  
Haskell在工业界有不少应用,最集中的是在金融界的高频交易。
+
Haskell,一门开源通用型纯粹函数式编程语言(Apache v2),其特性有:静态类型,高阶函数,多态,型别类,以及单子式副作用等,Haskell 编译器几乎在每一种计算机上都可以运行。
  
==安装==
+
Haskell 具有“证明即程序、命题为类型”的特征。
 +
 
 +
C++11 的 Concepts、C# 的 LINQ、Java 中的泛型、Scala、CoffeeScript、F#、Python、Swift 等语言都从中受到启发和得到灵感。
 +
 
 +
Haskell 在工业界有不少应用,最集中的是在金融界的高频交易。
 +
 
 +
更多应用:[[Haskell ecosystem]]
 +
 
 +
[https://www.futurelearn.com/info/courses/functional-programming-haskell/0/steps/27218 Brief History of Haskell] [https://www.futurelearn.com/courses/functional-programming-haskell Functional Programming in Haskell: Supercharge Your Coding]
 +
 
 +
==Why Haskell==
 +
[https://serokell.io/blog/10-reasons-to-use-haskell 10 Reasons to Use Haskell]
 +
 
 +
==版本==
 +
[https://gitlab.haskell.org/ghc/ghc/-/wikis/GHC-status GHC Status]
 +
 
 +
支持的语言:
 +
*[https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0380-ghc2021.rst GHC2021]
 +
*[https://www.haskell.org/onlinereport/haskell2010/ Haskell2010] [http://haskell.org/definition/haskell2010.pdf Haskell 2010 Language Report]
 +
*[https://www.haskell.org/onlinereport/ Haskell98]
 +
 
 +
==现状==
 +
*[https://taylor.fausak.me/2022/11/18/haskell-survey-results/ 2022 State of Haskell Survey Results]
 +
*[https://taylor.fausak.me/2021/11/16/haskell-survey-results/ 2021 State of Haskell Survey results]
 +
*[https://taylor.fausak.me/2020/11/22/haskell-survey-results/ 2020 State of Haskell Survey results]
 +
*[https://taylor.fausak.me/2019/11/16/haskell-survey-results/ 2019 State of Haskell Survey results]
 +
*[https://taylor.fausak.me/2018/11/18/2018-state-of-haskell-survey-results/ 2018 State of Haskell Survey results]
 +
*[https://taylor.fausak.me/2017/11/15/2017-state-of-haskell-survey-results/ 2017 State of Haskell Survey results]
 +
 
 +
==功能==
 +
[https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/haskell.html Haskell GHC versus Java/F#/OCaml fastest programs]
 +
 
 +
==指南==
 
===OS X===
 
===OS X===
 
OS X安装包安装后,会创建:
 
OS X安装包安装后,会创建:
第23行: 第57行:
 
  export PATH="$HOME/Library/Haskell/bin:$PATH"
 
  export PATH="$HOME/Library/Haskell/bin:$PATH"
  
==指南==
+
===GHC===
 +
*[https://github.com/ghc-proposals/ghc-proposals GHC Proposals]
 +
*[https://gitlab.haskell.org/ghc GHC GitLab] [https://gitlab.haskell.org/ghc/ghc/-/wikis/team-ghc GHC Team] [https://ghc.gitlab.haskell.org/ghc/doc/ GHC Documentation]
 +
*GHC 的 LLVM 部分衍生自 Essential Haskell Compiler(EHC) 项目,[https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/compiler/backends GHC Backends] [https://llvm.org/pubs/2008-06-CompilingHaskelltoLLVM.pdf Compiling Haskell to LLVM]
 +
 
 +
已安装的 ghc 版本,使用了 [https://docs.haskellstack.org/en/stable/README/ Haskell Tool Stack]
 +
ls $(stack path --programs)/*.installed
 +
/home/huihoo/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.7.installed
 +
/home/huihoo/.stack/programs/x86_64-linux/ghc-tinfo6-8.8.4.installed
 +
 
 +
===ghci===
 +
[https://tryhaskell.org Try Haskell]
 +
 
 
输入ghci进入GHC交互模式
 
输入ghci进入GHC交互模式
 
  ghci> [2,4..20]
 
  ghci> [2,4..20]
第41行: 第87行:
 
  ghci> factorial 50
 
  ghci> factorial 50
 
  30414093201713378043612608166064768844377641568960512000000000000
 
  30414093201713378043612608166064768844377641568960512000000000000
 +
ghci> :t 3
 +
ghci> :i Int
 +
 +
==Package==
 +
[[文件:Cabal-dark.png|right|Cabal]]
 +
*[https://cabal.readthedocs.io/en/latest/index.html Cabal] is the standard package system for Haskell software.
 +
*[https://github.com/haskell/hackage-server Hackage-Server] A Haskell Package Repository
 +
*[https://www.stackage.org/ Stable Haskell package sets]
 +
*[https://www.haskell.org/ghcup/ GHCup] Install or update GHC/Cabal/HLS/Stack
  
 
==项目==
 
==项目==
 +
[[文件:hamler-logo.png|right]]
 +
[[文件:postgrest-request-flow.png|right]]
 +
[https://github.com/krispo/awesome-haskell Awesome Haskell] [[image:awesome.png]]
 +
[[文件:haskell-ide.png|right]]
 +
*[https://github.com/haskellfoundation Haskell Foundation]
 +
*[https://github.com/ghc/ghc Glasgow Haskell Compiler (GHC)]
 +
*[https://wiki.haskell.org/Applications_and_libraries Applications and libraries]
 +
*[https://hackage.haskell.org/ Haskell Package Repository]
 +
*[https://mpickering.github.io/ide/index.html Haskell IDE] [https://github.com/haskell/haskell-language-server Haskell language server] [https://github.com/haskell/haskell-ide-engine Haskell IDE Engine (HIE)]
 
*[[ImplicitCAD]]
 
*[[ImplicitCAD]]
 +
*[https://github.com/blockapps BlockApps]
 +
*[https://github.com/GaloisInc Galois, Inc.]
 +
*[https://github.com/haskoin/haskoin haskoin] [[Bitcoin]]协议实现
 +
*[http://hackage.haskell.org/packages/#cat:Language Language & DSL]
 +
*[https://github.com/bjpop/berp Berp] an implementation of [[Python]] 3
 +
*[https://github.com/intoverflow/Potential Potential] x86-64 assembly as a Haskell EDSL
 +
*[https://github.com/tathougies/hos Hos] A Haskell operating system
 +
*[https://github.com/ndmitchell/shake Shake] [[build automation|build system]]
 +
*[https://github.com/acowley/Frames Frames] Data Frames for Haskell
 +
*[https://github.com/jgm/gitit Gitit] A wiki using HAppS, pandoc, and git
 +
*[https://github.com/digitallyinduced/ihp IHP] is a modern batteries-included haskell web framework, built on top of Haskell and Nix.
 +
*[https://github.com/PostgREST/postgrest PostgREST] [[REST]] [[API]] for any [[PostgreSQL]] database
 +
*[https://github.com/bitemyapp/esqueleto Esqueleto] a [[SQL]] [[DSL]] for Haskell
 +
*[https://github.com/commercialhaskell/stack The Haskell Tool Stack]
 +
 +
==语言==
 +
*[https://wiki.haskell.org/Applications_and_libraries/Compilers_and_interpreters Compilers and interpreters] [https://wiki.haskell.org/Foreign_Function_Interface Foreign Function Interface (FFI)]
 +
*[[Agda]]
 +
*[http://elm-lang.org/ Elm语言] [https://github.com/elm/compiler Elm Compiler]
 +
*[https://www.mathstat.dal.ca/~selinger/quipper/ Quipper: A Scalable Quantum Programming Language]
 +
*[https://www.hamler-lang.org/ Hamler] Haskell-style functional programming language running on [[Erlang VM]].
 +
*[https://github.com/typelead/eta Eta] Modern Haskell on the [[JVM]]
 +
*[https://github.com/purescript PureScript] A small strongly, statically typed language which compiles to [[JavaScript]]
 +
*[https://github.com/idris-lang/Idris-dev Idris] A Dependently Typed Functional Programming Language
 +
*[https://github.com/copilot-language/copilot Copilot] Stream [[DSL]] for hard real-time runtime verification
 +
*[https://github.com/Frege/frege Frege] is a Haskell for the [[JVM]]
 +
*[https://github.com/bjpop/berp/ Berp] an implementation of Python 3
 +
*[https://www.mathematik.uni-marburg.de/~eden/ Eden] Parallel Functional Programming with Haskell
 +
*[https://github.com/lambdacube3d/lambdacube-compiler LambdaCube] [[Compiler]] for LambdaCube 3D
 +
 +
==用户服务商==
 +
[https://wiki.haskell.org/Haskell_in_industry Haskell in industry]
 +
*[https://well-typed.com/ Well-Typed] The Haskell Consultants
 +
 +
==STEM==
 +
*STEM 教育可分为三部分:入门、进阶和实践,参考:[https://zh.wikibooks.org/wiki/Haskell Haskell :: 带类型的函数式编程]
 +
*[https://docs.huihoo.com/haskell/functional-programming/ Functional Programming] 推荐
 +
*[https://github.com/sdiehl/write-you-a-haskell Write You a Haskell] Building a modern functional compiler from first principles.
 +
*[https://github.com/wimvanderbauwhede/HaskellMOOC Functional Programming in Haskell]
 +
*[https://github.com/sdiehl/wiwinwlh What I Wish I Knew When Learning Haskell]
 +
*[https://blog.ocharles.org.uk/blog/pages/2014-12-01-24-days-of-ghc-extensions.html 24 Days of GHC Extensions]
 +
 +
==文档==
 +
*[http://docs.huihoo.com/erlang/conference/euc2016/Into-the-Core-Squeezing-Haskell-into-Nine-Constructors.pdf Into the Core Squeezing Haskell into nine constructors]
 +
*[http://docs.huihoo.com/infoq/qconshanghai/2015/%e6%96%b0%e8%af%ad%e8%a8%80%e4%b8%8e%e6%96%b0%e5%8f%91%e5%b1%95/QCon%e4%b8%8a%e6%b5%b72015-Haskell%e4%b8%ad%e7%9a%84%e5%87%bd%e6%95%b0%e4%b8%8e%e7%b1%bb%e5%9e%8b%e7%b3%bb%e7%bb%9f-%e5%bc%a0%e6%b7%9e.pdf Haskell中的类型与类型系统]
 +
*[http://docs.huihoo.com/cufp/2013/High-Availability-A-Development-Experience-Report.pdf High Availability - A Development Experience Report]
 +
*[http://docs.huihoo.com/cufp/2013/Redesigning-the-Computer-for-Security.pdf Redesigning the Computer for Security]
 +
*[http://docs.huihoo.com/cufp/2013/Functional-Reporting.pdf Functional Reporting]
 +
*[http://docs.huihoo.com/cufp/2013/Bringing-Haskell-to-the-World.pdf Bringing Haskell to the World]
 +
*[http://docs.huihoo.com/cufp/2013/Common-Pitfalls-of-Functional-Programming-and-How-to-Avoid-Them-A-Mobile-Gaming-Platform-Case-Study.pdf Common Pitfalls of Functional Programming and How to Avoid Them:A Mobile Gaming Platform Case Study]
 +
*[http://docs.huihoo.com/cufp/2013/Enterprise-Scheduling-with-Haskell.pdf Enterprise Scheduling with Haskell]
 +
*[https://ucsd-progsys.github.io/liquidhaskell-tutorial/ Programming with Refinement Types] An Introduction to LiquidHaskell
 +
*[https://www.microsoft.com/en-us/research/wp-content/uploads/2016/07/injective-type-families-acm.pdf Injective Type Families for Haskell]
  
 
==图书==
 
==图书==
 
*[http://book.huihoo.com/real-world-haskell/ 《Real World Haskell》]
 
*[http://book.huihoo.com/real-world-haskell/ 《Real World Haskell》]
 
*[https://github.com/huangz1990/real-world-haskell-cn 《Real World Haskell》中文翻译项目]
 
*[https://github.com/huangz1990/real-world-haskell-cn 《Real World Haskell》中文翻译项目]
 +
*[http://learnyouahaskell.com/chapters Learn You a Haskell for Great Good!]
 +
*[https://zh.wikibooks.org/wiki/Haskell Haskell :: 带类型的函数式编程] 维基教科书(Wikibooks)
 +
 +
==图集==
 +
<gallery>
 +
image:haskell-ghcup-tui.png|ghcup tui
 +
image:stack-dependency-visualization.png|依赖可视化
 +
image:nixos-stack.png|Nix Ecosystem
 +
image:Haskell-GHC.jpeg|GHC编译器
 +
image:Haskell-GHC-compiler-pipeline.png|GHC编译流水线
 +
image:Haskell-GHC-lightweight-concurrency.png|GHC轻量级并发
 +
image:Haskell-Typeclassopedia-diagram.png|Typeclassopedia
 +
image:Port-and-Adapter-architecture.png|端口和适配器架构
 +
</gallery>
  
 
==链接==
 
==链接==
 
*[http://haskell.org/ Haskell官网]
 
*[http://haskell.org/ Haskell官网]
*[https://github.com/krispo/awesome-haskell Awesome Haskell] [[image:awesome.png]]
+
*[https://haskell.foundation/ Haskell Foundation]
 +
*[https://wiki.haskell.org Haskell Wiki]
 +
*[https://github.com/Gabriel439/post-rfc/blob/master/sotu.md State of the Haskell ecosystem]
 
*[https://downloads.haskell.org/ Haskell下载]
 
*[https://downloads.haskell.org/ Haskell下载]
 
*[http://code.haskell.org/ code.haskell.org]
 
*[http://code.haskell.org/ code.haskell.org]
*[http://docs.huihoo.com/haskell/ Haskell开放文档]
+
*[https://docs.huihoo.com/haskell/ Haskell开放文档]
*[http://docs.huihoo.com/haskell/ghc/users-guide/ GHC User's Guide]
+
*[https://docs.huihoo.com/haskell/ghc/ GHC 文档] [https://downloads.haskell.org/ghc/latest/docs/ GHC 官方]
*[http://docs.huihoo.com/haskell/ghc/libraries/ GHC Standard Libraries]
+
 
*[http://zh.wikibooks.org/wiki/Haskell 维基教科书:Haskell]
 
*[http://zh.wikibooks.org/wiki/Haskell 维基教科书:Haskell]
 
*[https://phabricator.haskell.org/ Phabricator @ Haskell.org]
 
*[https://phabricator.haskell.org/ Phabricator @ Haskell.org]
第62行: 第194行:
 
*[http://www.infoq.com/cn/interviews/paul-hudak-haskell Paul Hudak谈Haskell]
 
*[http://www.infoq.com/cn/interviews/paul-hudak-haskell Paul Hudak谈Haskell]
 
*[http://www.zhihu.com/question/21922144 高频交易软硬件是怎么架构的?]
 
*[http://www.zhihu.com/question/21922144 高频交易软硬件是怎么架构的?]
 
{{comment}}
 
  
 
[[category:programming language]]
 
[[category:programming language]]
 
[[category:functional programming]]
 
[[category:functional programming]]
 +
[[category:concurrent computing]]
 +
[[category:numerical analysis]]
 +
[[category:lambda]]
 +
[[category:haskell]]
 +
[[category:Huihoo Foundation]]

2023年4月23日 (日) 04:02的最后版本

Wikipedia-35x35.png 您可以在Wikipedia上了解到此条目的英文信息 Haskell Thanks, Wikipedia.

Haskell

Haskell-logo.png

目录

[编辑] 简介

Haskell-Logo.png

Haskell,一门开源通用型纯粹函数式编程语言(Apache v2),其特性有:静态类型,高阶函数,多态,型别类,以及单子式副作用等,Haskell 编译器几乎在每一种计算机上都可以运行。

Haskell 具有“证明即程序、命题为类型”的特征。

C++11 的 Concepts、C# 的 LINQ、Java 中的泛型、Scala、CoffeeScript、F#、Python、Swift 等语言都从中受到启发和得到灵感。

Haskell 在工业界有不少应用,最集中的是在金融界的高频交易。

更多应用:Haskell ecosystem

Brief History of Haskell Functional Programming in Haskell: Supercharge Your Coding

[编辑] Why Haskell

10 Reasons to Use Haskell

[编辑] 版本

GHC Status

支持的语言:

[编辑] 现状

[编辑] 功能

Haskell GHC versus Java/F#/OCaml fastest programs

[编辑] 指南

[编辑] OS X

OS X安装包安装后,会创建:

/Library/Frameworks/GHC.framework
/Library/Haskell

运行 /Library/Haskell/bin/activate-hs

Haskell now set to:
   GHC      7.10.2
   Arch.    x86_64
   Platform 7.10.2-a

运行 /Library/Haskell/bin/cabal

/Users/huihoo/.cabal/config
/Users/huihoo/Library/Haskell/bin

vim ~/.bash_profile

export PATH="$HOME/Library/Haskell/bin:$PATH"

[编辑] GHC

已安装的 ghc 版本,使用了 Haskell Tool Stack

ls $(stack path --programs)/*.installed
/home/huihoo/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.7.installed
/home/huihoo/.stack/programs/x86_64-linux/ghc-tinfo6-8.8.4.installed

[编辑] ghci

Try Haskell

输入ghci进入GHC交互模式

ghci> [2,4..20]
[2,4,6,8,10,12,14,16,18,20]
ghci> [x * 2 | x <- [1..10]] // 列表推导式(list comprehension)
[2,4,6,8,10,12,14,16,18,20]
ghci> [x | x <- [10..20], x /= 13, x /= 15, x /= 19] // 多个谓词(predicate)
[10,11,12,14,16,17,18,20]
ghci> [0.1, 0.3 .. 1]
[0.1,0.3,0.5,0.7,0.8999999999999999,1.0999999999999999]
ghci> [x | x <- [50..100], x `mod` 7 == 3]
[52,59,66,73,80,87,94]

vim factorial.hs // 创建一个函数并保存文件

factorial :: Integer -> Integer
factorial n = product [1..n]
ghci> :l factorial
ghci> factorial 50
30414093201713378043612608166064768844377641568960512000000000000
ghci> :t 3
ghci> :i Int

[编辑] Package

Cabal

[编辑] 项目

Hamler-logo.png
Postgrest-request-flow.png

Awesome Haskell Awesome.png

Haskell-ide.png

[编辑] 语言

[编辑] 用户服务商

Haskell in industry

[编辑] STEM

[编辑] 文档

[编辑] 图书

[编辑] 图集

[编辑] 链接

分享您的观点
个人工具
名字空间

变换
操作
导航
工具箱