我不明白为什么下面的程序无法编译。
module Main where
import Prelude
import Effect (Effect)
import Effect.Console (log)
import Data.Generic.Rep (class Generic)
import Foreign.Generic (defaultOptions, genericEncodeJSON)
main :: Effect Unit
main = do
log "Hello sailor!"
newtype Foo = Foo {
x :: Int
, y :: Int
, z :: Array Bar
}
type Bar = {
a :: String
, b :: String
}
derive instance repGenericFoo:: Generic Foo _
fooToJSON :: Foo -> String
fooToJSON = genericEncodeJSON $ defaultOptions { unwrapSingleConstructors = true …Run Code Online (Sandbox Code Playgroud) 执行以下代码时,我收到此错误:"INVALID_VECTOR_VECTOR_PRODUCT__IF_YOU_WANTED_A_DOT_OR_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTIONS"
#include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
int main()
{
Vector3d v(1, 2, 3);
Vector3d vT = v.transpose();
Matrix3d ans = v*vT;
std::cout << ans << std::endl;
}
Run Code Online (Sandbox Code Playgroud)
没有编译器抱怨,有没有其他方法可以做到这一点?