小编Ant*_*zen的帖子

泡泡中的无限循环排序在Haskell中的Traversable

我正在尝试使用Tardis monad 在任何可遍历的容器上实现冒泡排序.

{-# LANGUAGE TupleSections #-}

module Main where

import Control.DeepSeq
import Control.Monad.Tardis
import Data.Bifunctor
import Data.Traversable
import Data.Tuple
import Debug.Trace

newtype Finished = Finished { isFinished :: Bool }

instance Monoid Finished where
  mempty = Finished False
  mappend (Finished a) (Finished b) = Finished (a || b)

-- | A single iteration of bubble sort over a list.
-- If the list is unmodified, return 'Finished' 'True', else 'False'
bubble :: Ord a => [a] -> (Finished, …
Run Code Online (Sandbox Code Playgroud)

monads haskell lazy-evaluation bubble-sort traversable

11
推荐指数
1
解决办法
187
查看次数

由于缺少依赖性,堆栈构建失败

我正在尝试制作像acme这样的东西 - ghci-all例如堆栈项目的堆栈项目,它可以stack ghci让你访问所有的堆栈.我将最新snashot中的所有软件包添加到我的.cabal文件中,在完成所有外部依赖项之后,我得到了一个奇怪的错误:

setup-Simple-Cabal-1.22.5.0-ghc-7.10.3: At least the following dependencies
are missing:
Ebnf2ps -any,
TaxonomyTools -any,
YampaSynth -any,
alex -any,
angel -any,
bumper -any,
c2hs -any,
cabal-install -any,
cabal-rpm -any,
cabal-sort -any,
cabal-src -any,
calculator -any,
clash-ghc -any,
clckwrks-cli -any,
gipeda -any,
git-fmt -any,
gtk2hs-buildtools -any,
hackage-whatsnew -any,
haddocset -any,
happy -any,
hdevtools -any,
hledger-interest -any,
hledger-ui -any,
hopenpgp-tools -any,
hspec-setup -any,
ip6addr -any,
lentil -any,
lhs2tex -any,
moesocks -any,
mole -any,
resolve-trivial-conflicts -any,
sandman -any,
servius …
Run Code Online (Sandbox Code Playgroud)

haskell cabal haskell-stack

3
推荐指数
1
解决办法
488
查看次数

对“ghci”和“stack ghci”使用不同的配置

我经常使用ghci它进行少量计算并stack ghci处理我的实际项目。

为了使第一个更容易,我编写了一个.ghci包含许多导入模块的文件,但其中一些模块不存在于我的堆栈项目中,并且我遇到了严重的错误。

目前我使用别名stackghci="stack ghci --ghci-options -ignore-dot-ghci",但随后我再次出现默认提示等等。

有没有办法指定两个.ghci文件;一个用于堆栈,一个用于ghci?

haskell ghci haskell-stack

2
推荐指数
1
解决办法
381
查看次数