问题描述
我想编写一个Haskell程序,在不支持GHCi的平台(即mipsel上的GNU / Linux)上交互使用GADT。问题是,这个构造可以用来在GHC中定义GADT,例如:
pre $ 数据Term a where
Lit :: Int - > Term Int
Pair :: Term a - >术语b - >期限(a,b)
...
似乎不适用于Hugs。
- Hugs中无法定义GADT吗?我在一个Haskell类中的TA表示他可能在Hugs中,但他似乎并不确定。如果不是,GADT可以使用Hugs支持的其他语法或语义进行编码,就像GADT可以在ocaml中编码?
GADT在Hugs中没有实现。 b
$ b
相反,您应该使用如果您尝试使用GADT运行代码。请注意,由于缺乏更奇特的体系结构上的字节码加载,您将无法在所有平台上使用ghci。
I'd like to write a Haskell program that uses GADTs interactively on a platform not supported by GHCi (namely, GNU/Linux on mipsel). The problem is, the construct that can be used to define a GADT in GHC, for example:
data Term a where
Lit :: Int -> Term Int
Pair :: Term a -> Term b -> Term (a,b)
...
doesn't seem working on Hugs.
- Can't GADTs really be defined in Hugs? My TA at a Haskell class said it was possible in Hugs, but he seemed unsure.
- If not, can GADT be encoded by using other syntax or semantics supported by Hugs, just as GADTs can be encoded in ocaml?
GADTs are not implemented in Hugs.
Instead, you should use a port of GHC to mips if you are attempting to run code using GADTs. Note that you won't be able to use ghci on all platforms, due to lack of bytecode loading on more exotic architectures.
这篇关于如何在Hugs中使用GADT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!