Skip to content
Advertisement

Tag: haskell

How to read haskell.exe console output in Java?

I need to save Java output to test2.txt file, run through java compiled haskell hello.exe file, get data from tes2.txt, do something with it and then output result to console and read it with Java. Hello.exe Java When I run hello.exe by myself, it gives me the right result: 1 13 23. But when I run hello.exe with Java getRuntime().exec()

Java tagged union / sum types

Is there any way to define a sum type in Java? Java seems to naturally support product types directly, and I thought enums might allow it to support sum types, and inheritance looks like maybe it could do it, but there is at least one case I can’t resolve. To elaborate, a sum type is a type which can have

“Double” composition with CompletableFuture

I’m trying to avoid nesting CompletableFuture when combining 2 independent ones with a BiFunction that returns a third one. Currently, using thenCombine() does not cut it: I’m basically trying to find a way that looks like haskell if there was a CompletableFuture monad: I read somewhere that join() is the flatMap of Completable future, so I think I could use

Higher-kinded generics in Java

Suppose I have the following class: Now I want to introduce a generic argument, abstracting over the use of Expr: But Eclipse doesn’t like this: The type F is not generic; it cannot be parametrized with arguments <Fix<F>> Is this possible at all or have I overlooked something that causes this specific instance to break? Some background information: in Haskell

Advertisement