[Haskell-cafe] non-blocking recv from UDP socket

2010-08-26 Thread Vo Minh Thu
Hi, Is is possible to get Network.Socket.ByteString.recv to be non-blocking (i.e. return directly even if no data is available) ? I have tried ti use setSocketOption sock NoDelay 1 but then I get the following error: setSocketOption: unsupported operation (Protocol not available) Here is

Re: [Haskell-cafe] On to applicative

2010-08-26 Thread Vo Minh Thu
This is indeed the case: if you want to apply your sumsqr function or Ivan's (\ x y z -> z * y + z), to some Functor (Maybe in this case), you don't have to redefine them, or even to use fmap2 or fmap3: you just have to use <$> and <*>. E.g.: (\ a b c -> a + b + c) <$> Just 1 <*> Just 2 <*> Just

Re: [Haskell-cafe] On to applicative

2010-08-25 Thread Vo Minh Thu
I think it works well :) But sumsqr has type Int -> Int -> Int, not Int -> Int -> Int -> Int. I.e. it does take only two arguments while fmap3 takes a function of three arguments. 2010/8/26 michael rice > > OK, fmap2 works, but not fmap3. What am I not understanding? > > Michael > > import Cont

Re: [Haskell-cafe] On to applicative

2010-08-25 Thread Vo Minh Thu
2010/8/26 michael rice > > From: http://en.wikibooks.org/wiki/Haskell/Applicative_Functors > > = > import Control.Applicative > > f :: (a -> b -> c) > fmap :: Functor f => (d -> e) -> f d -> f e > fmap f :: Functor f => f a -> f (b -> c)    -- Identify d with a, and e w

[Haskell-cafe] Re: empty .prof file

2010-08-23 Thread Vo Minh Thu
2010/8/23 Vo Minh Thu : > Hi, > > I'd like to profile a GLUT application. After a run of the application > with the +RTS -p flag, the .prof file is actually created but is > always empty. > > Does someone have a clue of what's going on? Would it be related to

[Haskell-cafe] empty .prof file

2010-08-23 Thread Vo Minh Thu
Hi, I'd like to profile a GLUT application. After a run of the application with the +RTS -p flag, the .prof file is actually created but is always empty. Does someone have a clue of what's going on? Would it be related to my application calling GLUT's leaveMainLoop to exit? Thanks, Thu _

Re: [Haskell-cafe] Higher-order algorithms

2010-08-23 Thread Vo Minh Thu
2010/8/23 Eugene Kirpichov : > [snip] > Do there exist other nontrivial higher-order algorithms and datastructures? > Is the field of higher-order algorithms indeed as unexplored as it seems? > [snip] Hi, I'm thinking to some HOAS (higher order abstract syntax) representation. Cheers, Thu _

Re: [Haskell-cafe] Re: String vs ByteString

2010-08-15 Thread Vo Minh Thu
2010/8/15 Ivan Lazar Miljenovic : > Vo Minh Thu writes: > >> 2010/8/15 Ivan Lazar Miljenovic : >>> Don Stewart writes: >>> >>>>     * Pay attention to Haskell Cafe announcements >>>>     * Follow the Reddit Haskell news. >>>>  

Re: [Haskell-cafe] Re: String vs ByteString

2010-08-15 Thread Vo Minh Thu
2010/8/15 Ivan Lazar Miljenovic : > Don Stewart writes: > >>     * Pay attention to Haskell Cafe announcements >>     * Follow the Reddit Haskell news. >>     * Read the quarterly reports on Hackage >>     * Follow Planet Haskell > > And yet there are still many packages that fall under the radar

Re: [Haskell-cafe] Preview the new haddock look and take a short survey

2010-08-04 Thread Vo Minh Thu
2010/8/4 Mark Lentczner : > The Haddock team has spent the last few months revamping the look of the > generated output. We're pretty close to done, but we'd like to get the > community's input before we put it in the main release. > > Please take a look, and then give us your feedback through a

