什么是Haskell钻石符号?

lin*_*ize 2 haskell path ghc

这个符号</>在Haskell中意味着什么?

这叫什么?

如何使用它?

我用ghc 7.8来编译应用程序.

Rob*_*vey 11

它是联合收割机的别名.

Combine two paths, if the second path isAbsolute, then it returns the second.

Valid x => combine (takeDirectory x) (takeFileName x) `equalFilePath` x
Posix:   combine "/" "test" == "/test"
Posix:   combine "home" "bob" == "home/bob"
Windows: combine "home" "bob" == "home\\bob"
Windows: combine "home" "/bob" == "/bob"
Run Code Online (Sandbox Code Playgroud)

  • @TomEllis如果你更喜欢使用`newtype`,你也可以一直走到[`system-filepath`](https://hackage.haskell.org/package/system-filepath)之类的东西. (3认同)