小编mat*_*ood的帖子

如何为最近的ghcjs/lts构建配置堆栈

堆栈文档提供了使用ghcjs https://docs.haskellstack.org/en/stable/ghcjs/进行编译的示例配置.但最新的例子是lts-7.19.我想配置堆栈以使用最新的gtcjs和最新的lts(目前为8.4).

我知道ghcjs编译器是为每个lts预先打包并由https://github.com/tolysz/托管,使用https://github.com/tolysz/prepare-ghcjs.我想我真正的问题是:

我怎样才能找到ghcjs.tolysz.org上可用的版本(以及它们的sha1哈希)?

编辑:到目前为止,我发现你可以在这里查看未经测试的版本:http://tolysz.org/ghcjs/untested/但它们确实未经测试,而我试过的那些不起作用.我已经尝试用prepare-ghcjs构建我自己的但没有成功 - 在prepare-ghcjs中还没有允许ghcjs的最近更改,所以我试图在那里放一些东西https://github.com/tolysz/prepare-ghcjs/issues/6.

haskell ghcjs haskell-stack

8
推荐指数
1
解决办法
347
查看次数

为什么函数不能采用仅受类型类约束的类型?

我没有足够的词汇来表达这个问题(因此,为了寻找答案,如果答案很容易获得,那么道歉).考虑以下

class RunFoo m where
  runFoo :: m a -> a

class RunFooWrapper m where
  doRunFoo :: (RunFoo n) => n a -> m a

newtype RunFast a = RunFast a

newtype RunSlow a = RunSlow a

fooExample :: (RunFoo m) => m Bool
fooExample = undefined

fooWrapperExample :: (RunFooWrapper m) => m Bool
fooWrapperExample = doRunFoo fooExample
Run Code Online (Sandbox Code Playgroud)

这不编译:Could not deduce (RunFoo n0) arising from a use of ‘doRunFoo’.

似乎编译器(GHC 7.10)坚持对mfrom 的具体实例化,fooExample因此拒绝继续.但在这种情况下,我无法理解为什么程序是错误的类型 - fooExample …

haskell constraints typeclass ghc

4
推荐指数
1
解决办法
186
查看次数

来自泛型-sop 的 All 的超类

我正在尝试使用来自 generics-sop 的All来限制类型列表。使用简单的类(如 )All Typeable xs,一切都按预期工作,但我希望能够执行以下操作:

class (Typeable a) => TestClass (a :: k)
instance (Typeable a) => TestClass a

foo :: (All Typeable xs) => NP f xs -> z
foo = undefined

bar :: (All TestClass xs) => NP f xs -> z
bar = foo 
Run Code Online (Sandbox Code Playgroud)

这给出了错误

Could not deduce: Generics.SOP.Constraint.AllF Typeable xs
  arising from a use of ‘foo’
  from the context: All TestClass xs
Run Code Online (Sandbox Code Playgroud)

generics-sop 文档指出

"所有 Eq '[ Int, Bool, Char ] …

generics haskell

4
推荐指数
1
解决办法
111
查看次数

标签 统计

haskell ×3

constraints ×1

generics ×1

ghc ×1

ghcjs ×1

haskell-stack ×1

typeclass ×1