编译了一个,有很多有意思的东西
Release Note 在此。列举几处我比较有兴趣的:
- 基于 epoll/kqueue 的IO
- 可以生成 LLVM 代码
- 翻新了大量模块,特别是线程或异常阻塞有关的
- ghci 现在完整支持 import
- 支持 haskel 2010 ,但是新标准可能会与传统的 base 模块冲突,建议使用ghc/ghci时用以下命令屏蔽冲突模块:
ghci -package haskell2010 -hide-package base -hide-package array
- 现在支持 utf8 编码的源码文件,以及,甚至有一些 unicode 字符可以直接成为语法的一部分。
- GC 固定为两代回收
- 现在 ghc 可以向操作系统归还内存(至少 Python 和 Java 都还不能,C 的 free 在这方面也不是很有效)。
- 优化了 ghci 的沙盒
我在 ghci 里 :help 了一下,内容跟以前非常不同了。如下所示,有几个功能非常有爱,如:
- 可以支持多行
- 能够生成 etags 和 ctags
*Main> :help Commands available from the prompt: <statement> evaluate/run <statement> : repeat last command :{/n ..lines.. /n:}/n multiline command :add [*]<module> ... add module(s) to the current target set :browse[!] [[*]<mod>] display the names defined by module <mod> (!: more details; *: all top-level names) :cd <dir> change directory to <dir> :cmd <expr> run the commands returned by <expr>::IO String :ctags[!] [<file>] create tags file for Vi (default: "tags") (!: use regex instead of line number) :def <cmd> <expr> define a command :<cmd> :edit <file> edit file :edit edit last module :etags [<file>] create tags file for Emacs (default: "TAGS") :help, :? display this list of commands :info [<name> ...] display information about the given names :kind <type> show the kind of <type> :load [*]<module> ... load module(s) and their dependents :main [<arguments> ...] run the main function with the given arguments :module [+/-] [*]<mod> ... set the context for expression evaluation :quit exit GHCi :reload reload the current module set :run function [<arguments> ...] run the function with the given arguments :type <expr> show the type of <expr> :undef <cmd> undefine user-defined command :<cmd> :!<command> run the shell command <command> -- Commands for debugging: :abandon at a breakpoint, abandon current computation :back go back in the history (after :trace) :break [<mod>] <l> [<col>] set a breakpoint at the specified location :break <name> set a breakpoint on the specified function :continue resume after a breakpoint :delete <number> delete the specified breakpoint :delete * delete all breakpoints :force <expr> print <expr>, forcing unevaluated parts :forward go forward in the history (after :back) :history [<n>] after :trace, show the execution history :list show the source code around current breakpoint :list identifier show the source code for <identifier> :list [<module>] <line> show the source code around line number <line> :print [<name> ...] prints a value without forcing its computation :sprint [<name> ...] simplifed version of :print :step single-step after stopping at a breakpoint :step <expr> single-step into <expr> :steplocal single-step within the current top-level binding :stepmodule single-step restricted to the current module :trace trace after stopping at a breakpoint :trace <expr> evaluate <expr> with tracing on (see :history) -- Commands for changing settings: :set <option> ... set options :set args <arg> ... set the arguments returned by System.getArgs :set prog <progname> set the value returned by System.getProgName :set prompt <prompt> set the prompt used in GHCi :set editor <cmd> set the command used for :edit :set stop [<n>] <cmd> set the command to run when a breakpoint is hit :unset <option> ... unset options Options for ':set' and ':unset': +r revert top-level expressions after each evaluation +s print timing/memory stats after each evaluation +t print type after evaluation -<flags> most GHC command line flags can also be set here (eg. -v2, -fglasgow-exts, etc.) for GHCi-specific flags, see User's Guide, Flag reference, Interactive-mode options -- Commands for displaying information: :show bindings show the current bindings made at the prompt :show breaks show the active breakpoints :show context show the breakpoint context :show modules show the currently loaded modules :show packages show the currently active package flags :show languages show the currently active language flags :show <setting> show value of <setting>, which is one of [args, prog, prompt, editor, stop]