Windows 安装程序中的 Haskell
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/304614/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Haskell on Windows Setup
提问by user20155
Unfortunately I don't have access to a *nix box at work or at home. The only way I can play with Haskell is on windows. Anyone here using Haskell on Windows? What's your setup?
不幸的是,我无法在工作场所或家里使用 *nix 盒子。我可以使用 Haskell 的唯一方法是在 Windows 上。这里有人在 Windows 上使用 Haskell 吗?你的设置是什么?
采纳答案by Magnus
I've used Haskell on Windows, but only when forced to. Not because the combination Haskell+Windows is particularly bad, but just because I don't really like Windows.
我在 Windows 上使用过 Haskell,但只有在被迫时才使用。不是因为 Haskell+Windows 的组合特别糟糕,而是因为我不太喜欢 Windows。
My setup was basically the following:
我的设置基本上如下:
As you can see I was trying to get an environment that was as similar to Unix as possible (without using cygwin, because I find it utterly confusing). Vim is my favourite editor. The reason for Visual Studio was that the C environment shipped with GHC doesn't cover allof Win32API. I used CMake to get a decent build environment.
正如你所看到的,我试图获得一个尽可能类似于 Unix 的环境(不使用 cygwin,因为我觉得它完全令人困惑)。Vim 是我最喜欢的编辑器。使用 Visual Studio 的原因是 GHC 附带的 C 环境并未涵盖所有Win32API。我使用 CMake 来获得一个不错的构建环境。
回答by Trident D'Gao
DISCLAIMER: What's below was valid in Oct, 2013. So there is a good chance it might get outdated soon. Your edits and comments are welcome.
免责声明:以下内容在 2013 年 10 月有效。因此很有可能它很快就会过时。欢迎您的编辑和评论。
This is what I have done in order to get Haskell set up on my Windows 7 x64
这就是我为在 Windows 7 x64 上设置 Haskell 所做的工作
1. Install Haskell Platform
1. 安装 Haskell 平台
Download and install the Haskell Platform from http://www.haskell.org/platform/windows.html
从http://www.haskell.org/platform/windows.html下载并安装 Haskell 平台
2. Install Sublime Text 3
2. 安装 Sublime Text 3
Download and install Sublime Text 3 from http://www.sublimetext.com/3
从http://www.sublimetext.com/3下载并安装 Sublime Text 3
3. Enable the Package manager in Sublime
3. 在 Sublime 中启用包管理器
- Run Sublime
- Open the console:
View
>>Show console
- Paste the following code to the console and hit Enter (according to this):
- 运行崇高
- 打开控制台:
View
>>Show console
- 将以下代码粘贴到控制台并按 Enter(根据此):
import urllib.request,os; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); open(os.path.join(ipp, pf), 'wb').write(urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ','%20')).read())
import urllib.request,os; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); open(os.path.join(ipp, pf), 'wb').write(urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ','%20')).read())
- Open the command palette:
Tools
>>Command palette
- In the command palette popup type in:
Package Control: Install Package
- Select the package:
SublimeHaskell
- 打开命令面板:
Tools
>>Command palette
- 在命令面板弹出窗口中输入:
Package Control: Install Package
- 选择套餐:
SublimeHaskell
4. Install Haskell tools
4. 安装 Haskell 工具
Cabal is the standard package manager for Haskell. What you need to do is:
Cabal 是 Haskell 的标准包管理器。你需要做的是:
- Start a console with administrative permissions
Run:
cabal install cabal-install cabal update cabal install aeson cabal install haskell-src-exts cabal install ghc-mod cabal install cmdargs cabal install haddock
- 使用管理权限启动控制台
跑:
cabal install cabal-install cabal update cabal install aeson cabal install haskell-src-exts cabal install ghc-mod cabal install cmdargs cabal install haddock
5. Install hdevtools
5. 安装 hdevtools
You can NOT install hdevtools on Windows by running: cabal instal hdevtools. What you need to do instead is:
您不能通过运行以下命令在 Windows 上安装 hdevtools:cabal instal hdevtools。你需要做的是:
Download the source code of hdevtools for Windows from https://github.com/mvoidex/hdevtools* (* Currently does not work with GHC 7.10. See this forkfor building with GHC 7.10 and above)
Unpack it to some folder
Go to that folder and run:
runhaskell Setup.hs configure --user runhaskell Setup.hs build runhaskell Setup.hs install
Watch for the path (in the console output) where the hdevtools have been installed. You will need this path when setting up the SublimeHaskell plugin in Sublime. The path should look something like this:
C:\Users\Aleksey Bykov\AppData\Roaming\cabal\bin
whereAleksey Bykov
is the name of the current user.
从https://github.com/mvoidex/hdevtools下载适用于 Windows 的 hdevtools 源代码* (* 目前不适用于 GHC 7.10。请参阅此 fork以使用 GHC 7.10 及更高版本进行构建)
解压到某个文件夹
转到该文件夹并运行:
runhaskell Setup.hs configure --user runhaskell Setup.hs build runhaskell Setup.hs install
注意安装 hdevtools 的路径(在控制台输出中)。在 Sublime 中设置 SublimeHaskell 插件时,您将需要此路径。路径应该是这样的:当前用户的名字
C:\Users\Aleksey Bykov\AppData\Roaming\cabal\bin
在哪里Aleksey Bykov
。
6. Setting up the SublimeHaskell plugin in Sublime:
6. 在 Sublime 中设置 SublimeHaskell 插件:
- Start Sublime
- Go
Preferences
>>Package settings
>>SumblimeHaskell
>>Settings - User
Make sure you configuration looks like:
{ "add_to_PATH": [ "C:/Users/Aleksey Bykov/AppData/Roaming/cabal/bin/" ], "enable_hdevtools": true }
- 开始崇高
- 去
Preferences
>>Package settings
>>SumblimeHaskell
>>Settings - User
确保您的配置如下所示:
{ "add_to_PATH": [ "C:/Users/Aleksey Bykov/AppData/Roaming/cabal/bin/" ], "enable_hdevtools": true }
where C:/Users/Aleksey Bykov/AppData/Roaming/cabal/bin/
is that path (you got at step 5) where hdevtools (all all other toolls have been installed)
4. Save the file and restart Sublime
这里C:/Users/Aleksey Bykov/AppData/Roaming/cabal/bin/
是该路径(你在步骤5中得到),其中hdevtools(所有其他toolls已安装)4.保存文件并重新启动崇高
7. Hello world
7.你好世界
- Start Sublime
- Create a new file and save it immediately as
hello-world.hs
Put the following code there:
main::IO() main = putStrLn "Hello world!"
Build and run by going
Tools
>>Build
x 2 times (first it builds, second it runs)
- 开始崇高
- 创建一个新文件并立即将其另存为
hello-world.hs
将以下代码放在那里:
main::IO() main = putStrLn "Hello world!"
构建并运行
Tools
>>Build
x 2 次(首先构建,然后运行)
8. See also
8. 另见
There is another great article: http://howistart.org/posts/haskell/1
还有另一篇很棒的文章:http: //howistart.org/posts/haskell/1
回答by bhadra
回答by HaskellElephant
Haskell Platformis now more or less the standard distribution of haskell, and it has a windows installer.
Haskell 平台现在或多或少是 haskell 的标准发行版,并且它有一个 Windows 安装程序。
回答by gimel
GHCis a state-of-the-art, open source, compiler and interactive environment for the functional language Haskell.
GHC是用于函数式语言 Haskell 的最先进的开源编译器和交互式环境。
There is a Windows installer for GHC, but it for Version 6.4.2 .
GHC有一个Windows 安装程序,但它适用于 6.4.2 版。
A Windows .exe
(not an .msi
installer) for version 6.10.1 is at http://www.haskell.org/ghc/dist/6.10.1/It is not clear when the current (GHC 6.10.1) version will offer a Windows installer.
6.10.1 版的Windows .exe
(不是.msi
安装程序)位于http://www.haskell.org/ghc/dist/6.10.1/目前尚不清楚当前(GHC 6.10.1)版本何时会提供 Windows安装程序。
回答by SwiftsNamesake
No one seems to have mentioned Atomyet, which I've been using for a few weeks now. It's not quite as stable and mature as ST3 yet, but it looks promising and offers cabal (partial) and ghc-mod (good) integration via plugins.
似乎还没有人提到Atom,我已经使用了几个星期了。它不像 ST3 那样稳定和成熟,但它看起来很有前途,并通过插件提供 cabal(部分)和 ghc-mod(良好)集成。
回答by 1800 INFORMATION
回答by Maciej Piechotka
I based on Magnus solution. I have to state that I'm normally GNU/Linux user and I had to port low level packages (like this one).
我基于 Magnus 解决方案。我必须声明我通常是 GNU/Linux 用户并且我不得不移植低级包(比如这个)。
回答by SomeDude
You could install Sun's VirtualBox, and install Linux on it.
您可以安装 Sun 的 VirtualBox,然后在其上安装 Linux。
回答by Sekhat
Or You could partition your hard-drive a duel boot between linux and windows :)
或者您可以在 linux 和 windows 之间对硬盘进行分区,以进行决斗启动 :)
Doesn't answer your question, but it is an alternative.
不回答你的问题,但它是一个替代方案。