小编Geo*_*edy的帖子

OCaml函数超过多态变体不够多态?

OCaml给出function `A -> 1 | _ -> 0了类型[> `A] -> int,但为什么不是这样[> ] -> int

这是我的理由:

  • function `B -> 0有类型[<`B] -> int.添加`A -> 0分支以使其function `A -> 1 | `B -> 0松散[<`A|`B] -> int.该函数在它可以接受的参数类型中变得更加宽松.这是有道理的.
  • function _ -> 0有类型'a -> int.这种类型是统一的[> ] -> int,并且[> ]是一种已经开放的类型(非常宽松).添加`A -> 0分支以使其将类型function `A -> 1 | _ -> 0 限制[>`A] -> …

polymorphism ocaml type-inference variant

6
推荐指数
2
解决办法
665
查看次数

常春藤,什么是主配置,为什么不拉jvyaml?

我有以下常春藤文件:

<configurations defaultconfmapping="buildtime">
    <conf name="buildtime" visibility="private" description="Libraries needed only for compilation" />
    <conf name="runtime" description="Libraries only needed at runtime" />
    <conf name="test" description="Libraries only needed for testing" />
</configurations>

<dependencies>
  <dependency org="net.java.dev" name="jvyaml" rev="0.2.1" conf="runtime" />
  <dependency org="org.apache.solr" name="solr-core" rev="3.6.0" conf="runtime" />

</dependencies>
Run Code Online (Sandbox Code Playgroud)

我有一个如下所示的ant检索任务:

<target name="retrieve-all" depends="resolve">
    <ivy:retrieve pattern="lib/[conf]/[artifact]-[revision].[ext]" conf="*" />
</target>
Run Code Online (Sandbox Code Playgroud)

奇怪的是,所有solr依赖项都按照我的预期下载到lib/runtime中,但是jvyaml模块没有!它'解析',但不会下载到lib/runtime目录,除非我将依赖声明更改为:

<dependency org="net.java.dev" name="jvyaml" rev="0.2.1" conf="runtime->master" />
Run Code Online (Sandbox Code Playgroud)

什么是主配置,为什么需要拉jvyaml jar,但不是solr?

谢谢

ant ivy

6
推荐指数
1
解决办法
5869
查看次数

标签 统计

ant ×1

ivy ×1

ocaml ×1

polymorphism ×1

type-inference ×1

variant ×1