Re: [Haskell-cafe] How do people still not understand what FP is about? What are we doing wrong?
Agreed, definitely out of context now that he has inadvertently cleared that up since this post. That thing that they say about jumping to assumptions … definitely well proven and in force today. Shouldn't be posting to mailing lists so early in the morning. :-/ To be clear though, this post wasn't about calling anyone stupid. Chris most certainly isn't. Calling people stupid just because they disagree with you is a pretty awful thing and doesn't convince anyone anything. Maybe it was poorly worded, but I was more after ways to educate people why things are the way they are in haskell land and what powers that brings. The person is still able to disagree with that and prefer the old ways, but at least their decision wasn't fuelled by ignorance; which is the most important thing. But yeah; this is all out of context so all of the above is fairly moot, anyhow. Apologies for the wild early-morning assumptions, everyone! Cheers, Ben On Tuesday, 19 June 2012 at 6:43 AM, john melesky wrote: > On Tue, Jun 19, 2012 at 05:59:57AM +1000, Ben Kolera wrote: > > Saw this float by in twitter, and it made me a bit sad. Obviously > > this is still a large misunderstanding of FP in the larger > > programming community and it make me wonder what we FP enthusiasts > > are doing wrong to not get the message out to people. > > > > "Programming languages that require random senseless voodoo to get > > an effect are awesome. Let's make programming hard through poor > > design." [1] > > > > If you click through and look at his later tweets, it's clear he's > talking about Objective-C. > > Unless you're suggesting Objective-C is the language of FP > enthusiasts, i think it's safe to say you heard him out of context. :) > > -john ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How do people still not understand what FP is about? What are we doing wrong?
On Mon, Jun 18, 2012 at 5:21 PM, Gregory Collins wrote: > On Mon, Jun 18, 2012 at 10:51 PM, Ertugrul Söylemez wrote: > >> Indeed there is a line to be drawn here. However, I think I can fit >> both kinds of people under the adjective "retarded". >> > > Off-topic: it would be even better to avoid using this ugly adjective to > describe anyone, as it is deeply offensive to many and unfairly > marginalizes the differently-abled. > This. Please. -- brandon s allbery allber...@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How do people still not understand what FP is about? What are we doing wrong?
On Mon, Jun 18, 2012 at 10:51 PM, Ertugrul Söylemez wrote: > Indeed there is a line to be drawn here. However, I think I can fit > both kinds of people under the adjective "retarded". > Off-topic: it would be even better to avoid using this ugly adjective to describe anyone, as it is deeply offensive to many and unfairly marginalizes the differently-abled. G -- Gregory Collins ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [Haskell] JustHub 'Sherkin' Release
Hi Chris, > There is a worked out example at the bottom of the overview up on the > web site: http://justhub.org/overview thank you for the pointer, I think I found it: ^=7.4.1 List-0.4.2 fgl-5.4.2.4 hexpat-0.20.1 mtl-2.1.1 regex-base-0.93.2 regex-compat-0.95.1 regex-posix-0.95.2 text-0.11.2.1 transformers-0.3.0.0 utf8-string-0.3.7 Very nice, this looks quite straightforward. I wonder about two things: - Is it possible to pass configure-time flags to those libraries? For example, I would like to build "haskeline" with "-fterminfo". Can Hub do this? - How do you handle packages that depend on system libraries? "hsdns", for example, requires the adns library to build. Does Hub know about this? Take care, Peter ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How do people still not understand what FP is about? What are we doing wrong?
On Mon, Jun 18, 2012 at 1:39 PM, Jonathan Geddes wrote: > I believe you are observing and commiserating over what Paul Graham > famously refers to as "the blub paradox"[0]. > > Here is the problem from my perspective. It is a bootstrapping problem: > you have to think FP is good to invest the time to learn it, but you have > to invest a lot of time to learn it before you think it's good. This may be > why FP has found a place in academia--loads of smart people who want to > learn for the shear joy of learning. > I might be an "exceptional" case. I learned Perl of all things first. But I studied mathematics as an undergraduate, and found myself using "abstract" mathematical reasoning in order express and refactor computation all the time. A strongly typed, truly functional language makes it so that my insights are in fact static guarantees instead of relatively fragile reasoning that somebody else might break with a badly placed side effect -- and also relieved me of the burden of making sure there /weren't/ any badly placed side effects in a long computation. A lot of my procedural, OO peers really hated it when I did some of these transformations. Until they saw, by example, that the "complexity" I introduced was simplification. I stopped them from thinking about boxes, the things they contain, and moving things around in "space and time" and into thinking about the problem they were trying to solve. It also meant less typing, an easier time adding features, and easier maintenance. The code was harder to "read", but easier to make sense of. But I think the OP is just an invitation to philosophize about our superiority. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How do people still not understand what FP is about? What are we doing wrong?
just to add to the ridiculousness quotient of this conversation http://web.archive.org/web/20080406183542/http://www.lisperati.com/landoflisp/panel01.html (i don't know where to find this other than in the web archive.) ben On Jun 18, 2012, at 1:44 PM, Christopher Done wrote: > On 18 June 2012 22:28, Ertugrul Söylemez wrote: >> You just have to live with the fact that there will always be a small >> percentage of retarded people. It's best to just ignore them. > > Well, they're not stupid. Just very stubborn. Like most programmers. > Stupid people can be taught to be smarter, stubborn people don't want > to be taught. > > ___ > 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] [Haskell] ANNOUNCE: set-monad
Hi Derek, On 16 June 2012 21:53, Derek Elkins wrote: > The law that ends up failing is toList . > fromList /= id, i.e. fmap g . toList . fromList . fmap h /= fmap g . > fmap h This is not related to functor laws. The property that you desire is about toList and fromList. The toList and fromList functions are not required to satisfy toList . fromList /= id. This does not hold for Data.Set and it does not hold for the Data.Set.Monad wrapper either. Duplicates are lost when lists are converted into sets. Other instances of fromList and toList also fail to satisfy the property that you desire (e.g., Map). Cheers, George ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How do people still not understand what FP is about? What are we doing wrong?
Christopher Done wrote: > > You just have to live with the fact that there will always be a > > small percentage of retarded people. It's best to just ignore them. > > Well, they're not stupid. Just very stubborn. Like most programmers. > Stupid people can be taught to be smarter, stubborn people don't want > to be taught. Indeed there is a line to be drawn here. However, I think I can fit both kinds of people under the adjective "retarded". Greets, Ertugrul -- Key-ID: E5DD8D11 "Ertugrul Soeylemez " FPrint: BD28 3E3F BE63 BADD 4157 9134 D56A 37FA E5DD 8D11 Keysrv: hkp://subkeys.pgp.net/ signature.asc Description: PGP signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How do people still not understand what FP is about? What are we doing wrong?
On 18 June 2012 22:28, Ertugrul Söylemez wrote: > You just have to live with the fact that there will always be a small > percentage of retarded people. It's best to just ignore them. Well, they're not stupid. Just very stubborn. Like most programmers. Stupid people can be taught to be smarter, stubborn people don't want to be taught. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How do people still not understand what FP is about? What are we doing wrong?
On Tue, Jun 19, 2012 at 05:59:57AM +1000, Ben Kolera wrote: > Saw this float by in twitter, and it made me a bit sad. Obviously > this is still a large misunderstanding of FP in the larger > programming community and it make me wonder what we FP enthusiasts > are doing wrong to not get the message out to people. > > "Programming languages that require random senseless voodoo to get > an effect are awesome. Let's make programming hard through poor > design." [1] If you click through and look at his later tweets, it's clear he's talking about Objective-C. Unless you're suggesting Objective-C is the language of FP enthusiasts, i think it's safe to say you heard him out of context. :) -john ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [Haskell] JustHub 'Sherkin' Release
Hi Peter, > > hub save project >project.har > > I am curious to see what this file looks like. Could you please post a short example of one? There is a worked out example at the bottom of the overview up on the web site: http://justhub.org/overview The configurations are quite simple, just listing the global package and the list of packages in the user database. When I provide command sets for refining the versions of the tools used with each hub (esp. cabal-install, only possible by hacking the configuration file at the moment) I will add this information to the hub configuration archives. Chris ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [Haskell] ANNOUNCE: set-monad
Hi Dan, Thanks for your feedback and your question regarding the functor laws. Please try your example in GHCi and/or evaluate it by hand. The library does not violate the functor laws. I committed quick check properties for functor laws, as well as, laws for other type classes to the repo. You can give it a try. It is also possible, with a little bit of effort, to prove those properties by hand. Speaking of laws, BTW, your contrived Ord instance violates one of the Ord laws. The documentation for Ord says that: "The Ord class is used for totally ordered datatypes". Your definition violates the antisymmetry law [1]: If a <= b and b <= a then a == b by reporting two elements that are not equal as equal. Cheers, George [1] http://en.wikipedia.org/wiki/Totally_ordered On 16 June 2012 09:47, Dan Burton wrote: > Convenience aside, doesn't the functor instance conceptually violate some > sort of law? > > fmap (const 1) someSet > > The entire shape of the set changes. > > fmap (g . h) = fmap g . fmap h > > This law wouldn't hold given the following contrived ord instance > > data Foo = Foo { a, b :: Int } > instance Ord Foo where > compare = compare `on` a > > Given functions > > h foo = foo { a = 1 } > g foo = foo { a = b foo } > > Does this library address this? If so, how? If not, then you'd best note it > in the docs. > > On Jun 15, 2012 6:42 PM, "George Giorgidze" wrote: > > I would like to announce the first release of the set-monad library. > > On Hackage: http://hackage.haskell.org/package/set-monad > > The set-monad library exports the Set abstract data type and > set-manipulating functions. These functions behave exactly as their > namesakes from the Data.Set module of the containers library. In > addition, the set-monad library extends Data.Set by providing Functor, > Applicative, Alternative, Monad, and MonadPlus instances for sets. > > In other words, you can use the set-monad library as a drop-in > replacement for the Data.Set module of the containers library and, in > addition, you will also get the aforementioned instances which are not > available in the containers package. > > It is not possible to directly implement instances for the > aforementioned standard Haskell type classes for the Set data type > from the containers library. This is because the key operations map > and union, are constrained with Ord as follows. > > map :: (Ord a, Ord b) => (a -> b) -> Set a -> Set b > union :: (Ord a) => Set a -> Set a -> Set a > > The set-monad library provides the type class instances by wrapping > the constrained Set type into a data type that has unconstrained > constructors corresponding to monadic combinators. The data type > constructors that represent monadic combinators are evaluated with a > constrained run function. This elevates the need to use the > constraints in the instance definitions (this is what prevents a > direct definition). The wrapping and unwrapping happens internally in > the library and does not affect its interface. > > For details, see the rather compact definitions of the run function > and type class instances. The left identity and associativity monad > laws play a crucial role in the definition of the run function. The > rest of the code should be self explanatory. > > The technique is not new. This library was inspired by [1]. To my > knowledge, the original, systematic presentation of the idea to > represent monadic combinators as data is given in [2]. There is also a > Haskell library that provides a generic infrastructure for the > aforementioned wrapping and unwrapping [3]. > > The set-monad library is particularly useful for writing set-oriented > code using the do and/or monad comprehension notations. For example, > the following definitions now type check. > > s1 :: Set (Int,Int) > s1 = do a <- fromList [1 .. 4] > b <- fromList [1 .. 4] > return (a,b) > > -- with -XMonadComprehensions > s2 :: Set (Int,Int) > s2 = [ (a,b) | (a,b) <- s1, even a, even b ] > > s3 :: Set Int > s3 = fmap (+1) (fromList [1 .. 4]) > > As noted in [1], the implementation technique can be used for monadic > libraries and EDSLs with restricted types (compiled EDSLs often > restrict the types that they can handle). Haskell's standard monad > type class can be used for restricted monad instances. There is no > need to resort to GHC extensions that rebind the standard monadic > combinators with the library or EDSL specific ones. > > [1] CSDL Blog: The home of applied functional programming at KU. Monad > Reification in Haskell and the Sunroof Javascript compiler. > http://www.ittc.ku.edu/csdlblog/?p=88 > > [2] Chuan-kai Lin. 2006. Programming monads operationally with Unimo. > In Proceedings of the eleventh ACM SIGPLAN International Conference on > Functional Programming (ICFP '06). ACM. > > [3] Heinrich Apfelmus. The operational package. > http://hackage.haskell.org/package/operational > > ___ > Haskell mailing l
Re: [Haskell-cafe] How do people still not understand what FP is about? What are we doing wrong?
I believe you are observing and commiserating over what Paul Graham famously refers to as "the blub paradox"[0]. Here is the problem from my perspective. It is a bootstrapping problem: you have to think FP is good to invest the time to learn it, but you have to invest a lot of time to learn it before you think it's good. This may be why FP has found a place in academia--loads of smart people who want to learn for the shear joy of learning. In my experience, it is often useful to provide a person with another motive to learn FP. If you can get them to learn anything at all, you can hope to get the bootstrapping process going. For example, one friend of mine really enjoys a good debate, but he really couldn't argue with me when it came to FP and so he went off to learn it. Now we argue about Haskell vs Scala for much more time than is productive, but he is sold on FP. In another case a junior programmer asked me how he could be more productive and I told him to learn FP. Anyway, I don't think things are not as bleak as you might think. See, for example [1]'s headline for the month of June. While not exactly scientific, it is encouraging. [0] - http://www.paulgraham.com/avg.html [1] - http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html -J Arthur On Mon, Jun 18, 2012 at 1:59 PM, Ben Kolera wrote: > Saw this float by in twitter, and it made me a bit sad. Obviously this is > still a large misunderstanding of FP in the larger programming community > and it make me wonder what we FP enthusiasts are doing wrong to not get the > message out to people. > > "Programming languages that require random senseless voodoo to get an > effect are awesome. Let's make programming hard through poor design." [1] > > The sad thing about this is that the inverse of this has more truth to it; > that "languages that allow people to intersperse side effects anywhere in > their computation without thought are flawed by design and allow > programmers to do stupid things that hinder the composability, thread > safety and ability to reason of/about their code". > > Has anyone had any experience / success with convincing people that the > "senseless voodoo" is actually a boon rather than a bane? > > Is it even worth trying to convince people so set in their ways? > > ( Sorry if this is even too off-topic for the cafe. Just needed a place to > vent my frustration at this. ) > > Cheers, > Ben > > [1] https://twitter.com/cwestin63/status/214793627170390018 > > > > ___ > 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] How do people still not understand what FP is about? What are we doing wrong?
Ben Kolera wrote: > "Programming languages that require random senseless voodoo to get an > effect are awesome. Let's make programming hard through poor design." > [1] > > [...] > > Is it even worth trying to convince people so set in their ways? Someone saying something as stupid as this probably won't be convinced anyway. The statement shows that he didn't even take the time to actually learn what FP is about before judging, so chances are you're just wasting your time. Such people are stubborn enough not to be convinced even by actual code. Don't worry, though. This is really the exceptional case. In my experience most people actually get the point of FP and appreciate its better productivity, but simply don't feel like spending the time to learn it along with the associated complexity of unlearning what they previously knew. The other people are largely neutral or say that they personally can't imagine how that can make you productive (which is honest and objective and provides a base for further discussion). You just have to live with the fact that there will always be a small percentage of retarded people. It's best to just ignore them. Greets, Ertugrul -- Not to be or to be and (not to be or to be and (not to be or to be and (not to be or to be and ... that is the list monad. signature.asc Description: PGP signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell (GHC 7) on ARM
On 2012-Jun-12, Robert Wills wrote: > Where do you even see ghc? I can't see ghc listed anywhere here: > > http://archlinuxarm.org/packages > > -Rob On that very page, http://archlinuxarm.org/packages I type "ghc" under Keywords, and it shows this (without going to another URL): ArchRepoPackage Version Description armv5 extra ghc 6.12.3-1The Glasgow Haskell Compiler Greg > > On Tue, Jun 12, 2012 at 2:12 AM, wrote: > > > This is my first time hearing of Arch Linux ARM (http://archlinuxarm.org/) > > but since it is based on Arch Linux (http://www.archlinux.org/), > > it seems odd that Arch Linux ARM's ghc is still 6.12.3, > > when Arch Linux's ghc has been 7.4.1 since March 3 or earlier. > > As far as I could see, all the other Arch Linux ARM > > packages are the same versions as those in Arch Linux. > > Maybe it would be worthwhile to prod the Arch Linux ARM developers? > > > > On 2012-Jun-10, Ben Gamari wrote: > > > > > > > > > Joshua Poehls writes: > > > > > > > Hello Ben, > > > > > > > Hello, > > > > > > Sorry for the latency. I'm currently on vacation in Germany so I haven't > > > had terribly consistent Internet access. > > > > > > I've Cc'd haskell-cafe@ as I've been meaning to document my experiences > > > anyways and your email seems like a good excuse to do this. > > > > > > > > > > I just got a Raspberry Pi and I'm interested in running Haskell on it. > > So > > > > far I'm running Arch Linux ARM and I noticed there is is a GHC package > > > > available, but it is version 6.12.3. > > > > > > > > ... > > > ... > > > > > > -- > > Gregory D. Weber, Ph. D.: > > Associate Professor of Informatics / \ > > Indiana University East 0 : > > Tel. (765) 973-8420; FAX (765) 973-8550 / \ > > http://mypage.iu.edu/~gdweber/ 1 [] > > > > ___ > > 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 -- Gregory D. Weber, Ph. D.: Associate Professor of Informatics / \ Indiana University East 0 : Tel. (765) 973-8420; FAX (765) 973-8550 / \ http://mypage.iu.edu/~gdweber/ 1 [] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] How do people still not understand what FP is about? What are we doing wrong?
Saw this float by in twitter, and it made me a bit sad. Obviously this is still a large misunderstanding of FP in the larger programming community and it make me wonder what we FP enthusiasts are doing wrong to not get the message out to people. "Programming languages that require random senseless voodoo to get an effect are awesome. Let's make programming hard through poor design." [1] The sad thing about this is that the inverse of this has more truth to it; that "languages that allow people to intersperse side effects anywhere in their computation without thought are flawed by design and allow programmers to do stupid things that hinder the composability, thread safety and ability to reason of/about their code". Has anyone had any experience / success with convincing people that the "senseless voodoo" is actually a boon rather than a bane? Is it even worth trying to convince people so set in their ways? ( Sorry if this is even too off-topic for the cafe. Just needed a place to vent my frustration at this. ) Cheers, Ben [1] https://twitter.com/cwestin63/status/214793627170390018 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Single board computers on HaskellWiki
L.S., As more and more people start to develop software in Haskell for single board computers, I created the HaskellWiki pages Arduino[0], ARM[1], Raspberry Pi[2], BeagleBoard[3] and PandaBoard[4]. I hope experts on the matter will give these pages more body (for example, describe what is necessary to get Haskell programs running on these platforms) and add links to relevant web pages. The PandaBoard page needs an image, I couldn't find one with public domain license. If you don't know how to edit HaskellWiki pages, read the contribute page[5] first. To get your appetite wet, if you are not involved in this yet, take a look at the Arduino Weather Clock[6]; this is really a fun project. Regards, Henk-Jan van Tuyl [0] http://www.haskell.org/haskellwiki/Arduino [1] http://www.haskell.org/haskellwiki/ARM [2] http://www.haskell.org/haskellwiki/Raspberry_Pi [3] http://www.haskell.org/haskellwiki/BeagleBoard [4] http://www.haskell.org/haskellwiki/PandaBoard [5] http://www.haskell.org/haskellwiki/HaskellWiki:Contributing [6] http://www.geeky-gadgets.com/arduino-weather-clock-13-01-2010/ -- http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming -- ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [Haskell] JustHub 'Sherkin' Release
Hi Chris, > hub save project >project.har I am curious to see what this file looks like. Could you please post a short example of one? Take care, Peter ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Receiving UDP messages on Windows 7
Turns out it is the firewall, which is odd because I told Windows to allow it when it popped up the firewall dialog. Turning off the firewall for that interface fixed the issue. On Mon, Jun 18, 2012 at 11:14 AM, Holger Reinhardt wrote: > Hi, > > I added the following code to your program: > > > import qualified Data.ByteString.Char8 as B > > sendMsg = withSocketsDo $ do > sock <- socket AF_INET Datagram defaultProtocol > target <- inet_addr "192.168.2.103" -- put your servers IP here > sendTo sock (B.pack "TEST") $ SockAddrInet target > > > On my Windows 7 machine this works fine; the messages are received by the > server. It also works if I run the sendMsg program on a Linux VM which lives > on a separate IP. > So it seems that it's not a general bug but rather a problem with your > setup, possibly a firewall. > > 2012/6/18 Edward Amsden >> >> Hi all, >> >> I have the following program, which I'm running using runghc 7.4.1 >> with HP2012.2 on Windows 7: >> >> == >> {-# LANGUAGE OverloadedStrings #-} >> module Main where >> >> import Network.Socket hiding (send, sendTo, recv, recvFrom) >> import Network.Socket.ByteString >> import qualified Data.Text as T >> import qualified Data.Text.Encoding as T >> import qualified Data.Text.IO as T >> >> port :: String >> port = show ( :: Int) >> >> main :: IO () >> main = withSocketsDo $ do >> addrInf:_ <- fmap (filter ((== AF_INET) . addrFamily)) $ getAddrInfo >> (Just (defaultHints {addrFlags = [AI_PASSIVE]})) Nothing (Just port) >> putStrLn "Address info: " >> print addrInf >> sock <- socket (addrFamily addrInf) Datagram defaultProtocol >> putStrLn "Socket created" >> bindSocket sock (addrAddress addrInf) >> putStrLn "Socket bound" >> let procMessages = >> do >> (msg, addr) <- recvFrom sock 1024 >> let addrTxt = T.pack $ show addr >> msgTxt = T.decodeUtf8 msg >> outputTxt = T.concat [addrTxt, " says ", msgTxt] >> T.putStrLn outputTxt >> procMessages >> procMessages >> == >> >> I'm trying to receive incoming UDP packets on port . >> Unfortunately, when I run the program it does not receive packets. It >> prints the address info, and the messages that the socket has been >> created and bound. When I run Wireshark I can see that there are >> indeed incoming UDP packets arriving on port (from another >> computer on the local network running a proprietary program). >> >> The other bit of information that may be useful is that the machine >> has 2 network interfaces. However, when I replace the Nothing >> parameter of getAddrInfo with >> (Just "192.168.1.3") which is the address of the correct NIC, the >> behavior is as before. >> >> Is there something I'm missing? >> >> ___ >> Haskell-Cafe mailing list >> Haskell-Cafe@haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe > > -- Edward Amsden Student Computer Science Rochester Institute of Technology www.edwardamsden.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Receiving UDP messages on Windows 7
Hi, I added the following code to your program: import qualified Data.ByteString.Char8 as B sendMsg = withSocketsDo $ do sock <- socket AF_INET Datagram defaultProtocol target <- inet_addr "192.168.2.103" -- put your servers IP here sendTo sock (B.pack "TEST") $ SockAddrInet target On my Windows 7 machine this works fine; the messages are received by the server. It also works if I run the sendMsg program on a Linux VM which lives on a separate IP. So it seems that it's not a general bug but rather a problem with your setup, possibly a firewall. 2012/6/18 Edward Amsden > Hi all, > > I have the following program, which I'm running using runghc 7.4.1 > with HP2012.2 on Windows 7: > > == > {-# LANGUAGE OverloadedStrings #-} > module Main where > > import Network.Socket hiding (send, sendTo, recv, recvFrom) > import Network.Socket.ByteString > import qualified Data.Text as T > import qualified Data.Text.Encoding as T > import qualified Data.Text.IO as T > > port :: String > port = show ( :: Int) > > main :: IO () > main = withSocketsDo $ do > addrInf:_ <- fmap (filter ((== AF_INET) . addrFamily)) $ getAddrInfo > (Just (defaultHints {addrFlags = [AI_PASSIVE]})) Nothing (Just port) > putStrLn "Address info: " > print addrInf > sock <- socket (addrFamily addrInf) Datagram defaultProtocol > putStrLn "Socket created" > bindSocket sock (addrAddress addrInf) > putStrLn "Socket bound" > let procMessages = >do > (msg, addr) <- recvFrom sock 1024 > let addrTxt = T.pack $ show addr > msgTxt = T.decodeUtf8 msg > outputTxt = T.concat [addrTxt, " says ", msgTxt] > T.putStrLn outputTxt >procMessages > procMessages > == > > I'm trying to receive incoming UDP packets on port . > Unfortunately, when I run the program it does not receive packets. It > prints the address info, and the messages that the socket has been > created and bound. When I run Wireshark I can see that there are > indeed incoming UDP packets arriving on port (from another > computer on the local network running a proprietary program). > > The other bit of information that may be useful is that the machine > has 2 network interfaces. However, when I replace the Nothing > parameter of getAddrInfo with > (Just "192.168.1.3") which is the address of the correct NIC, the > behavior is as before. > > Is there something I'm missing? > > ___ > 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
[Haskell-cafe] Receiving UDP messages on Windows 7
Hi all, I have the following program, which I'm running using runghc 7.4.1 with HP2012.2 on Windows 7: == {-# LANGUAGE OverloadedStrings #-} module Main where import Network.Socket hiding (send, sendTo, recv, recvFrom) import Network.Socket.ByteString import qualified Data.Text as T import qualified Data.Text.Encoding as T import qualified Data.Text.IO as T port :: String port = show ( :: Int) main :: IO () main = withSocketsDo $ do addrInf:_ <- fmap (filter ((== AF_INET) . addrFamily)) $ getAddrInfo (Just (defaultHints {addrFlags = [AI_PASSIVE]})) Nothing (Just port) putStrLn "Address info: " print addrInf sock <- socket (addrFamily addrInf) Datagram defaultProtocol putStrLn "Socket created" bindSocket sock (addrAddress addrInf) putStrLn "Socket bound" let procMessages = do (msg, addr) <- recvFrom sock 1024 let addrTxt = T.pack $ show addr msgTxt = T.decodeUtf8 msg outputTxt = T.concat [addrTxt, " says ", msgTxt] T.putStrLn outputTxt procMessages procMessages == I'm trying to receive incoming UDP packets on port . Unfortunately, when I run the program it does not receive packets. It prints the address info, and the messages that the socket has been created and bound. When I run Wireshark I can see that there are indeed incoming UDP packets arriving on port (from another computer on the local network running a proprietary program). The other bit of information that may be useful is that the machine has 2 network interfaces. However, when I replace the Nothing parameter of getAddrInfo with (Just "192.168.1.3") which is the address of the correct NIC, the behavior is as before. Is there something I'm missing? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Noticed this change about infix decls in GHC 7.4.2
Yes, it's a bug. Happily a dup of http://hackage.haskell.org/trac/ghc/ticket/6120, which is already fixed. I'll add your program as a regression test though. Thanks for reporting Simon | -Original Message- | From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe- | boun...@haskell.org] On Behalf Of Christopher Done | Sent: 17 June 2012 19:54 | To: Haskell Cafe | Subject: [Haskell-cafe] Noticed this change about infix decls in GHC 7.4.2 | | So I have some module, in a work project that I'm portnig from GHC | 6.12.3 to GHC 7.4.2, | | module Data.Monoid.Operator where | | import Data.Monoid | | (++) :: Monoid a => a -> a -> a | (++) = mappend | infixr 5 ++ | | This compiles happily on GHC 6.12.3, but on 7.4.2 says: | | src/Data/Monoid/Operator.hs:9:10: | Ambiguous occurrence `++' | It could refer to either `Data.Monoid.Operator.++', | defined at src/Data/Monoid/Operator.hs:8:1 |or `Prelude.++', | imported from `Prelude' at | src/Data/Monoid/Operator.hs:3:8-27 | (and originally defined in `GHC.Base') | | It seems that it used to assign higher priority to the declared thing | in the current module over the imported one. Is this intentional? I'd | suspect not, given that if I comment the binding out: | | -- (++) :: Monoid a => a -> a -> a | -- (++) = mappend | | I get: | | src/Data/Monoid/Operator.hs:9:10: | The fixity signature for `++' lacks an accompanying binding |(The fixity signature must be given where `++' is declared) | | Which seems to contradict the previous error message. | | Bug? | | Ciao! | | P.S. Yes, I know I can fix this by not importing Prelude. | P.P.S Yes, I know there's a <> or <+> defined now, but I prefer (++), thanks. | | ___ | 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