我是一个Haskell和一个Stackoverflow noob,这里是我的 第一个&可能很基本的Haskell问题。 module M where
import Data.HList
data R r a
r1 = undefined :: R a Int
r2 = undefined :: R a Double
rPair :: R r a -> R r b -> (R r
我有一些代码使用类型来消除实例的歧义(真正的代码是使用GHC.TypeLits类型标记的singletons,但我认为这不是密切相关的),我想使用let绑定来避免文本级别的重复;不幸的是,这会使结果单调。 以下是问题的一个例子: class Foo a where
foo :: a
instance Foo Int where
foo = 0
instance Foo