Re: [Haskell-cafe] Combining Network Descriptions in Reactive.Banana

2012-07-10 Thread wren ng thornton

On 6/27/12 2:57 PM, Alexander Foremny wrote:

Sweet! Thank you very much!

Just out of curiosity: how does this differ from the following, not
compiling type signature?


library :: forall t. NetworkDescription t (Behavior t String) -  IO ()


The type:

(forall a. F a) - G

is isomorphic to:

exists a. (F a - G)

which differs in the obvious way from:

forall a. (F a - G)



Or, from a game-theoretic perspective: with the first type it's the 
callee that gets to decide which type A is; so the caller only knows 
that such an A exists, but they have no knowledge or control over what 
it is. Whereas with the latter type, it's the caller that gets to choose 
A, and the callee has to deal with it no matter which type it is.


--
Live well,
~wren

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Combining Network Descriptions in Reactive.Banana

2012-06-27 Thread Alexander Foremny
Hello list,

I am currently experimenting with Reactive.Banana and I am trying to
write a program that simply displays a String which is supplied by the
user. Thus in Main.hs I'd like to create a Behavior t String from some
arbitrary sources and pass this to a library function performing the
printing. However, I am not able to get the desired behavior of my
program. A sample Main.hs is available as Gist [1].

The cause of error appears to be that the type t over which
NetworkDescription and Behavior are parameterized are distinct! I
tried several variations of the code in [1] using
ExistentialQuantification over t and/or giving explicit type
signatures. The error is slightly different in each case, but always
boils down to the same reason.

In case explicit error messages are required I can post them to the list.

Any insight into this would be of great help. And additionally I'd be
interested if this kind of program is possible with Reactive.Banana at
all.

[1] https://gist.github.com/3004430

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Combining Network Descriptions in Reactive.Banana

2012-06-27 Thread Sjoerd Visscher
This should work:

library :: (forall t. NetworkDescription t (Behavior t [Char])) - IO ()

greetings,
Sjoerd

On Jun 27, 2012, at 4:39 PM, Alexander Foremny wrote:

 Hello list,
 
 I am currently experimenting with Reactive.Banana and I am trying to
 write a program that simply displays a String which is supplied by the
 user. Thus in Main.hs I'd like to create a Behavior t String from some
 arbitrary sources and pass this to a library function performing the
 printing. However, I am not able to get the desired behavior of my
 program. A sample Main.hs is available as Gist [1].
 
 The cause of error appears to be that the type t over which
 NetworkDescription and Behavior are parameterized are distinct! I
 tried several variations of the code in [1] using
 ExistentialQuantification over t and/or giving explicit type
 signatures. The error is slightly different in each case, but always
 boils down to the same reason.
 
 In case explicit error messages are required I can post them to the list.
 
 Any insight into this would be of great help. And additionally I'd be
 interested if this kind of program is possible with Reactive.Banana at
 all.
 
 [1] https://gist.github.com/3004430
 
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
 

--
Sjoerd Visscher
https://github.com/sjoerdvisscher/blog






___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Combining Network Descriptions in Reactive.Banana

2012-06-27 Thread Alexander Foremny
Sweet! Thank you very much!

Just out of curiosity: how does this differ from the following, not
compiling type signature?

 library :: forall t. NetworkDescription t (Behavior t String) - IO ()

Regards,
Alexander Foremny

2012/6/27 Sjoerd Visscher sjo...@w3future.com:
 This should work:

    library :: (forall t. NetworkDescription t (Behavior t [Char])) - IO ()

 greetings,
 Sjoerd

 On Jun 27, 2012, at 4:39 PM, Alexander Foremny wrote:

 Hello list,

 I am currently experimenting with Reactive.Banana and I am trying to
 write a program that simply displays a String which is supplied by the
 user. Thus in Main.hs I'd like to create a Behavior t String from some
 arbitrary sources and pass this to a library function performing the
 printing. However, I am not able to get the desired behavior of my
 program. A sample Main.hs is available as Gist [1].

 The cause of error appears to be that the type t over which
 NetworkDescription and Behavior are parameterized are distinct! I
 tried several variations of the code in [1] using
 ExistentialQuantification over t and/or giving explicit type
 signatures. The error is slightly different in each case, but always
 boils down to the same reason.

 In case explicit error messages are required I can post them to the list.

 Any insight into this would be of great help. And additionally I'd be
 interested if this kind of program is possible with Reactive.Banana at
 all.

 [1] https://gist.github.com/3004430

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


 --
 Sjoerd Visscher
 https://github.com/sjoerdvisscher/blog






 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Combining Network Descriptions in Reactive.Banana

2012-06-27 Thread Sjoerd Visscher
That is the same as just

library :: NetworkDescription t (Behavior t String) - IO ()

which means that the caller gets to pick which type t stands for. But with 
this:

library :: (forall t. NetworkDescription t (Behavior t [Char])) - IO ()

the caller is forced to pass a value that works for any type t, and the library 
function gets to choose.

greetings,
Sjoerd

On Jun 27, 2012, at 8:57 PM, Alexander Foremny wrote:

 Sweet! Thank you very much!
 
 Just out of curiosity: how does this differ from the following, not
 compiling type signature?
 
 library :: forall t. NetworkDescription t (Behavior t String) - IO ()
 
 Regards,
 Alexander Foremny
 
 2012/6/27 Sjoerd Visscher sjo...@w3future.com:
 This should work:
 
library :: (forall t. NetworkDescription t (Behavior t [Char])) - IO ()
 
 greetings,
 Sjoerd
 
 On Jun 27, 2012, at 4:39 PM, Alexander Foremny wrote:
 
 Hello list,
 
 I am currently experimenting with Reactive.Banana and I am trying to
 write a program that simply displays a String which is supplied by the
 user. Thus in Main.hs I'd like to create a Behavior t String from some
 arbitrary sources and pass this to a library function performing the
 printing. However, I am not able to get the desired behavior of my
 program. A sample Main.hs is available as Gist [1].
 
 The cause of error appears to be that the type t over which
 NetworkDescription and Behavior are parameterized are distinct! I
 tried several variations of the code in [1] using
 ExistentialQuantification over t and/or giving explicit type
 signatures. The error is slightly different in each case, but always
 boils down to the same reason.
 
 In case explicit error messages are required I can post them to the list.
 
 Any insight into this would be of great help. And additionally I'd be
 interested if this kind of program is possible with Reactive.Banana at
 all.
 
 [1] https://gist.github.com/3004430
 
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 
 --
 Sjoerd Visscher
 https://github.com/sjoerdvisscher/blog
 
 
 
 
 
 
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
 

--
Sjoerd Visscher
https://github.com/sjoerdvisscher/blog






___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe