[Haskell-cafe] Re: Why purely in haskell?
Luke Palmer dialog with myself: On Jan 15, 2008 12:29 AM, [EMAIL PROTECTED] wrote: When math says that something is undefined, in my little brain I understand that there is no answer. I'm not sure if I'm agreeing or disagreeing with you here. Depends on exactly what you mean by no answer. Yes, this is a doctrinal problem. Since *any* concrete reaction, e.g., an error message is a kind of answer, the only - unusable as it is - way of not providing it is to fail the termination... When I was a TA for calculus 2, students were presented with something like the following problem: Find the limit: lim (sin x / x) x-0 And proceeding, they would reduce this to: sin 0 / 0 0 / 0 Look in the book that said 0/0 is undefined, and write undefined on the paper as if that were the answer. For the calculus uninclined (I figure that is a vast minority on this list), the answer is 1. In that case, undefined meant you did the problem wrong. And the error was precisely when they wrote 0 on the bottom of the division sign. What I see faulty here is that your students were not given, or could not grasp the only serious word in the problem statement, the word *limit*. In engineering, physics, etc., sometimes math is conveyed a bit approxima- tively, swallowing some touchy points, and relying on intuition. This is unavoidable, question of time. I taught math to physics students a bit and there is no free lunch here. But a true mathematician lecturing to genuine math students *here* makes the things clear as crystal. And what I learnt then was exactly that: undefined means no answer. I may be wrong, but it is possible that in such state of spirit of the Creators the Haskell undefined object arose into being. Whether you say that: Instead, when mathematicians say undefined, they usually mean not that the question has no answer, but that the question you're asking doesn't even make sense as a question. - or use such words as illegal, forbidden, etc., this is a question of philosophy more than math. At least: semantics. For Leibniz (or his eternal foe, Spinoza) it could even belong to ethics... We, or whoever might speculate until the solution of the non-termination problem whether math forbids anything, or what is the sense of a question, or the sense of the sense. Mathematicians I crossed in my life (plenty of them; same building...), at least some of them, *did* say that undefined means no answer. Your example with the King on the chessboard goes along the doctrine professed by Achim S., forbidding something. But this word, legality, etc. is a juridic term, something not so meaningful in math. OK, you are forbidden to try 0/0. But you DO. So what? You claim that math doesn't say undefined, mathematicians do, etc. Now, does MATH say Hey! there is no sense in what you are doing!? But math as an abstract domain, does it have built-in the notion of sense neither. You say: you are out of system/sense. I say you get no answer. I believe that my standpoint is more operational. Personally, I loathe the existence of NaN and +-Infinity in floating point types. I conclude that you live far from the numeric world. But I was raised as physicist, and without them, the implementation of several algorithms would be extremely difficult. Someone here made an enlightinging point encouraging us to think of floating point numbers not as numbers but as intervals. That makes me slightly more okay with the infinities, but NaN still bugs me. I'd prefer an error: Haskell's way of saying you did the problem wrong. That would be most useful in the kinds of things I do with floating point numbers (games). But there are probably other areas where the IEEE semantics are more useful. Once more, last time... The interval interpretation is a bit pulled out of thin air. It might be thought of, as the last bit rounding has sth. to do with fuzzy arith., but I don't think that this is the issue. I believe that if we wanted to be as close to math as we would be happy with, the only way is to extend the typing of numbers. There are numbers, and there are NaNs and infinities. PERFECTLY decent objects, with concrete representations (or families of). The arith. ops may generate those types, and if applied to them, the disease propagates. Simple as that. For many, many numerical library procedures which use automatic search through some domains, for vectorized computations, etc., bombing is almost as bad as non-termination. It provides you gratuitously with a waste of time. Absolutely inacceptable for engineering reasons. In games it might happen as well, when, e.g., a collision handling module finds a pathological geometrical situation, with a singularity so close that math bombs. Then, a possible solution is to output /some/ random value, and not break the game. In other words., accept NaNs and infinities, and do with them what your program requires. YOU take the responsability of raising an
Re: [Haskell-cafe] Re: MonadPrompt + Gtk2Hs = ?
On Jan 14, 2008 8:27 PM, apfelmus [EMAIL PROTECTED] wrote: The type of contPromptM is even more general than that: casePromptOf' :: (r - f b) - (forall a,b. p a - (a - f b) - f b) - Prompt p r - f b casePromptOf' done cont (PromptDone r) = done r casePromptOf' done cont (Prompt p c ) = cont p (casePromptOf' done cont . c) (I guess the forall b inside 'cont' is a typo?) Actually, it can be as general as casePromptOf :: (r - b) - (forall a. p a - (a - b) - b) - Prompt p r - b casePromptOf done cont (PromptDone r) = done r casePromptOf done cont (Prompt p c ) = cont p (casePromptOf done cont . c) =) And, just for the record, runPromptAgain :: Monad m = (forall a. p a - m a) - Prompt p r - m r runPromptAgain f = casePromptOf return ((=) . f) The link to ContT m a = (forall b . (a - m b) - m b) is apparent in the case of casePromptOf' and is no surprise: you can omit p a and Prompt p r entirely and implement them directly as continuations (thereby loosing the ability to use it with different m, which would defeat the whole point here.) See also Implementing the State Monad. http://article.gmane.org/gmane.comp.lang.haskell.cafe/31486 for the details. I've read that e-mail when it was sent but didn't understand it fully. I guess now I'm in a better condition, but I still have a lot to learn about these little warm, fuzzy things. Actually, the more I see, the less I understand why some people are afraid of them... it must really be the name 'monad'. Thanks for all the help guys! Next I'll try to reproduce the freezes I was getting with my first forkIO approach. Cheers, -- Felipe. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Any publication date for The Little Haskeller? [Was: Re: [Haskell-cafe] Computer Science Books using Haskell]
Speaking of computer science books using Haskell, does anybody know when will a Haskell version of The Little Schemer, or anything equivalent, be published? It seems strange that The Little MLer is out, but not The Little Haskeller. Benjamin L. Russell --- PR Stanley [EMAIL PROTECTED] wrote: Hi Can the list recommend books that use Haskell - or any FP language but preferably Haskell - to illustrate the principles of compilers and/or algorithms? I think most of you would understand if I said that I'd prefer FP code instead of funny math symbols that don't translate into ANSI characters with the current OCR technology, unless, of course, you know of a book available in latex code. Rather than rushing straight to Google I thought I'd first draw on the wealth of knowledge that exists on this list. Cheers Paul ___ 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
Any publication date for Structure and Interpretation of Functional Computer Programs? [Was: Re: [Haskell-cafe] Computer Science Books using Haskell]
Alternatively, again speaking of computer science books using Haskell, does anybody know when will a Haskell version of Structure and Interpretation of Computer Programs, or anything of the same scope, be published? It seems strange that Concepts, Techniques, and Models of Computer Programming is out using Mozart/Oz, but apparently nothing of equivalent scope using Haskell. Ideally, the book should cover roughly the same scope of topics as SICP or CTM, but with a declarative (What is?), rather than an imperative (How to?), approach. Benjamin L. Russell --- PR Stanley [EMAIL PROTECTED] wrote: Hi Can the list recommend books that use Haskell - or any FP language but preferably Haskell - to illustrate the principles of compilers and/or algorithms? I think most of you would understand if I said that I'd prefer FP code instead of funny math symbols that don't translate into ANSI characters with the current OCR technology, unless, of course, you know of a book available in latex code. Rather than rushing straight to Google I thought I'd first draw on the wealth of knowledge that exists on this list. Cheers Paul ___ 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
Any publication date for Structure and Interpretation of Functional Computer Programs? [Was: Re: [Haskell-cafe] Computer Science Books using Haskell]
Alternatively, again speaking of computer science books using Haskell, does anybody know when will a Haskell version of Structure and Interpretation of Computer Programs, or anything of the same scope, be published? It seems strange that Concepts, Techniques, and Models of Computer Programming is out using Mozart/Oz, but apparently nothing of equivalent scope using Haskell. Ideally, the book should cover roughly the same scope of topics as SICP or CTM, but with a declarative (What is?), rather than an imperative (How to?), approach. Benjamin L. Russell --- PR Stanley [EMAIL PROTECTED] wrote: Hi Can the list recommend books that use Haskell - or any FP language but preferably Haskell - to illustrate the principles of compilers and/or algorithms? I think most of you would understand if I said that I'd prefer FP code instead of funny math symbols that don't translate into ANSI characters with the current OCR technology, unless, of course, you know of a book available in latex code. Rather than rushing straight to Google I thought I'd first draw on the wealth of knowledge that exists on this list. Cheers Paul ___ 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] Re: \_ - not equivalent to const $
Luke Palmer wrote: In attempting to devise a variant of cycle which did not keep its argument alive (for the purpose of cycle [1::Int..]), I came across this peculiar behavior: import Debug.Trace cycle' :: (a - [b]) - [b] cycle' xs = xs undefined ++ cycle' xs take 20 $ cycle' (const $ 1:2:3:4:trace x 5:[]) [1,2,3,4,x 5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5] Nuts. Oh, but wait: take 20 $ cycle' (\_ - 1:2:3:4:trace x 5:[]) [1,2,3,4,x 5,1,2,3,4,x 5,1,2,3,4,x 5,1,2,3,4,x 5] Hey, it worked! Can someone explain what the heck is going on here? Luke (\_ - 1:2:3:4:trace x 5:[]) literally could mean your second program, but... the 1:2:3:4:trace x 5:[] does not depend on the _ argument, and so it can be lifted outside the (\_ - ... ) and lazily evaluated once and shared between calls. Optimization in ghc do this for you. The definition const x = (\_ - x) binds 'x' outside of the _ argument, so 'x' is obviously outside (\_ - ...) and will be lazily evaluated once and shared. I see that making the binding and sharing explicit in take 20 $ cycle' (let x = 1:2:3:4:trace x 5:[] in (\_ - x)) [1,2,3,4,x 5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5] behaves like const. And pushing the binding inside the (\_ - ...) take 20 $ cycle' (\_ - let x = 1:2:3:4:trace x 5:[] in x) [1,2,3,4,x 5,1,2,3,4,x 5,1,2,3,4,x 5,1,2,3,4,x 5] behaves like your second example. -- Chris ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Why purely in haskell?
[EMAIL PROTECTED] wrote: Your example with the King on the chessboard goes along the doctrine professed by Achim S., forbidding something. But this word, legality, etc. is a juridic term, something not so meaningful in math. OK, you are forbidden to try 0/0. But you DO. So what? You claim that math doesn't say undefined, mathematicians do, etc. Now, does MATH say Hey! there is no sense in what you are doing!? But math as an abstract domain, does it have built-in the notion of sense neither. You say: you are out of system/sense. I say you get no answer. I believe that my standpoint is more operational. I believe it's basically the same point. Legal, btw, is meant along the lines of it is not allowed for an apple to reinterpret gravity and fly into earth's orbit. Natural, not human-made law. -- (c) this sig last receiving data processing entity. Inspect headers for past copyright information. All rights reserved. Unauthorised copying, hiring, renting, public performance and/or broadcasting of this signature prohibited. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] First go at reactive programming
Hi, Listed below is my first experiment with reactive programming. It is a simple web server written using the Data.Reactive[1] library. The intended interface is given by the runHttpServer function, so the remainder is intended to be internal. I'd be happy to hear comments on any parts of this, but am particularly interested in the following: 1. Is this kind of code what is intended from reactive programming? 2a. I'm not sure about passing the (Handle,...) tuple around. Is there a way to avoid this? 2b. I'm not sure of the best place to handle possible socket exceptions 2c. I'd like to be able to pass a function of type Event Request - Event Response to runHttpServer, so that reactive programming could be used throughout client code also, but the (Handle,...) tuples seem to be getting in the way. 3. I have a feeling there's a clearer way to write responseSend. Thanks, Levi [1] http://www.haskell.org/haskellwiki/Reactive module Main where import Control.Applicative import Control.Arrow ((),()) import Control.Concurrent import Control.Monad import Data.Reactive import Network.BSD import Network.HTTP import Network import System.IO import Text.XHtml.Strict type RequestHandler = Request - Response main = runHttpServer helloWorldHandler helloWorldHandler :: RequestHandler helloWorldHandler _ = Response (2,0,0) [] $ prettyHtml helloWorldDoc helloWorldDoc = header thetitle Hello World +++ body h1 Hello World runHttpServer r = socketServer = runE . handleConnection r socketServer :: IO (Event Handle) socketServer = withSocketsDo $ do (e,snk) - mkEventShow Server sock - listenOn (PortNumber 8080) forkIO $ forever $ acceptConnection sock $ snk return e handleConnection :: RequestHandler - Event Handle - Event (IO ()) handleConnection r = handleToRequest runRequestHandler r responseSend handleToRequest :: Event Handle - Event (Handle, IO (Result Request)) handleToRequest e = fmap (id receiveHTTP) e responseSend :: Event (Handle, IO (Result Response)) - Event (IO ()) responseSend e = fmap (\(h,rsp) - rsp = either (putStrLn . show) (respondHTTP h) close h) e runRequestHandler :: RequestHandler - Event (Handle, IO (Result Request)) - Event (Handle, IO (Result Response)) runRequestHandler r e = fmap hrToHr e where rqhdl :: Result Request - Result Response rqhdl rq = bindE rq (Right . r) hrToHr :: (Handle, IO (Result Request)) - (Handle, IO (Result Response)) hrToHr (h,req) = (h, liftA rqhdl req) acceptConnection s k = accept s = \(h,_,_) - forkIO $ k h instance Stream Handle where readLine h = hGetLine h = \l - return $ Right $ l ++ \n readBlock h n = replicateM n (hGetChar h) = return . Right writeBlock h s = mapM_ (hPutChar h) s = return . Right close = hClose ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] fast fractional part of floating point number - modf?
On Tue, Jan 15, 2008 at 07:40:03AM +0100, Henning Thielemann wrote: On Mon, 14 Jan 2008, John Meacham wrote: On Sun, Jan 13, 2008 at 01:08:49AM +0100, Henning Thielemann wrote: Is there a fast and reliable way to compute the fraction of a floating point number? no, and this has bothered me to the point I consider it a bug in the language spec that all 'rounding' style functions give back an integral type. I find returning an Integral is appropriate. The type expresses perfectly what kind of values you can expect. Sure, there should be some optimization rule like fromInteger (round x) = roundf x . it is not that it isn't appropriate, it is that is isn't that useful nor is it equivalent. roundf NaN - NaN fromInteger $ round NaN - error roundf -0 - -0 fromInteger $ round -0 - 0 and how about fromInteger $ ceil (the highest represpentable number in a Double) you go from a 64 bit primitive value to one that takes up a substantial amount of memory when expressed as an Integer and back again. All of these tricky corner cases have been thought out by the IEEE. more importantly, all these things have well defined meanings in IEEE floating point specfications and they cannot be followed in haskell due to the integral constraint. Floating point numbers are odd beasts, we must be careful with them. John -- John Meacham - ⑆repetae.net⑆john⑈ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell and GUI
Hello Torsten, Tuesday, January 15, 2008, 1:09:54 AM, you wrote: Seeing my woes with FranTk - what else is out there that people use if a (simple) GUI is desired for a Haskell app? Just a few textboxes and a button or two would do me. i've read Gtk2Hs tutorial[1] and developed first version of GUI for my program in 1 day [1] http://darcs.haskell.org/gtk2hs/docs/tutorial/Tutorial_Port/index.xhtml -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell and GUI
Hi Torsten, Here is something I use in GTK2HS when teaching beginners: http://hpaste.org/5017 Hope this helps, Yitz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] jumping to code every and anywhere : what about installing tagfile and source ?
Maybe it's better to ask ghc to include location information into the iface files? Then you can get the right file depending on your imports.. Marc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell and GUI
btw, if you use GTK2HS on the Mac, don't forget to start up X Windows support, and run export DISPLAY=:0.0 in your terminal window, before you run your program. X Windows is usually in Applications/Utilities, but only if you installed it manually from the Mac OS X discs, it is not installed by default. Good news - Gtk2 now has native support for the Mac, so you probably won't need to run X starting with the next version of GTK2HS. Regard, Yitz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell and GUI
Hi Torsten, If you really only want a simple GUI - I seem to recall you're on a Mac - you might even be able to get away with the AppleScript bindings: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/AppleScript-0.1.3 There are an example of a simple textfield GUI in the examples directory. Hope this helps, Wouter This message has been checked for viruses but the contents of an attachment may still contain software viruses, which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Haskell and GUI
The advice below is for Mac OS X 10.4 and below. Starting with Mac OS X 10.5 (Leopard) the DISPLAY is set for you by the operating system. Mine is currently /tmp/launch-sQZXQV/:0 which looks very strange because it is used to cause the launchd daemon to start the X server on demand (i.e. lazily). Yitzchak Gale wrote: btw, if you use GTK2HS on the Mac, don't forget to start up X Windows support, and run export DISPLAY=:0.0 in your terminal window, before you run your program. X Windows is usually in Applications/Utilities, but only if you installed it manually from the Mac OS X discs, it is not installed by default. Good news - Gtk2 now has native support for the Mac, so you probably won't need to run X starting with the next version of GTK2HS. Regard, Yitz -- Chris ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] haskelldb basic documentation needed
with the release update haskelldb-0.9 - haskelldb-0.10 several things have changed. Unfortunately the API documentation does not give enough information in generall. Is there any additional uptodate documentation around? In particular the fundamental function connect hast a new signature: *connect* :: (forall m a . MonadIOhttp://hackage.haskell.org/packages/archive/mtl/1.1.0.0/doc/html/Control-Monad-Trans.html#t%3AMonadIOm = [( Stringhttp://hackage.haskell.org/packages/archive/base/3.0.0.0/doc/html/Data-Char.html#t%3AString, Stringhttp://hackage.haskell.org/packages/archive/base/3.0.0.0/doc/html/Data-Char.html#t%3AString)] - (Databasefile:///usr/share/doc/haskelldb-0.10/Database-HaskellDB-Database.html#t%3ADatabase- m a) - m a) I don't know what pairs of strings this function needs. The API description is to unspecific: The connectfile:///usr/share/doc/haskelldb-0.10/Database-HaskellDB-DriverAPI.html#v%3Aconnectfunction takes some driver specific name, value pairs use to setup the database connection, and a database action to run. What are the specific name value pairs needed (for a connection to a mysql db )? Immanuel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell and GUI
If you can get wxHaskell installed working, you could try Phooey and/or TV. Both are described on the Haskell wiki and available via darcs and Hackage. On Jan 14, 2008 2:09 PM, Torsten Otto [EMAIL PROTECTED] wrote: Seeing my woes with FranTk - what else is out there that people use if a (simple) GUI is desired for a Haskell app? Just a few textboxes and a button or two would do me. Thanks in advance! Regards, Torsten ___ 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] haskelldb basic documentation needed
2008/1/15 Immanuel Normann [EMAIL PROTECTED]: I don't know what pairs of strings this function needs. The API description is to unspecific: The connect function takes some driver specific name, value pairs use to setup the database connection, and a database action to run. What are the specific name value pairs needed (for a connection to a mysql db )? Immanuel Your best bet is to download the appropriate drivers - either haskelld-hdbc-mysql or haskelldb-hsql-mysql. If you get the haskelldb sources via darcs, you can also look in the test directory to see how the connections are established. In my specific case, I am using PostgreSQL and by login function looks like this: -- ^ Returns a function which can log into the database and perform operations. login :: MonadIO m = String - Int - String - String - String - (Database - m a) - m a login server port user password dbname = postgresqlConnect [(host, server), (port, show port), (user, user), (password, password), (dbname, dbname)] ___ 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] Re: ANN: A triple of new packages for talking tothe outside world
On Jan 10, 2008 10:45 AM, Don Stewart [EMAIL PROTECTED] wrote: That's pretty much what we envisaged as the approach to take. Monad transformers adding some bit-buffer state over Get/Put. For anyone who's still reading this thread... I've just uploaded[1] binary-strict 0.2.1 which includes Data.Binary.Strict.BitGet - a Get like monad which works by the bit. I'm afraid that Haddock 2 is choaking on {-# UNPACK #-}, so I don't have the HTML documentation to point to. (And I thought that Haddock 2 was going to fix all those parsing issues :( - hopefully I'm just doing something stupid). [1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary-strict-0.2.1 AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org 650-283-9641 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: ANN: A triple of new packages for talking tothe outside world
agl: On Jan 10, 2008 10:45 AM, Don Stewart [EMAIL PROTECTED] wrote: That's pretty much what we envisaged as the approach to take. Monad transformers adding some bit-buffer state over Get/Put. For anyone who's still reading this thread... I've just uploaded[1] binary-strict 0.2.1 which includes Data.Binary.Strict.BitGet - a Get like monad which works by the bit. I'm afraid that Haddock 2 is choaking on {-# UNPACK #-}, so I don't have the HTML documentation to point to. (And I thought that Haddock 2 was going to fix all those parsing issues :( - hopefully I'm just doing something stupid). [1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary-strict-0.2.1 Ok. That's awesome. I guess if you do all the TODOs for Binary like this, we should merge the code back in :) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: ANN: A triple of new packages for talking tothe outside world
On Jan 15, 2008 3:26 PM, Don Stewart [EMAIL PROTECTED] wrote: Ok. That's awesome. I guess if you do all the TODOs for Binary like this, we should merge the code back in :) Well, at the moment I'm pretty unhappy with the amount of code duplication required both within binary-strict and between binary and binary-strict. I think this code needs a whole lot of restructuring (maybe a bit of TH for generating the common bits). I'll get to that when it appears that the API seems reasonable. AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org 650-283-9641 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: ANN: A triple of new packages for talking tothe outside world
Hi (maybe a bit of TH for generating the common bits) That would be bad. Then you'll have gone from Data.Binary being portable code, to being GHC specific code, and I will cry :'-( CPP is a good way to common stuff up in a portable way - I've used it in FilePath. There is nearly no end to the amount of crazy CPP hackery you can use to refactor stuff. Thanks Neil ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ErrorT and catchError question
Ups, resend, first response did not make into the list. On Jan 14, 2008, at 9:33 PM, Brandon S. Allbery KF8NH wrote: On Jan 15, 2008, at 0:28 , Adam Smyczek wrote: It's probably a trivial question, but I cannot figure out how to implement the catchError function in: instance MonadError String Shell where throwError = error . (Shell failed: ++) catchError l h = ??? Take a look at Control.Exception.catch for starters. No, did not help and going over the source code of Control.Monad.Error did not help as well. Does someone have other tips for me? Thanks, Adam -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED] system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED] electrical and computer engineering, carnegie mellon university KF8NH ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Why purely in haskell?
Yes, this is a doctrinal problem. Since *any* concrete reaction, e.g., an error message is a kind of answer, the only - unusable as it is - way of not providing it is to fail the termination... You can just disallow the call, using the type system. Not that it's always easy or practical either, mind you. Stefan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: ANN: A triple of new packages for talking tothe outside world
On Jan 15, 2008 5:01 PM, Neil Mitchell [EMAIL PROTECTED] wrote: That would be bad. Then you'll have gone from Data.Binary being portable code, to being GHC specific code, and I will cry :'-( Ok, no TH ;) AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org 650-283-9641 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ErrorT and catchError question
On Jan 15, 2008, at 22:05 , Adam Smyczek wrote: Ups, resend, first response did not make into the list. On Jan 14, 2008, at 9:33 PM, Brandon S. Allbery KF8NH wrote: On Jan 15, 2008, at 0:28 , Adam Smyczek wrote: It's probably a trivial question, but I cannot figure out how to implement the catchError function in: instance MonadError String Shell where throwError = error . (Shell failed: ++) catchError l h = ??? Take a look at Control.Exception.catch for starters. No, did not help and going over the source code of Control.Monad.Error did not help as well. Does someone have other tips for me? Perhaps you could explain what you're looking for? Your typeclass doesn't tell us anything about the semantics. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED] system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED] electrical and computer engineering, carnegie mellon universityKF8NH ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ErrorT and catchError question
On Jan 15, 2008, at 7:34 PM, Brandon S. Allbery KF8NH wrote: On Jan 15, 2008, at 22:05 , Adam Smyczek wrote: Ups, resend, first response did not make into the list. On Jan 14, 2008, at 9:33 PM, Brandon S. Allbery KF8NH wrote: On Jan 15, 2008, at 0:28 , Adam Smyczek wrote: It's probably a trivial question, but I cannot figure out how to implement the catchError function in: instance MonadError String Shell where throwError = error . (Shell failed: ++) catchError l h = ??? Take a look at Control.Exception.catch for starters. No, did not help and going over the source code of Control.Monad.Error did not help as well. Does someone have other tips for me? Perhaps you could explain what you're looking for? Your typeclass doesn't tell us anything about the semantics. The type declaration: newtype Loader a = Loader { load :: ErrorT String IO a } deriving (Functor, Monad, MonadIO) instance MonadError String Loader where throwError = error . (Error: ++) l `catchError` h = ??? how do I implement this ??? -- Example usage data Attribute = Attribute { a_name :: Name, a_value :: Value } deriving Show -- Find a required attribute by name and throw an -- exception it if does not exist findRequired :: Name - [Attribute] - Loader Attribute findRequired n as = case find (\a - a_name a == n) as of Just a - return a Nothing - throwError $ Missing required ' ++ n ++ ' attribute! -- I would like to use catchException for -- findOptional and provide default value -- if findRequired fails findOptional :: Name - [Attribute] - Value - Loader Attribute findOptional n as defaultValue = catchError (findRequired n as) (\_ - return $ Attribute n defaultValue) As you probably can see on this code, I'm a haskell newbie and open for all tips how to improve this code. Thanks, Adam -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED] system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED] electrical and computer engineering, carnegie mellon university KF8NH ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ErrorT and catchError question
On 15 Jan 2008, at 7:54 PM, Adam Smyczek wrote: On Jan 15, 2008, at 7:34 PM, Brandon S. Allbery KF8NH wrote: On Jan 15, 2008, at 22:05 , Adam Smyczek wrote: Ups, resend, first response did not make into the list. On Jan 14, 2008, at 9:33 PM, Brandon S. Allbery KF8NH wrote: On Jan 15, 2008, at 0:28 , Adam Smyczek wrote: It's probably a trivial question, but I cannot figure out how to implement the catchError function in: instance MonadError String Shell where throwError = error . (Shell failed: ++) catchError l h = ??? Take a look at Control.Exception.catch for starters. No, did not help and going over the source code of Control.Monad.Error did not help as well. Does someone have other tips for me? Perhaps you could explain what you're looking for? Your typeclass doesn't tell us anything about the semantics. The type declaration: newtype Loader a = Loader { load :: ErrorT String IO a } deriving (Functor, Monad, MonadIO) instance MonadError String Loader where throwError = error . (Error: ++) I don't think this is what you want; you're throwing away the benefit of using ErrorT. You probably want throwError = Loader . throwError l `catchError` h = ??? how do I implement this ??? l `catchError` h = Loader (load l `catchError` load . h) jcc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: GLFW-0.3 released
GLFW is a Haskell module for GLFW OpenGL framework. It provides an alternative to GLUT for OpenGL based Haskell programs. The current 0.3 version is for download from hackageDB at: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/GLFW-0.3 Same as the previous 0.2 version it requires Cabal 1.2 or later for installation (which comes as default in GHC 6.8 or later). The installation is now conforming to the standard Cabal steps. New addition is the Haddock documentation for all interface functions. There is also a sample program to demonstrate its usage on the Haskell wiki site for GLFW: http://haskell.org/haskellwiki/GLFW Any feedbacks is welcome! I've only tested it on a limited number of platforms + GHC combinations, so if you have installation issue, please let me know. Thank you! -- Regards, Paul Liu Yale Haskell Group http://www.haskell.org/yale ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ErrorT and catchError question
On Jan 15, 2008, at 8:07 PM, Jonathan Cast wrote: On 15 Jan 2008, at 7:54 PM, Adam Smyczek wrote: On Jan 15, 2008, at 7:34 PM, Brandon S. Allbery KF8NH wrote: On Jan 15, 2008, at 22:05 , Adam Smyczek wrote: Ups, resend, first response did not make into the list. On Jan 14, 2008, at 9:33 PM, Brandon S. Allbery KF8NH wrote: On Jan 15, 2008, at 0:28 , Adam Smyczek wrote: It's probably a trivial question, but I cannot figure out how to implement the catchError function in: instance MonadError String Shell where throwError = error . (Shell failed: ++) catchError l h = ??? Take a look at Control.Exception.catch for starters. No, did not help and going over the source code of Control.Monad.Error did not help as well. Does someone have other tips for me? Perhaps you could explain what you're looking for? Your typeclass doesn't tell us anything about the semantics. The type declaration: newtype Loader a = Loader { load :: ErrorT String IO a } deriving (Functor, Monad, MonadIO) instance MonadError String Loader where throwError = error . (Error: ++) I don't think this is what you want; you're throwing away the benefit of using ErrorT. You probably want throwError = Loader . throwError l `catchError` h = ??? how do I implement this ??? l `catchError` h = Loader (load l `catchError` load . h) Thanks Jonathan, this is exactly what I was looking for and I got the concept of ErrorT now, I think. jcc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] High-readibility version of CONS should not evaluate its arguments?
While reading the paper A History of Haskell: Being Lazy With Class (Paul Hudak, John Hughes, Simon Peyton Jones, Philip Wadler: The Third ACM SIGPLAN History of Programming Languages Conference (HOPL-III) San Diego, California, June 9-10, 2007) (http://research.microsoft.com/~simonpj/papers/history-of-haskell/history.pdf), I came across a reference (in Part I, Section 2.1: The Call of Laziness) to the paper CONS should not evaluate its arguments (D. P. Friedman and D. S. Wise, in Automata, Languages, and Programming, S. Michaelson and R. Milner, Eds. Edinburgh: Edinburgh University Press, 1976, pp. 257-284), and looked for a highly readable version. However, all I could come across was Technical Report TR44 at the Indiana Department of Computer Science, at http://www.cs.indiana.edu/cgi-bin/techreports/TRNNN.cgi?trnum=TR44. This version appears as small, light typewritten type on horizontally placed double pages, and is very hard to read. Does anybody know where I can find a version of this paper with higher readability? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Yi editor tutorial
Your Yi editor tutorial looks like a fascinating idea, but I use Mac OS X (10.2.8 Jaguar, soon to be upgraded to 10.5.x Leopard) at home, and Windows XP at work, while your tutorial is based on Ubuntu and the bash shell. A few questions: 1) Do you have any versions of your Yi tutorial for Mac OS X or Windows XP; if not, are there any plans for such tutorials in the future? 2) On your tutorial top page (http://nobugs.org/developer/yi/), you mentioned that you had first learned Haskell in 2001 from _The Haskell School of Expression_ by Paul Hudak. I also tried studying that book, and found it very interesting (especially with its focus on multimedia examples), but unfortunately got stuck on an exercise in Chapter 2 that required trigonometry, which I had forgotten from lack of use and didn't have time to review. Also, I wanted to study it online, and had purchased the book (and thus paid the licensing fee), but was unable to find an online version. Do you have any suggestions for online books with the same flavor that require less domain-specific knowledge; alternatively, do you have any suggestions for online material that precisely covers the domain-specific knowledge assumed by that book? Benjamin L. Russell --- Andrew Birkett [EMAIL PROTECTED] wrote: Hi, I've recently started using Yi, the haskell editor. I found it slightly non-trivial to get started, so I've written up my installation method and a beginners guide tutorial which I hope will be of interest to other people who'd like to try Yi. It lives at: http://nobugs.org/developer/yi/ Let me know if it's useful or if you have suggestions (to [EMAIL PROTECTED]) Andrew -- - http://www.nobugs.org - ___ 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] research topics
Hi haskellers! I am a postgraduate student interested in functional programming and Haskell. I would appreciate if someone could elaborate on which are the current hot topics of research in this area, and related to Haskell, of course. In particular, I am interested in compiler implementation. Thanks in advance. -- Henrique Ferreiro [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] hmp3 1.4: ncurses mp3 player in Haskell
4 years after its original release, and with almost daily use, I'm pleased to announce a new release of hmp3, the Haskell mp3 player. The goal of this project was a more stable, resize-friendly mp3 player for the console, that didn't compromise on efficiency or the user interface. This release, version 1.4, introduces pcre support for searching for tracks and albums, and improves support for ghc 6.8. Install: $ cabal install hmp3 Hackage: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hmp3 Homepage: http://www.cse.unsw.edu.au/~dons/hmp3.html Repos: http://code.haskell.org/~dons/code/hmp3 Cheers, Don --- Take direct action against bad code: program Haskell! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe