Re: [Haskell-cafe] On to applicative

2010-08-26 Thread Ivan Lazar Miljenovic
On 26 August 2010 15:56, michael rice nowg...@yahoo.com wrote: 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)    --

Re: [Haskell-cafe] On to applicative

2010-08-26 Thread Vo Minh Thu
2010/8/26 michael rice nowg...@yahoo.com 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

Re: [Haskell-cafe] On to applicative

2010-08-26 Thread michael rice
Yeah, I figured as much, but the code is copied right off the referenced page. Michael --- On Thu, 8/26/10, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: From: Ivan Lazar Miljenovic ivan.miljeno...@gmail.com Subject: Re: [Haskell-cafe] On to applicative To: michael rice

Re: [Haskell-cafe] On to applicative

2010-08-26 Thread Ivan Lazar Miljenovic
On 26 August 2010 16:09, michael rice nowg...@yahoo.com wrote: Yeah, I figured as much, but the code is copied right off the referenced page. Because as Vo Minh Thu says, it was there as a demonstration; in this instance they were doing algebraic manipulation of the code and corresponding type

Re: [Haskell-cafe] On to applicative

2010-08-26 Thread michael rice
Can you recommend an example that works? Michael --- On Thu, 8/26/10, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: From: Ivan Lazar Miljenovic ivan.miljeno...@gmail.com Subject: Re: [Haskell-cafe] On to applicative To: michael rice nowg...@yahoo.com Cc: haskell-cafe@haskell.org Date:

Re: [Haskell-cafe] On to applicative

2010-08-26 Thread Ivan Lazar Miljenovic
On 26 August 2010 16:29, michael rice nowg...@yahoo.com wrote: Can you recommend an example that works? An example of what? The definitions of fmap2, etc. on that page look like they're correct. -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com

Re: [Haskell-cafe] On to applicative

2010-08-26 Thread michael rice
OK, fmap2 works, but not fmap3. What am I not understanding? Michael import Control.Applicative -- f :: (a - b - c) -- fmap :: Functor f = (d - e) - f d - f e sumsqr :: Int - Int - Int sumsqr i j = i*i+j*j -- fmap :: Functor f = f a - f (b - c)    -- Identify d with a, and e with (b - c)

Re: [Haskell-cafe] On to applicative

2010-08-26 Thread Ivan Lazar Miljenovic
On 26 August 2010 16:47, michael rice nowg...@yahoo.com wrote: OK, fmap2 works, but not fmap3. What am I not understanding? Michael import Control.Applicative -- f :: (a - b - c) -- fmap :: Functor f = (d - e) - f d - f e sumsqr :: Int - Int - Int sumsqr i j = i*i+j*j -- fmap ::

Re: [Haskell-cafe] On to applicative

2010-08-26 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 nowg...@yahoo.com OK, fmap2 works, but not fmap3. What am I not understanding? Michael

Re: [Haskell-cafe] On to applicative

2010-08-26 Thread michael rice
Hmm... it was my understanding that the example was showing how to *avoid* having to create a  lot of functions that do the same thing but have different numbers of arguments. From the Wiki page: Anytime you feel the need to define different higher order functions to accommodate for

[Haskell-cafe] Re: Re : Re: Re : Error importing

2010-08-26 Thread Luc TAESCH
btw, this could be helpful, if you have some time: http://en.wikipedia.org/wiki/Cabal_(software) http://www.haskell.org/cabal/ in there you maay find : http://www.haskell.org/cabal/FAQ.html in which you can see ( hey !): Hidden packages

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 3

Re: [Haskell-cafe] On to applicative

2010-08-26 Thread Thomas Davie
On 26 Aug 2010, at 08:01, michael rice wrote: Hmm... it was my understanding that the example was showing how to *avoid* having to create a lot of functions that do the same thing but have different numbers of arguments. From the Wiki page: Anytime you feel the need to define

[Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-08-26 Thread Heinrich Apfelmus
Daniel Fischer wrote: John Lato wrote: Heinrich Apfelmus wrote: Do you have an example where you want chunking instead of single character access? I am unable to think of any examples where you want chunking for any reason other than efficiency. For many hashing or de/encryption

Re: [Haskell-cafe] On to applicative

2010-08-26 Thread michael rice
A lot of stuff to get one's head around. Was aware of liftM2, liftM3, etc., but not liftA2, liftA3, etc. So, the statement was true, but not the way that was shown in the example, i.e., with fmap2, fmap3, etc., which required different functions for each of the fmaps. Thanks. Appreciate the

Re: [Haskell-cafe] On to applicative

2010-08-26 Thread Alexander Solla
On Aug 26, 2010, at 12:34 AM, michael rice wrote: A lot of stuff to get one's head around. Was aware of liftM2, liftM3, etc., but not liftA2, liftA3, etc. liftM and liftA are essentially equivalent (and are both essentially equivalent to fmap) Same for the liftAn = liftMn functions

Re: [Haskell-cafe] On to applicative

2010-08-26 Thread Alexander Solla
On Aug 26, 2010, at 1:29 AM, Alexander Solla wrote: The other function is pure :: (a - b) - f (a - b). It takes a function and lifts it into the functor, without applying it to anything. In other words, given an f :: a - b, My mistake, though if you got the rest of it, it should come as

[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 Brent Yorgey
On Thu, Aug 26, 2010 at 01:29:16AM -0700, Alexander Solla wrote: $ is flip fmap. f $ functor = fmap f functor Just a quick correction: $ is fmap, not flip fmap. -Brent ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

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

2010-08-26 Thread Johan Tibell
Hi Thu, On Thu, Aug 26, 2010 at 11:13 AM, Vo Minh Thu not...@gmail.com wrote: Is is possible to get Network.Socket.ByteString.recv to be non-blocking (i.e. return directly even if no data is available) ? Unfortunately not. I have tried ti use setSocketOption sock NoDelay 1 but then I

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

2010-08-26 Thread Vo Minh Thu
2010/8/26 Johan Tibell johan.tib...@gmail.com: Hi Thu, On Thu, Aug 26, 2010 at 11:13 AM, Vo Minh Thu not...@gmail.com wrote: Is is possible to get Network.Socket.ByteString.recv to be non-blocking (i.e. return directly even if no data is available) ? Unfortunately not. I have tried ti

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

2010-08-26 Thread Johan Tibell
On Thu, Aug 26, 2010 at 1:08 PM, Vo Minh Thu not...@gmail.com wrote: Ok, that explains also why using fcntl directly on the fd didn't work either. So, I think I will go the FFI road and create my socket the way I want. Do you see another way? Not if you want a solution right now. You can

[Haskell-cafe] Re: Hackage on Linux

2010-08-26 Thread Simon Marlow
On 22/08/2010 11:41, Andrew Coppin wrote: Ivan Lazar Miljenovic wrote: Hackage has limited support for distro maintainers to state which packages are available on the distribution. Last I checked, it required distro maintainers to keep a text file somewhere up to date. Note that not all

Re: [Haskell-cafe] Re: Hackage on Linux

2010-08-26 Thread Don Stewart
marlowsd: If you look at the original Cabal design document[1], you'll see that one of the goals of Cabal was to be the glue that lets you convert an arbitrary Haskell library into a native package for a variety of systems - including MSIs on Windows. Indeed, I must admit when we were

Re: [Haskell-cafe] Re: Re : Re: Re : Error importing

2010-08-26 Thread Daniel Fischer
On Thursday 26 August 2010 09:04:23, Luc TAESCH wrote: and looked at Lekah's message: src\Main.hs:19:17:    Could not find module `Data.Map':      It is a member of the hidden package `containers-0.3.0.0'.      Perhaps you need to add `containers' to the build-depends in your .cabal

Re: [Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-08-26 Thread Daniel Fischer
On Thursday 26 August 2010 09:33:30, Heinrich Apfelmus wrote: Daniel Fischer wrote: John Lato wrote: Heinrich Apfelmus wrote: Do you have an example where you want chunking instead of single character access? I am unable to think of any examples where you want chunking for any

RE: [Haskell-cafe] foreign function interface Invalid type signature

2010-08-26 Thread Simon Peyton-Jones
The HEAD now does FFI by default (Haskell 2010) so you would not have tripped over this. But even if you use the -XHaskell98 flag to recover Haskell-98 mode, you get this error: Foo.hs:9:1: Invalid type signature: foreign export ccall foo :: CInt - CInt Perhaps you meant to use

Re: [Haskell-cafe] Re: Hackage on Linux

2010-08-26 Thread David Leimbach
On Thu, Aug 26, 2010 at 5:02 AM, Don Stewart d...@galois.com wrote: marlowsd: If you look at the original Cabal design document[1], you'll see that one of the goals of Cabal was to be the glue that lets you convert an arbitrary Haskell library into a native package for a variety of systems

[Haskell-cafe] Re: Crypto-API is stabilizing

2010-08-26 Thread Thomas DuBuisson
class (Binary p, Serialize p) = AsymCipher p where generateKeypair :: RandomGen g = g - BitLength - Maybe ((p,p),g) encryptAsym :: p - B.ByteString - B.ByteString decryptAsym :: p - B.ByteString - B.ByteString asymKeyLength :: p - BitLength Regarding AsymCipher:

Re: [Haskell-cafe] Re: Hackage on Linux

2010-08-26 Thread Andrew Coppin
David Leimbach wrote: It's quite practical. People are obsessed with shared library support but I can not for the life of me figure out why. Maybe because a simple Hello World program in Haskell becomes about 2MB when compiled? (The equivilent C program ends up being 15KB or something,

Re: [Haskell-cafe] Re: Hackage on Linux

2010-08-26 Thread aditya siram
It does make a difference in certain cases. For a 2MB binary to be trivial it assumes that (1) you are in a developed country (2) you are using a landline internet connection and not going through your cell-phone company, although this gap is closing fast. I feel this India whenever I visit

Re: [Haskell-cafe] On to applicative

2010-08-26 Thread michael rice
Hi Alexander, Didn't get to sleep till 4 AM and it took me a while to go though your post. So far... --- On Thu, 8/26/10, Alexander Solla a...@2piix.com wrote: From: Alexander Solla a...@2piix.com Subject: Re: [Haskell-cafe] On to applicative To: Cc: haskell-cafe Cafe haskell-cafe@haskell.org

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

2010-08-26 Thread Donn Cave
Quoth Vo Minh Thu not...@gmail.com, ... Ok, that explains also why using fcntl directly on the fd didn't work either. So, I think I will go the FFI road and create my socket the way I want. I have been doing this with TCP STREAM sockets for some time, for similar reasons and others, and as you

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

2010-08-26 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 8/26/10 05:13 , Vo Minh Thu wrote: Is is possible to get Network.Socket.ByteString.recv to be non-blocking (i.e. return directly even if no data is available) ? What are you really trying to do? The Haskelly solution to this is to use threads;

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

2010-08-26 Thread Vo Minh Thu
2010/8/26 Brandon S Allbery KF8NH allb...@ece.cmu.edu: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 8/26/10 05:13 , Vo Minh Thu wrote: Is is possible to get Network.Socket.ByteString.recv to be non-blocking (i.e. return directly even if no data is available) ? What are you really

[Haskell-cafe] Ordering TypeRep from Data.Typeable.

2010-08-26 Thread Serguey Zefirov
I think, that TypeRep type from Data.Typeable needs Ord class instance. It is unnecessary, but is handy when needed. My use case follows. I try to create graph whose node and arc labels are differently typed. So I can add Int node, Float node and link them by Conversion arc. Right now I am

[Haskell-cafe] Re: Chez What

2010-08-26 Thread Jeff Rubard
On Mon, Aug 9, 2010 at 11:47 AM, Jeff Rubard jeffrub...@gmail.com wrote: Haskell CURRY? Curried potatoes? The lambda calculus? Historical actuality? SI! LISP? John McCarthy? Etc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Re: Hackage on Linux

2010-08-26 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 8/26/10 10:23 , David Leimbach wrote: Go, for example, has no shared libraries, and the runtime fits in every binary. It does not even depend on libc. Go binaries call the system call interface of the kernel, and the net result is that I get

Re: [Haskell-cafe] On to applicative

2010-08-26 Thread Alexander Solla
On Aug 26, 2010, at 9:27 AM, michael rice wrote: Some functions just happen to map to other functions. $ is flip fmap. f $ functor = fmap f functor Brent Yorgey's post noted. map to? Take as arguments? maps to as in outputs. pure f * functor = f $ functor Prelude

Re: [Haskell-cafe] Re: Hackage on Linux

2010-08-26 Thread David Leimbach
On Thu, Aug 26, 2010 at 11:11 AM, Brandon S Allbery KF8NH allb...@ece.cmu.edu wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 8/26/10 10:23 , David Leimbach wrote: Go, for example, has no shared libraries, and the runtime fits in every binary. It does not even depend on libc.

Re: [Haskell-cafe] On to applicative

2010-08-26 Thread michael rice
When I began looking into applicative, I googled haskell applicative and grabbed the first one on the list, the wikipage. I think a better choice would have been the Learn You a Haskell section on functors/applicative, the second one on the list. I'm going to spend some time there but will no

[Haskell-cafe] Warning: Module `Prelude' is deprecated:

2010-08-26 Thread Michael Litchard
So lately when I use cabal to install something get Text/CSV.hs:1:0: Warning: Module `Prelude' is deprecated: You are using the old package `base' version 3.x. Future GHC versions will not support base version 3.x. You should update your code to

Re: [Haskell-cafe] Warning: Module `Prelude' is deprecated:

2010-08-26 Thread Ivan Lazar Miljenovic
On 27 August 2010 10:17, Michael Litchard mich...@schmong.org wrote: So lately when I use cabal to install something get Text/CSV.hs:1:0:    Warning: Module `Prelude' is deprecated:               You are using the old package `base' version 3.x.               Future GHC versions will not

Re: [Haskell-cafe] Warning: Module `Prelude' is deprecated:

2010-08-26 Thread Mathew de Detrich
As said, this is an issue with the package maintainer who explicitly used base 3.0 as a dependancy I believe that base 3 is gonna be killed in ghc 6.14 iirc On 27/08/2010 10:17 AM, Michael Litchard mich...@schmong.org wrote: So lately when I use cabal to install something get Text/CSV.hs:1:0:

Re: [Haskell-cafe] Warning: Module `Prelude' is deprecated:

2010-08-26 Thread Ivan Lazar Miljenovic
On 27 August 2010 11:42, Mathew de Detrich dete...@gmail.com wrote: As said, this is an issue with the package maintainer who explicitly used base 3.0 as a dependancy Or they have no upper bound on the version of base in their .cabal file, so cabal-install tries to be clever and defaults to

Re: [Haskell-cafe] Warning: Module `Prelude' is deprecated:

2010-08-26 Thread Jason Dagit
On Thu, Aug 26, 2010 at 6:45 PM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 27 August 2010 11:42, Mathew de Detrich dete...@gmail.com wrote: As said, this is an issue with the package maintainer who explicitly used base 3.0 as a dependancy Or they have no upper bound on the

Re: [Haskell-cafe] Warning: Module `Prelude' is deprecated:

2010-08-26 Thread Ivan Lazar Miljenovic
On 27 August 2010 12:01, Jason Dagit da...@codersbase.com wrote: I've added preference: base = 4, in my global cabal-install config and I haven't had a single issue since.  I HIGHLY recommend everyone to do this. Ooohhh, didn't know you could put preferences and constraints in your config file

Re: [Haskell-cafe] Re: Hackage on Linux

2010-08-26 Thread Richard O'Keefe
On Aug 27, 2010, at 6:11 AM, Brandon S Allbery KF8NH wrote: Um. That's a really good way to have all your programs stop working when the Linux kernel interface changes yet again (ABIs? We don't need no steenking ABIs! --- see in /usr/src/linux/Documentation). Solaris is similar; the only

Re: [Haskell-cafe] Re: Hackage on Linux

2010-08-26 Thread John Millikin
On Thu, Aug 26, 2010 at 20:51, Richard O'Keefe o...@cs.otago.ac.nz wrote: Maybe Linux is different.  One thing is NOT different, and that is Linux upgrades *DO* reliably break programs that use dynamic linking. Dynamic libraries get  - left out  - changed incompatibly  - moved some place