Re: [Haskell-cafe] Interfacing Java/Haskell

2013-05-10 Thread CJ van den Berg
On 2013-05-09 17:04, Hans Georg Schaathun wrote: Does anyone have experience with integrating Haskell and Java? I have done some searching, finding a lot of pointers but hardly anything in terms of evaluation, successes, or caveats. From what I see Frege looks promising, arguably not

[Haskell-cafe] A use case for *real* existential types

2013-05-10 Thread Leon Smith
I've been working on a new Haskell interface to the linux kernel's inotify system, which allows applications to subscribe to and be notified of filesystem events. An application first issues a system call that returns a file descriptor that notification events can be read from, and then issues

Re: [Haskell-cafe] A use case for *real* existential types

2013-05-10 Thread Andres Löh
Hi. So the natural question here is if we can employ the type system to enforce this correspondence. Phantom types immediately come to mind, as this problem is almost the same as ensuring that STRefs are only ever used in a single ST computation. The twist is that the inotify interface

Re: [Haskell-cafe] A use case for *real* existential types

2013-05-10 Thread MigMit
Maybe I understand the problem incorrectly, but it seems to me that you're overcomplicating things. With that kind of interface you don't actually need existential types. Or phantom types. You can just keep Inotify inside the Watch, like this: import Prelude hiding (init, map) import

[Haskell-cafe] Typeclass with an ‘or’ restriction.

2013-05-10 Thread Mateusz Kowalczyk
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Greetings, We can currently do something like class (Num a, Eq a) = Foo a where bar :: a - a - Bool bar = (==) This means that our `a' has to be an instance of Num and Eq. Apologies for a bit of an artificial example. Is there a way however to do

[Haskell-cafe] Stream processing

2013-05-10 Thread Ertugrul Söylemez
Hello everybody, I'm trying to formulate the stream processing problem, which doesn't seem to be solved fully by the currently existing patterns. I'm experimenting with a new idea, but I want to make sure that I don't miss any defining features of the problem, so here is my list. A stream

Re: [Haskell-cafe] Typeclass with an ‘or’ restriction.

2013-05-10 Thread Adam Gundry
Hi Mateusz, It's not directly possible to write a class with a choice of superclasses; as you point out, it's not really clear what that would mean. One workaround, though it might not be sensible in practice, is the following. {-# LANGUAGE ConstraintKinds, GADTs #-} First, reify the

Re: [Haskell-cafe] Constrained Category, Arrow, ArrowChoice, etc?

2013-05-10 Thread Sjoerd Visscher
On May 9, 2013, at 10:36 PM, Conal Elliott co...@conal.net wrote: BTW, have you see the new paper The constrained-monad problem? I want to investigate whether its techniques can apply to Category friends for linear maps and for circuits. Perhaps you’d like to give it a try as well. I got to

Re: [Haskell-cafe] A use case for *real* existential types

2013-05-10 Thread Leon Smith
On Fri, May 10, 2013 at 9:00 AM, Andres Löh and...@well-typed.com wrote: This twist is very simple to deal with if you have real existential types, with the relevant part of the interface looking approximately like init :: exists a. IO (Inotify a) addWatch :: Inotify a - FilePath - IO

Re: [Haskell-cafe] A use case for *real* existential types

2013-05-10 Thread Leon Smith
On Fri, May 10, 2013 at 9:04 AM, MigMit miguelim...@yandex.ru wrote: With that kind of interface you don't actually need existential types. Or phantom types. You can just keep Inotify inside the Watch, like this: Right, that is an alternative solution, but phantom types are a relatively

Re: [Haskell-cafe] A use case for *real* existential types

2013-05-10 Thread Alexander Solla
I'm not sure if it would work for your case, but have you considered using DataKinds instead of phantom types? At least, it seems like it would be cheap to try out. http://www.haskell.org/ghc/docs/7.4.2/html/users_guide/kind-polymorphism-and-promotion.html On Fri, May 10, 2013 at 12:52 PM,

Re: [Haskell-cafe] A use case for *real* existential types

2013-05-10 Thread Leon Smith
On Fri, May 10, 2013 at 5:49 PM, Alexander Solla alex.so...@gmail.comwrote: I'm not sure if it would work for your case, but have you considered using DataKinds instead of phantom types? At least, it seems like it would be cheap to try out.

Re: [Haskell-cafe] A use case for *real* existential types

2013-05-10 Thread Alexander Solla
On Fri, May 10, 2013 at 3:31 PM, Leon Smith leon.p.sm...@gmail.com wrote: On Fri, May 10, 2013 at 5:49 PM, Alexander Solla alex.so...@gmail.comwrote: I'm not sure if it would work for your case, but have you considered using DataKinds instead of phantom types? At least, it seems like it

[Haskell-cafe] Where is haskell-platform?

2013-05-10 Thread Clark Gaebel
I'm looking for the version of haskell platform that was supposed to be released May 6. It seems like it isn't out yet. What's preventing this from happening, and is there anything I can do to help? Regards, - Clark ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] A use case for *real* existential types

2013-05-10 Thread Leon Smith
A value has an indefinite extent if it's lifetime is independent of any block of code or related program structure, think malloc/free or new/gc. A value has a dynamic extent if is lifetime is statically determined relative to the dynamic execution of the program (e.g. a stack variable): in this

Re: [Haskell-cafe] Stream Processing

2013-05-10 Thread Gabriel Gonzalez
As far as I can tell, the only thing on that list not solved currently by `pipes` is leftovers, but I will be releasing that very soon. Hello everybody, I'm trying to formulate the stream processing problem, which doesn't seem to be solved fully by the currently existing patterns. I'm

[Haskell-cafe] Typeclass with an `or' restriction.

2013-05-10 Thread oleg
Mateusz Kowalczyk wrote: Is there a way however to do something along the lines of: class Eq a = Foo a where bar :: a - a - Bool bar = (==) class Num a = Foo a where bar :: a - a - Bool bar _ _ = False This would allow us to make an instance of Num be an instance of Foo or an instance of

Re: [Haskell-cafe] Reinventing a solution to configuration problem

2013-05-10 Thread oleg
I guess you might like then http://okmij.org/ftp/Haskell/types.html#Prepose which discusses implicit parameters and their drawbacks (see Sec 6.2). ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] A use case for *real* existential types

2013-05-10 Thread oleg
But Haskell (and GHC) have existential types, and your prototype code works with GHC after a couple of trivial changes: main = do W nd0 - init wd0 - addWatch nd0 foo wd1 - addWatch nd0 bar W nd1 - init wd3 - addWatch nd1 baz printInotifyDesc nd0 printInotifyDesc nd1

[Haskell-cafe] Stream processing

2013-05-10 Thread oleg
I'm a bit curious * be reliable in the presence of async exceptions (solved by conduit, pipes-safe), * hold on to resources only as long as necessary (solved by conduit and to some degree by pipes-safe), Are you aware of http://okmij.org/ftp/Streams.html#regions which