Assume I want to completely reinstall GHC/HP. I want to (as much for superstition as anything) delete anything and everything from previous installs. What do I actually need to delete (and where)? Edit: I'm on OSX, but I'm more curious if this information is available in general, for all systems. Edit2: So far we have: OSX: /Library/Frameworks/GHC.framework/ ~/.cabal/ /usr/b
假设我想彻底重新安装GHC / HP。 我想(和任何事情一样迷信)删除之前安装的任何内容和所有内容。 我实际需要删除哪些内容? 编辑:我在OSX上,但我更加好奇,如果这些信息通用于所有系统。 Edit2:到目前为止我们有: OSX: /Library/Frameworks/GHC.framework/ 〜/ .cabal / / usr / bin / - 符号链接 我将补充说明(基于此处定义的“前缀”:http://www.vex.net/~trebla/haskell/sicp.xhtml#storage): 前
I have had previous exposure to imperative languages (C, some Java) however I would say I had no experience in programming. Therefore: treating me as a non-programmer, would Haskell be suitable as a first language? My interests in Pure Mathematics and CS seem to align to the intention of most Haskell tutorials, and although i can inherently recognise the current and future industry value of im
我曾经接触过命令式语言(C,一些Java),但我会说我没有编程经验 。 因此:把我当作非程序员来对待,Haskell会不会适合作为第一语言? 我对纯数学和CS的兴趣似乎与大多数Haskell教程的意图一致,尽管我可以固有地认识到命令式编程的当前和未来行业价值,但我发现函数式编程的潜力(尽可能多地看起来像这样范式转变)引人入胜。 我想我的问题可以如下进行提炼 - 非程序员是否必须理解命令式编程以欣赏和充分利用函数式编程
Suppose I have an algebraic data type with multiple constructors, like data Animal a = Mouse a | Beaver a | Rabbit a How would I create a Lift instance effectively? The easiest way of doing so would be instance (Lift a) => Lift (Animal a) where lift (Mouse x) = [| Mouse x |] lift (Beaver x) = [| Beaver x |] lift (Rabbit x) = [| Rabbit x |] This is very redundant though
假设我有一个具有多个构造函数的代数数据类型,比如 data Animal a = Mouse a | Beaver a | Rabbit a 我将如何有效地创建一个Lift实例? 最简单的方法就是这样做 instance (Lift a) => Lift (Animal a) where lift (Mouse x) = [| Mouse x |] lift (Beaver x) = [| Beaver x |] lift (Rabbit x) = [| Rabbit x |] 这是非常多余的,但。 当然,我不能直接抽象出不同的动物,像lift x = [| x |] lif
Ok, so I have figured out how to implement Reader (and ReaderT , not shown) using the operational package: {-# LANGUAGE GADTs, ScopedTypeVariables #-} import Control.Monad.Operational data ReaderI r a where Ask :: ReaderI r r type Reader r a = Program (ReaderI r) a ask :: Reader r r ask = singleton Ask runReader :: forall r a. Reader r a -> r -> a runReader = interpretWithMonad ev
好的,我已经想出了如何使用operational包来实现Reader (和ReaderT ,未显示): {-# LANGUAGE GADTs, ScopedTypeVariables #-} import Control.Monad.Operational data ReaderI r a where Ask :: ReaderI r r type Reader r a = Program (ReaderI r) a ask :: Reader r r ask = singleton Ask runReader :: forall r a. Reader r a -> r -> a runReader = interpretWithMonad evalI where evalI :: forall
I've been using hsenv (with great success!) to deal with the usual cabal dependency issues. Its terrific, but there is one glitch I can't get around: how to persuade the (also excellent!) vim-haskellmode to use the environment variables set by hsenv -- namely the paths to GHC, cabal database and so on when compiling, generating tags etc. Does anyone know how to solve this problem? S
我一直在使用hsenv(很成功!)来处理通常的依赖问题。 它很棒,但有一个我无法解决的问题:如何说服(也很好!)vim-haskellmode使用hsenv设置的环境变量 - 即编译时的GHC,cabal数据库等路径,生成标签等。 有谁知道如何解决这个问题? 对不起,打错了按钮 - 我应该问如何使用SO的问题,而不是:) 无论如何,更好的诀窍是把它放到.vimrc中 let g:ghc=system("which ghc") 这样(假设g:ghc在你运行vim的时候被绑定
I'm trying to create a typed expression parser in Haskell, which works great so far, but I'm currently struggling to implement higher order functions. I've boiled the problem down to a simple example: {-# LANGUAGE TypeFamilies,GADTs,FlexibleContexts,RankNTypes #-} -- A function has an argument type and a result type class Fun f where type FunArg f type FunRes f -- Expressions
我正在尝试在Haskell中创建一个类型化的表达式解析器,它迄今为止效果很好,但我目前正在努力实现更高阶的函数。 我把问题归结为一个简单的例子: {-# LANGUAGE TypeFamilies,GADTs,FlexibleContexts,RankNTypes #-} -- A function has an argument type and a result type class Fun f where type FunArg f type FunRes f -- Expressions are either constants of function applications data Expr a where Const :: a
I've been using the Haxl monad (described here: http://www.reddit.com/r/haskell/comments/1le4y5/the_haxl_project_at_facebook_slides_from_my_talk), which has the interesting feature that <*> for its Applicative instance isn't the same as ap from Control.Monad. This is a key feature that allows it to do concurrent computations without blocking. For example, if hf and ha are long com
我一直在使用Haxl monad(在这里描述:http://www.reddit.com/r/haskell/comments/1le4y5/the_haxl_project_at_facebook_slides_from_my_talk),它有一个有趣的特性,即它的Applicative实例的<*>不是与Control.Monad的ap相同。 这是一个关键特性,可以在不阻塞的情况下进行并发计算。 例如,如果hf和ha是长计算,那么 let hf :: Haxl (a -> b) = ... ha :: Haxl a = ... in do f <- hf a <- ha ret
I'm looking for a way to run two computations in parallel in the ST-Monad. I am building a rather large array (using STUArray) and I would like to do it in parallel. So far I've found this and this Q&A here on stackoverflow, however the first does not apply in my case, as it deals with pure code only and the second deals with the IO monad - but I am in a State Thread. I've al
我正在寻找一种在ST-Monad中并行运行两个计算的方法。 我正在构建一个相当大的数组(使用STUArray),我想并行执行它。 到目前为止,我已经在stackoverflow中找到了这个和这个问答,但是第一个不适用于我的情况,因为它仅处理纯代码,第二个处理IO monad - 但我处于状态线程中。 我还发现了monad-parallel软件包,但它要求我为ST提供一个'MonadParallel'的实例。 此外,monad-par软件包不支持纯粹的计算或IO mona
I'm facing problems to make my code runs in parallel. It is a 3D Delaunay generator using a divide & conquer algorithm named DeWall. The main function is: deWall::[SimplexPointer] -> SetSimplexFace -> Box -> StateT DeWallSets IO ([Simplex], [Edge]) deWall p afl box = do ... ... get >>= recursion box1 box2 p1 p2 sigma edges ... ... It calls the "recu
我遇到了问题,使我的代码并行运行。 这是一款使用名为DeWall的分而治之算法的3D Delaunay生成器。 主要功能是: deWall::[SimplexPointer] -> SetSimplexFace -> Box -> StateT DeWallSets IO ([Simplex], [Edge]) deWall p afl box = do ... ... get >>= recursion box1 box2 p1 p2 sigma edges ... ... 它调用可能调用dewall函数的“递归”函数。 在这里,平滑机会出现在这里。 以下代码
Still working on my text editor Rasa. At the moment I'm building out the system for tracking viewports/splits (similar to vim splits). It seemed natural to me to represent this structure as a tree: data Dir = Hor | Vert deriving (Show) data Window a = Split Dir SplitInfo (Window a) (Window a) | Single ViewInfo a deriving (Show, Functor, Traversable, Foldable)
仍在编辑我的文本编辑器Rasa。 目前我正在构建跟踪视口/分割的系统(类似于vim分割)。 我很自然地把这个结构表示为一棵树: data Dir = Hor | Vert deriving (Show) data Window a = Split Dir SplitInfo (Window a) (Window a) | Single ViewInfo a deriving (Show, Functor, Traversable, Foldable) 这很好,我把我的View存储在树中,然后我可以遍历/ fmap来改变它们,它也与镜头包很好地