monomorphism

    4热度

    1回答

    我是一个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

    3热度

    1回答

    我有一些代码使用类型来消除实例的歧义(真正的代码是使用GHC.TypeLits类型标记的singletons,但我认为这不是密切相关的),我想使用let绑定来避免文本级别的重复;不幸的是,这会使结果单调。 以下是问题的一个例子: class Foo a where foo :: a instance Foo Int where foo = 0 instance Foo

    -5热度

    2回答

    请告诉我,如果下面的类是单形的? 是什么使它单形?单形是什么意思? class Foo { public: Foo(int n) { this->m = n; } void print() { std::cout << this->m << std::endl; } private: int m