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

Sjoerd Visscher sjoerd at w3future.com
Wed Jun 27 21:03:43 CEST 2012


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 <sjoerd at 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 at haskell.org
>>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>> 
>> 
>> --
>> Sjoerd Visscher
>> https://github.com/sjoerdvisscher/blog
>> 
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
> 
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
> 

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








More information about the Haskell-Cafe mailing list