首页 文章
  • 6 votes
     answers
     views

    行类型级别列表的多态相等

    TL;DR: 我想使用 type family RIso (a :: [*]) (b :: [*]) :: Bool 实现行多态的统一,但是已经卡住了 . 背景 我正在为一种具有效果系统的语言编写一个编译器,该系统使用行多态,如Extensible Records with Scoped Labels,表示附加到函数类型的效果集 . 也就是说,在这种语言中,函数箭头的类型是: (->) :...
  • 252 votes
     answers
     views

    使用模板Haskell获取关联的类型同义词

    模板Haskell可以找出类型类中声明的关联类型同义词的名称和/或声明吗?我希望reify可以做我想要的,但它似乎没有提供所有必要的信息 . 它适用于获取函数类型签名: % ghci GHCi, version 7.8.3: http://www.haskell.org/ghc/ :? for help ... Prelude> -- I'll be inserting line brea...
  • 5 votes
     answers
     views

    这'Ambiguous type variable `a` in the constraint'是什么意思?

    在这段代码中,我试图让我的worker函数 go 中的第一个参数成为'type family'类型 . 我在type families documentation类型中看到类似的 insert 函数属于类型类,而在我的示例中它不属于类型类 . 我是新来的家庭,所以也许我使用它们错了,但这个错误意味着什么? {-# LANGUAGE TypeFamilies #-} -- | key class ...
  • 10 votes
     answers
     views

    Haskell式的家庭

    在Haskell中,我可能会编写一个带有 type 声明的类型类来创建一个类型族,如下所示: class ListLike k where type Elem :: * -> * fromList :: [Elem k] -> k 然后写这样的实例: instance ListLike [a] where type Elem [a] = a from...

热门问题