Re: [Haskell-cafe] OpenGL Speed!

2010-07-29 Thread Vo Minh Thu
bindings for haskell: > http://hackage.haskell.org/package/SDL > SDL is better suited for 2D drawing (IMHO). > http://www.libsdl.org/ > > > - Job > > > On Thu, Jul 29, 2010 at 6:51 AM, Vo Minh Thu wrote: >> >> 2010/7/29 Eitan Goldshtrom : >> > I'm having an

Re: [Haskell-cafe] OpenGL Speed!

2010-07-29 Thread Vo Minh Thu
2010/7/29 Eitan Goldshtrom : > I'm having an unusual problem with OpenGL. To be honest I probably shouldn't > be using OpenGL for this, as I'm just doing 2D and only drawing Points, but > I don't know about any other display packages, so I'm making due. If this is > a problem because of OpenGL howe

Re: [Haskell-cafe] Is 'flip' really necessary?

2010-07-26 Thread Vo Minh Thu
2010/7/26 Vo Minh Thu : > 2010/7/26 Daniel Fischer : >> On Monday 26 July 2010 23:25:27, Max Rabkin wrote: >>> >>> It took me a fair while (I'm talking on the order of half a minute) to >>> figure out what that meant, but it's pretty cool. >> >

Re: [Haskell-cafe] Is 'flip' really necessary?

2010-07-26 Thread Vo Minh Thu
2010/7/26 Daniel Fischer : > On Monday 26 July 2010 23:25:27, Max Rabkin wrote: >> >> It took me a fair while (I'm talking on the order of half a minute) to >> figure out what that meant, but it's pretty cool. > > Yeah, really neat. > >> Maybe a different >> name would be better? How about (??) or

Re: [Haskell-cafe] Haskell Forum

2010-07-26 Thread Vo Minh Thu
2010/7/26 Daniel Díaz : > Hi all, > > I want to open a Haskell forum based on phpBB, but I need some collaborators > for organize its content, and moderate its use. When we have finished, I > will open this forum for the entire community of Haskell! Hi, The idea of a forum has been brought to thi

Re: [Haskell-cafe] Re: Lists and monads

2010-07-26 Thread Vo Minh Thu
2010/7/26 Kevin Jardine : > On Jul 26, 3:00 pm, Vo Minh Thu wrote: > >> Also, just like with IO, maybe restructuring the code to separate >> monadic code would help. > > The specific monad I am dealing with carries state around inside it. > > I could revert to

Re: [Haskell-cafe] Lists and monads

2010-07-26 Thread Vo Minh Thu
2010/7/26 Kevin Jardine : > As a Haskell neophyte, one of the things I find confusing is the way > that the usual list functions (map, fold, ++, etc.) often cannot be > used directly with monadic lists (m [a] or [m a]) but seem to require > special purpose functions like ap, mapM etc. Note that th

Re: [Haskell-cafe] data type declaration

2010-07-25 Thread Vo Minh Thu
2010/7/25 Andrew Coppin : > Patrick Browne wrote: >> >> Andrew, >> Thanks for your detailed feedback, it is a great help. >> > > Well, I like to be helpful. > >> I appreciate that the code does not do anything useful, nor is it an >> appropriate way to write Haskell, but it does help me >> understa

Re: [Haskell-cafe] ANNOUNCE: Haskell Platform 2010.2.0.0

2010-07-23 Thread Vo Minh Thu
2010/7/23 Andrew Coppin : > Don Stewart wrote: >> >> Download the Haskell Platform 2010.2.0.0: >> >>    http://hackage.haskell.org.nyud.net/platform/ >> >> (Caching server). >> > > Anybody have any theroes why Trend Micro Antivirus is reporting this as a > "confirmed fraud/attack site"? See here:

Re: [Haskell-cafe] Merge hsql and HDBC -- there can only be one!

2010-07-21 Thread Vo Minh Thu
2010/7/21 Ketil Malde : > John Goerzen writes: > >> I need to read the LGPL and analyze it closer, but my first analysis >> suggests that this would work fine for me and others. > > I'm using the LGPL for library code, and GPL for applications.  Although > a lot of noise is generated from the link

Re: [Haskell-cafe] Hierarchical modules issue

2010-07-18 Thread Vo Minh Thu
2010/7/19 Ivan Miljenovic : > On 19 July 2010 14:31, Jonathan Geddes wrote: >> Now when I'm working in a subdirectory, say Foo where the modules are >> named Foo.Bar, Foo.Baz, Foo.etc., and I try to compile Bar.hs which >> imports Foo.Baz, the compiler looks for the file Foo/Baz.hs. The >> problem

Re: [Haskell-cafe] point-free ADT pattern matching ?

2010-07-15 Thread Vo Minh Thu
2010/7/15 Alexey Karakulov : > I wonder if pattern matching could be less verbose. Maybe this sounds weird, > but here is example of what I mean: > >> type A = (Int, String) >> >> f :: String -> A -> A >> f s (i,s') = (i, s ++ s') >> >> data B = B Int String deriving Show >> >>g :: String -> B -> B

Re: [Haskell-cafe] Expression dye

2010-07-15 Thread Vo Minh Thu
2010/7/15 Vo Minh Thu : > 2010/7/14 Vo Minh Thu : >> 2010/7/14 Andrew Coppin : >>> I'm trying to write a function that builds a series of results in a very >>> complicated way. Eventually I ended up writing things like >>> >>>> newtype Dye =

Re: [Haskell-cafe] Expression dye

2010-07-14 Thread Vo Minh Thu
2010/7/14 Vo Minh Thu : > 2010/7/14 Andrew Coppin : >> I'm trying to write a function that builds a series of results in a very >> complicated way. Eventually I ended up writing things like >> >>> newtype Dye = Dye String deriving (Eq, Show) >>> >&

Re: [Haskell-cafe] Expression dye

2010-07-14 Thread Vo Minh Thu
2010/7/14 Andrew Coppin : > I'm trying to write a function that builds a series of results in a very > complicated way. Eventually I ended up writing things like > >> newtype Dye = Dye String deriving (Eq, Show) >> >> instance Num Dye where >>   (Dye x) + (Dye y) = Dye (x ++ " + " ++ y) >>   (Dye x

Re: [Haskell-cafe] Applying a value to a function generically

2010-07-14 Thread Vo Minh Thu
2010/7/14 Felipe Lessa : > On Wed, Jul 14, 2010 at 8:25 AM, Arnaud Bailly wrote: >> Hello, >> I would like to construct a collection of function-like objects on >> which I could apply some value, in a typesafe and clean way. > > You could use Data.Typeable.cast [1] > > [1] > http://haskell.org/gh

Re: [Haskell-cafe] lists of arbitrary depth

2010-07-13 Thread Vo Minh Thu
2010/7/13 Ivan Lazar Miljenovic : > vadali writes: > >> hello, >> iam really new to haskell, >> >> i want to define a function which takes as a parameter a list which can >> contain other lists, eg. [1,[2,3],[4,[5,6]]] >> >> how would i define a function that can iterate through the items so (in t

Re: [Haskell-cafe] Error monads (was: Call for comments: neither package)

2010-06-29 Thread Vo Minh Thu
2010/6/29 Roman Cheplyaka : > * Stephen Tetley [2010-06-29 12:02:45+0100] >> The "Applicative Programming with Effects Paper" has the "monodial >> accumulating" applicative instance on a sum type Conor McBride and >> Ross Paterson call Except: >> >> data Except err a = OK a | Failed err >> >> The

Re: [Haskell-cafe] Physical equality

2010-06-28 Thread Vo Minh Thu
2010/6/28 José Romildo Malaquias : > Is there in Haskell a non monadic function of type a -> a -> Bool which > test for physical equality of two values? It would return True if only > if both values are the same object in memory. > > For instance: > >  value1 = "good" >  value2 = "good" > >  eq val

Re: [Haskell-cafe] Tiger compiler: variable escaping analysis phase

2010-06-24 Thread Vo Minh Thu
2010/6/24 José Romildo Malaquias : > On Tue, Jun 22, 2010 at 04:44:09PM +0200, Vo Minh Thu wrote: >> 2010/6/22 José Romildo Malaquias : >> > On Tue, Jun 22, 2010 at 02:54:08PM +0200, Vo Minh Thu wrote: >> >> 2010/6/22 José Romildo Malaquias : >> >> > H

Re: [Haskell-cafe] Haskell Weekly News?

2010-06-23 Thread Vo Minh Thu
2010/6/23 aditya siram : > I haven't seen HWN in a while. If there is still community interest, > how can we help you with this? It will come back, see this thread: http://www.reddit.com/r/haskell/comments/cdw38/hwn_it_will_be_back_promise/ Cheers, Thu

Re: [Haskell-cafe] Tiger compiler: variable escaping analysis phase

2010-06-22 Thread Vo Minh Thu
2010/6/22 José Romildo Malaquias : > On Tue, Jun 22, 2010 at 02:54:08PM +0200, Vo Minh Thu wrote: >> 2010/6/22 José Romildo Malaquias : >> > Hello. >> > >> > I have been teaching an introductory course on compiler construction to >> > our undergrad

Re: [Haskell-cafe] Tiger compiler: variable escaping analysis phase

2010-06-22 Thread Vo Minh Thu
2010/6/22 José Romildo Malaquias : > Hello. > > I have been teaching an introductory course on compiler construction to > our undergraduates students using Appel's "Modern Compiler > Implementation in Java". There are also versions of the book in ML and > C. The books explain how to write a compile

Re: [Haskell-cafe] Re: haskell.org down?

2010-06-07 Thread Vo Minh Thu
2010/6/7 Benjamin L. Russell : > Ozgur Akgun writes: > >> http://downforeveryoneorjustme.com/www.haskell.org-- Ozgur Akgun > > Same problem here since two days ago. > > Apparently, the server just went back up.  Anybody know what kept the > server down for so long? http://www.reddit.com/r/haskell

Re: [Haskell-cafe] The state of Hackage: what are we doing about it?

2010-06-01 Thread Vo Minh Thu
2010/6/1 Brandon S. Allbery KF8NH : > On May 31, 2010, at 19:13 , Don Stewart wrote: >> >> I see fairly regular complaints about too many Haskell libraries, >> bewildering choice of difficult-to-determine quality. > > One thing that might help is just a less cluttered/better organized > interface.

Re: [Haskell-cafe] Why Either = Left | Right instead of something like Result = Success | Failure

2010-05-28 Thread Vo Minh Thu
2010/5/28 Donn Cave : > Quoth Ivan Lazar Miljenovic , > >>   Whilst the Either type isn't officially used for >> errors, that is how it is usually treated in Haskell with the consensus >> that Left = failure and Right = success (note that due to how its >> defined it also has to be this way for Eit

Re: [Haskell-cafe] Why Either = Left | Right instead of something like Result = Success | Failure

2010-05-27 Thread Vo Minh Thu
2010/5/27 Ionut G. Stan : > Hi, > > I was just wondering if there's any particular reason for which the two > constructors of the Either data type are named Left and Right. I'm thinking > that something like Success | Failure or Right | Wrong would have been a > little better. > > I've recently see

Re: [Haskell-cafe] Writing a web service client

2010-05-25 Thread Vo Minh Thu
2010/5/25 Ionut G. Stan : > Hi, café > > I've begun learning Haskell for some time already, and although I don't > really feel confident writing real world Haskell, I have a little idea that > I want to materialize in Haskell code so I'm pretty eager to do something > instead of just reading books

<    1   2