Re: [Haskell-cafe] Comparison Haskell, Java, C and LISP

2011-10-18 Thread yi huang
If i understand correctly, what we called generics is what so called reflection. It allow you to introspect type structure. http://haskell.org/ghc/docs/latest/html/libraries/ghc-prim-0.2.0.0/GHC-Generics.html#g:4 On Wed, Oct 19, 2011 at 12:03 AM, yrazes wrote: > Hi, > > Maybe you remember my cas

Re: [Haskell-cafe] How to implement a digital filter, using Arrows?

2011-10-18 Thread John Lask
> {-# LANGUAGE Arrows #-} This is literate code. It expounds on your initial question and provides two solutions based either on the StateArrow or Automaton > module Test where > import Data.List ( mapAccumL ) > import Control.Arrow > import Control.Arrow.Operations > import Control.Arrow.T

Re: [Haskell-cafe] How to implement a digital filter, using Arrows?

2011-10-18 Thread Ryan Ingram
Your type stopped being an arrow when the state type started to depend on the input type: Filter a b ~= (a, FS a) -> (b, FS a) Filter b c ~= (b, FS b) -> (c, FS b) It's impossible to compose these two functions into a single function of type Filter a c, because the state type doesn't match. You

Re: [Haskell-cafe] How to implement a digital filter, using Arrows?

2011-10-18 Thread Captain Freako
Hi John, Thanks for this reply: > Date: Tue, 18 Oct 2011 14:05:22 +1030 > From: John Lask > Subject: Re: [Haskell-cafe] How to implement a digital filter, using >Arrows? > To: haskell-cafe@haskell.org > Message-ID: smtp384394452fd2750fbe3bcfcc6...@phx.gbl> > Content-Type: text/plain; cha

Re: [Haskell-cafe] subclasses and classes with same type in instance

2011-10-18 Thread Albert Y. C. Lai
On 11-10-16 01:56 PM, Patrick Browne wrote: I get the same results from Listing 1 and Listing 2 below. I carefully diff'ed the two listings and found no difference except for comments. -- Listing 1- Subclass data Shed = Shed class Building building where addressB :: building -> I

Re: [Haskell-cafe] Comparison Haskell, Java, C and LISP

2011-10-18 Thread Nicu Ionita
Am 18.10.2011 18:53, schrieb Stephen Tetley: Haskell has no support for reflection whatsoever. It can support compile time meta-programming with Template Haskell. Reflection itself might be antagonistic to functional programming, I suspect it is at odds with referential transparency. Most of th

Re: [Haskell-cafe] Waiting on input with `hWaitForInput' or `threadWaitRead'

2011-10-18 Thread Jason Dusek
2011/10/18 Jason Dusek : > 2011/10/18 Ertugrul Soeylemez : > > A proxy server acts a lot like an echo server.  The difference is that > > usually before the actual proxying starts you have a negotiation phase, > > and instead of echoing back to the same socket, you just write it to a > > different

Re: [Haskell-cafe] Waiting on input with `hWaitForInput' or `threadWaitRead'

2011-10-18 Thread Jason Dusek
2011/10/18 Gregory Collins : > On Tue, Oct 18, 2011 at 3:18 AM, Jason Dusek wrote: > > The lazy bridging code, `lazyBridge', blocks (unsurprisingly) > > and does not allow packets to go back and forth. I think I need > > explicit selects/waits here to get the back and forth traffic. > > Maybe ther

Re: [Haskell-cafe] Waiting on input with `hWaitForInput' or `threadWaitRead'

2011-10-18 Thread Jason Dusek
2011/10/18 Ertugrul Soeylemez : > A proxy server acts a lot like an echo server.  The difference is that > usually before the actual proxying starts you have a negotiation phase, > and instead of echoing back to the same socket, you just write it to a > different one.  Here is an (untested) example

Re: [Haskell-cafe] Comparison Haskell, Java, C and LISP

2011-10-18 Thread Stephen Tetley
Haskell has no support for reflection whatsoever. It can support compile time meta-programming with Template Haskell. Reflection itself might be antagonistic to functional programming, I suspect it is at odds with referential transparency. Most of the work on reflection seemed based around Lisp /

Re: [Haskell-cafe] hello Haskell

2011-10-18 Thread Gregory Collins
On Tue, Oct 18, 2011 at 9:23 AM, R J wrote: > hey Haskell check it out http://www.fastnews10i.com OK, who has the ban hammer? G -- Gregory Collins ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell

[Haskell-cafe] Comparison Haskell, Java, C and LISP

2011-10-18 Thread yrazes
Hi, Maybe you remember my case. I was trying to compare some aspects of these languages. Well... I found that I can compare reflection, support for generics, simplicity and safe code. I just want to ask if you have more information for reflection in Haskell. I read that there is no enough for dyna

[Haskell-cafe] Working with the code For "Typing Haskell In Haskell"

2011-10-18 Thread Patrick LeBoutillier
Hi all, I'm working with the code that accompanies this paper (http://web.cecs.pdx.edu/~mpj/thih/) and I'm trying to use it but I can't figure out how to get started. I have the following code but it is not giving me the expected result: import TypingHaskellInHaskell mapt = "map" :>: Forall [Sta

Re: [Haskell-cafe] ANNOUNCE: vector-bytestring-0.0.0.0

2011-10-18 Thread Roel van Dijk
2011/10/18 Roel van Dijk : > Maybe we [can] create an example program which would fail with the > more general type. Migrating the function "foo" from bytestring to vector-bytestring would fail with more general types: > import Data.ByteString > foo = print empty Ok, modules loaded: Test. With v

[Haskell-cafe] hello Haskell

2011-10-18 Thread R J
hey Haskell check it out http://www.fastnews10i.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] ANNOUNCE: vector-bytestring-0.0.0.0

2011-10-18 Thread Roel van Dijk
2011/10/18 Christian Maeder : > you could re-export VS.empty, VS.singleton, etc. directly. The vector singleton and the vector-bytestring singleton don't have the same type. vector: > singleton :: a -> Vector a vector-bytestring: > singleton :: Word8 -> Vector Word8 By choosing the more general

Re: [Haskell-cafe] ANNOUNCE: vector-bytestring-0.0.0.0

2011-10-18 Thread Christian Maeder
Am 12.10.2011 16:02, schrieb Bas van Dijk: API DOCS http://hackage.haskell.org/package/vector-bytestring-0.0.0.0 you could re-export VS.empty, VS.singleton, etc. directly. Cheers Christian -- | /O(1)/ The empty 'ByteString' empty :: ByteString empty = VS.empty {-# INLINE empty #-} -- | /O(

Re: [Haskell-cafe] Waiting on input with `hWaitForInput' or `threadWaitRead'

2011-10-18 Thread Ertugrul Soeylemez
Michael Orlitzky wrote: > > I have uploaded a simple concurrent echo server implementation to > > hpaste [1]. It uses one thread for the stdout logger, one thread > > for the server, one thread for each client and finally a main thread > > waiting for you to hit enter to quit the application. >

Re: [Haskell-cafe] Waiting on input with `hWaitForInput' or `threadWaitRead'

2011-10-18 Thread Ertugrul Soeylemez
Jason Dusek wrote: > > I don't think you want either of the functions you mentioned. What > > you probably want instead is to do concurrent programming by > > creating Haskell threads.  A hundred Haskell threads reading from > > Handles are translated to one or more OS threads using whatever > >

Re: [Haskell-cafe] Fwd: GHC as a library error.

2011-10-18 Thread Paulo Pocinho
Thank you for the heads up; didn't know about the Scion library. Cheers! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Waiting on input with `hWaitForInput' or `threadWaitRead'

2011-10-18 Thread Gregory Collins
On Tue, Oct 18, 2011 at 3:18 AM, Jason Dusek wrote: > The lazy bridging code, `lazyBridge', blocks (unsurprisingly) > and does not allow packets to go back and forth. I think I need > explicit selects/waits here to get the back and forth traffic. > Maybe there is a some way to leverage GHC's inter