Send Beginners mailing list submissions to beginners@haskell.org To subscribe or unsubscribe via the World Wide Web, visit http://www.haskell.org/mailman/listinfo/beginners or, via email, send a message with subject or body 'help' to beginners-requ...@haskell.org
You can reach the person managing the list at beginners-ow...@haskell.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Beginners digest..." Today's Topics: 1. Re: Re: Is Haskell for me? (Felipe Lessa) 2. Re: Re: Is Haskell for me? (geremy condra) 3. Re: Help for type matching (Hong Yang) 4. Re: Applicative Parsec (Heinrich Apfelmus) 5. maybe this could be improved? (Michael Mossey) 6. Installing packages in Ubuntu (Glurk) 7. Re: Installing packages in Ubuntu (Magnus Therning) 8. Re: Installing packages in Ubuntu (Tom Tobin) 9. MULTICONF-10 Call for papers (John Edward) ---------------------------------------------------------------------- Message: 1 Date: Fri, 6 Nov 2009 19:58:30 -0200 From: Felipe Lessa <felipe.le...@gmail.com> Subject: Re: [Haskell-beginners] Re: Is Haskell for me? To: Gaius Hammond <ga...@gaius.org.uk> Cc: beginners@haskell.org Message-ID: <c2701f5c0911061358k5b84c06eoa49091140fe99...@mail.gmail.com> Content-Type: text/plain; charset=UTF-8 On 11/6/09, Gaius Hammond <ga...@gaius.org.uk> wrote: > To be fair, Python offloads its heavy lifting to C libraries - NumPy > and SciPy run at very close to full C speed on large datasets. This is > also how Matlab works. Unladen Swallow is an upcoming JIT compiler for > Python. > > Where Haskell shines for computation is when you can leverage lazy > evaluation. *If* you can offload most of your work to SciPy. Depending on what you do this is at least difficult. I don't know how much of a neural network can be represented as big fat matrix :). -- Felipe. ------------------------------ Message: 2 Date: Fri, 6 Nov 2009 18:37:30 -0500 From: geremy condra <debat...@gmail.com> Subject: Re: [Haskell-beginners] Re: Is Haskell for me? To: Felipe Lessa <felipe.le...@gmail.com> Cc: beginners@haskell.org Message-ID: <f3cc57c60911061537p27e7c23dib2e3534ff3b41...@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 On Fri, Nov 6, 2009 at 4:58 PM, Felipe Lessa <felipe.le...@gmail.com> wrote: > On 11/6/09, Gaius Hammond <ga...@gaius.org.uk> wrote: >> To be fair, Python offloads its heavy lifting to C libraries - NumPy >> and SciPy run at very close to full C speed on large datasets. This is >> also how Matlab works. Unladen Swallow is an upcoming JIT compiler for >> Python. >> >> Where Haskell shines for computation is when you can leverage lazy >> evaluation. > > *If* you can offload most of your work to SciPy. Depending on what you > do this is at least difficult. I don't know how much of a neural > network can be represented as big fat matrix :). > > -- > Felipe. Neural networking can be easily handled in both Python and C. I've used my own Graphine graph theory package for it and found that it was quite easy and reasonably fast, and certainly LEDA is a very high performance, pretty easy-to-use library. There's no need to coerce ANNs into a matrix form if you don't want to. Geremy Condra ------------------------------ Message: 3 Date: Fri, 6 Nov 2009 17:57:47 -0600 From: Hong Yang <hyang...@gmail.com> Subject: [Haskell-beginners] Re: Help for type matching To: beginners@haskell.org Message-ID: <f31db34d0911061557n286d6938k1ac684d14f6c8...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" My mistake. I did not read the Text.CSV.ByteString document carefully. parseCSV requires a strict ByteString, but I was feeding a lazy one. Have a good weekend! Hong On Fri, Nov 6, 2009 at 3:47 PM, Hong Yang <hyang...@gmail.com> wrote: > I have the following code: > > $$$$$$$$ > module Main where > > import System.Environment (getArgs) > import Text.CSV.ByteString > import qualified Data.ByteString.Lazy.Char8 as L > > main = do > [args] <- getArgs > file <- L.readFile args > let result = parseCSV file > case result of > Nothing -> putStrLn "Error when parsing!" > Just contents -> do > putStrLn "parsing OK!" > -- map_header_records contents > $$$$$$$$ > > which yielded the error as follows: > > Couldn't match expected type `Data.ByteString.Internal.ByteString' > against inferred type `L.ByteString' > In the first argument of `parseCSV', namely `file' > In the expression: parseCSV file > In the definition of `result': result = parseCSV file > > readFile in the Data.ByteString.Lazy.Char8 module returns ByteString type. > Since the module is qualified as L, L.readFile returns L.ByteString. But > parseCSV expects a ByteString. Sometimes this is annoying, because it makes > type matching difficult (at least for me, a beginner). I really wish Haskell > can intelligently treat L.ByteString, M.ByteString, and whatever > X.ByteString the same as ByteString, and match them. > > Can someone tell me how to solve the above problem? > > Thanks, > > Hong > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.haskell.org/pipermail/beginners/attachments/20091106/5814097b/attachment-0001.html ------------------------------ Message: 4 Date: Sat, 07 Nov 2009 09:53:07 +0100 From: Heinrich Apfelmus <apfel...@quantentunnel.de> Subject: [Haskell-beginners] Re: Applicative Parsec To: beginners@haskell.org Message-ID: <hd3chj$a8...@ger.gmane.org> Content-Type: text/plain; charset=UTF-8 Matthias Guedemann wrote: > Hi Brent, > > thanks for the illustrative example. > >> For example, consider parsing a file which contains a positive >> integer, followed by that many letters. For example, >> >> 3xyz >> 12abcdefghijkl >> >> are two instances of this format. In order to parse this, a monadic >> interface is required, since the result of parsing the number must be >> used to decide how many things to parse after that. > > I see, but as long as I want to parse context free grammars, it is > sufficient? Yep. The monadic version can handle context-sensitive grammars. Incidentally, this is why the Utrecht parsing libraries ( uu-parsinglib ) only offers an applicative interface. Regards, apfelmus -- http://apfelmus.nfshost.com ------------------------------ Message: 5 Date: Sat, 7 Nov 2009 09:44:48 -0800 (PST) From: "Michael Mossey" <m...@alumni.caltech.edu> Subject: [Haskell-beginners] maybe this could be improved? To: beginners@haskell.org Message-ID: <1268.75.50.149.126.1257615888.squir...@mail.alumni.caltech.edu> Content-Type: text/plain;charset=iso-8859-1 I've got some code which could be made simpler, I hope. the problem is this: I am implementing a software sampling synthesizer. For a given musical instrument, like piano, there are sound samples in memory. One purchases or creates sample sets. To save time money & resources, most sample sets are not complete---they have samples for only some of the pitches. Perhaps every third pitch has a sample. For the software to produce the sound for a non-included pitch, the software finds the closest included sample and plays it back slightly slower/faster to get the target pitch. That leads to the following code. Any ideas for improvement are welcome. The problem is that there are many cases to check: an empty map? the requested pitch less than all available pitches, greater than all available, or somewhere between? I am specifically writing this to run in O( log n) time. (It would be simpler as O(n).) This particular algorithm probably doesn't need to run in O(log n) time, but I want to do it as an educational experience---I will have other applications that need to use Map in O(log n) time. import Control.Monad.Identity import Control.Monad.Error import Control.Monad import qualified Data.Map as M type Pitch = Int type Sample = String type SampleMap = M.Map Pitch Sample -- Given a SampleMap and a Pitch, find the Pitch in the SampleMap -- which is closest to the supplied Pitch and return that. Also -- handle case of null map by throwing an error. findClosestPitch :: SampleMap -> Pitch -> ErrorT String Identity Pitch findClosestPitch samples inPitch = do when (M.null samples) $ throwError "Was given empty sample table." case M.splitLookup inPitch samples of (_,Just _,_ ) -> return inPitch (m1,_ ,m2) | (M.null m1) && not (M.null m2) -> case1 | not (M.null m1) && (M.null m2) -> case2 | otherwise -> case3 where case1 = return . fst . M.findMin $ m2 case2 = return . fst . M.findMax $ m1 case3 = return $ closest (fst . M.findMax $ m1) (fst . M.findMin $ m2) closest a b = if abs (a - inPitch) < abs (b - inPitch) then a else b ------------------------------ Message: 6 Date: Sat, 7 Nov 2009 22:05:34 +0000 (UTC) From: Glurk <streb...@hotmail.com> Subject: [Haskell-beginners] Installing packages in Ubuntu To: beginners@haskell.org Message-ID: <loom.20091107t230222-...@post.gmane.org> Content-Type: text/plain; charset=us-ascii Hi, I'm a beginner to both Cabal and Linux. I'm a bit confused as to whether I need to be using Cabal when installng packages. I'm running Ubuntu 9.10, and from the Synaptic Package Manager, I can select various Haskell packages to install - will this install the package correctly, or is there something I need to do in Cabal as well ? Thanks ! :) ------------------------------ Message: 7 Date: Sat, 7 Nov 2009 22:50:21 +0000 From: Magnus Therning <mag...@therning.org> Subject: Re: [Haskell-beginners] Installing packages in Ubuntu To: Glurk <streb...@hotmail.com> Cc: beginners@haskell.org Message-ID: <e040b520911071450w608b8fe6w93f2f8d7fa9e3...@mail.gmail.com> Content-Type: text/plain; charset=UTF-8 On Sat, Nov 7, 2009 at 10:05 PM, Glurk <streb...@hotmail.com> wrote: > Hi, > > I'm a beginner to both Cabal and Linux. > I'm a bit confused as to whether I need to be using Cabal when installng > packages. > > I'm running Ubuntu 9.10, and from the Synaptic Package Manager, I can select > various Haskell packages to install - will this install the package correctly, > or is there something I need to do in Cabal as well ? > > Thanks ! :) IMNSHO, cabal (the tool) is primarily for systems with broken, or non-existing package managers (read Windows). For other systems, including Ubuntu, people should use the native packaging system as far as possible, only reverting to cabal when that fails (for whatever reason). So, in short, use Synaptic until you come to a situation where you need something that isn't packaged for Ubuntu yet. Even then I'd suggest you first check for a source package in Debian. Only if everything else fails should you reach for cabal. /M -- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnusï¼ therningï¼org Jabber: magnusï¼ therningï¼org http://therning.org/magnus identi.ca|twitter: magthe ------------------------------ Message: 8 Date: Sat, 7 Nov 2009 17:03:56 -0600 From: Tom Tobin <korp...@korpios.com> Subject: Re: [Haskell-beginners] Installing packages in Ubuntu To: beginners@haskell.org Message-ID: <bf0b20a90911071503r23af8e7bo1d2cce3339022...@mail.gmail.com> Content-Type: text/plain; charset=UTF-8 On Sat, Nov 7, 2009 at 4:50 PM, Magnus Therning <mag...@therning.org> wrote: > IMNSHO, cabal (the tool) is primarily for systems with broken, or > non-existing package managers (read Windows). Â For other systems, > including Ubuntu, people should use the native packaging system as far > as possible, only reverting to cabal when that fails (for whatever > reason). I strongly disagree with this sentiment. OS package managers tend to lag behind in releases, assuming they have your package at all; this problem is severely compounded when you're dealing with a lesser-used language like Haskell. I always use cabal (which, IMHO, is a much better tool than similar tools for other languages, e.g., Python's easy_install), and believe OS package manager use should be discouraged for Haskell. (I'll grant that cabal needs an "uninstall" command, as well as a working "upgrade all".) ------------------------------ Message: 9 Date: Sun, 8 Nov 2009 05:52:25 -0800 (PST) From: John Edward <jeedw...@yahoo.com> Subject: [Haskell-beginners] MULTICONF-10 Call for papers To: beginners@haskell.org Message-ID: <803359.38547...@web45910.mail.sp1.yahoo.com> Content-Type: text/plain; charset="iso-8859-1" MULTICONF-10 Call for papers The 2010 multi-conference (MULTICONF-10) (website: http://www.promoteresearch.org) will be held during July 12-14, 2010 in Orlando, Florida, USA. The primary goal of MULTICONF is to promote research and developmental activities in computer science, information technology, control engineering, and related fields. Another goal is to promote the dissemination of research to a multidisciplinary audience and to facilitate communication among researchers, developers, practitioners in different fields. The following conferences are planned to be organized as part of MULTICONF-10. International Conference on Artificial Intelligence and Pattern Recognition (AIPR-10) International Conference on Automation, Robotics and Control Systems (ARCS-10) International Conference on Bioinformatics, Computational Biology, Genomics and Chemoinformatics (BCBGC-10) International Conference on Computer Networks (CN-10) International Conference on Enterprise Information Systems and Web Technologies (EISWT-10) International Conference on High Performance Computing Systems (HPCS-10) International Conference on Information Security and Privacy (ISP-10) International Conference on Image and Video Processing and Computer Vision (IVPCV-10) International Conference on Software Engineering Theory and Practice (SETP-10) International Conference on Theoretical and Mathematical Foundations of Computer Science (TMFCS-10) We invite draft paper submissions. Please see the website http://www.promoteresearch.org for more details. Sincerely John Edward Publicity committee -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.haskell.org/pipermail/beginners/attachments/20091108/1e9dcd07/attachment.html ------------------------------ _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners End of Beginners Digest, Vol 17, Issue 10 *****************************************