问题
I am a Scala beginner and coming from Object Oriented Paradigm. While understanding Functional programming part of Scala, I was directed to Haskell - the pure Functional programming language.
Exploring SO question-answers, I found that Java - Haskell has interoperability.
I am curious to know that similarly does Scala-Haskell interoperability exist or not?
Can a function library written in Haskell be used in Scala application?
As per answer given by Don Stewart: It is possible.
Integration of Haskell Function Library in Scala application will be straight and easy or will require complicated tweaks?
With integrated Haskell Function Library, the Scala application will run on JVM or will require different arrangement?
回答1:
I found that Java - Haskell has interoperability. I am curious to know that similarly does Scala-Haskell interoperability exist or not?
Well given that interoperability is transitive, and given that (hj_interop : Haskell <-> Java)
and (js_interop : Java <-> Scala)
, we therefore conclude that Haskell <-> Scala
.
If you want Haskell -> Scala
, then just take Haskell -> Java
from hj_interop
, and Java -> Scala
from js_interop
. If you want Scala -> Haskell
, then just take Scala -> Java
from js_interop
, and Java -> Haskell
from hj_interop
.
This isn't a very hand-holdy explanation of how to accomplish Haskell - Scala interoperability, but given existing interoperatilities, you just compose them in the obvious way. Scala does not provide any direct, convenient interoperability with Haskell that I am aware of, other than providing scalaz
to add an extra Haskell-y feel to Scala. Haskell does not provide any direct, convenient interoperability with Scala that I am aware of.
回答2:
It is possible, but I am not aware of any examples.
来源:https://stackoverflow.com/questions/11162743/haskell-scala-interoperability