Re[2]: [Haskell-cafe] Low Level Audio - Writing bytes to the sound card?
Hello Andrew, Sunday, December 6, 2009, 1:09:18 AM, you wrote: Maybe once I get hired by some financial modelling consultants and get paid shedloads of money to write Haskell all day, I'll be able to afford a Mac. But until then... with such attitude you will never be hired by financial sector. try instead: mac? great! windows? i love it! unix? i've used it since 60's -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: universal binary version of Haskell Platform?
Benjamin L.Russell wrote: Ah, that's too bad. That means that I won't be able to invoke GHC outside of the Terminal application by default, and that even if I create a Darwin shell script and alias to invoke it from Aqua, the icon for that shell script will only be generic by default. I'd rather click on an application icon in the Dock. You can write an applescript similar to Open Terminal Here from http://www.entropy.ch/software/applescript/ and endow it with a custom icon. Regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Low Level Audio - Writing bytes to the sound card?
Bulat Ziganshin wrote: Hello Andrew, Sunday, December 6, 2009, 1:09:18 AM, you wrote: Maybe once I get hired by some financial modelling consultants and get paid shedloads of money to write Haskell all day, I'll be able to afford a Mac. But until then... with such attitude you will never be hired by financial sector. try instead: mac? great! windows? i love it! unix? i've used it since 60's That's OK. I'm reasonably sure I will never get hired by the financial sector /anyway/. :-( ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] binding to C libraries on Windows was Low Level Audio - Writing bytes to the sound card?
john lask wrote: I think there are some misapprehensions here:- Many haskell packages binding to c libraries will compile with ghc without problems on windows - without cygwin, without mingw/msys system. OK, well I haven't tried building every C binding on all of Hackage, just a few of them. So far none of them have worked. (Including wxHaskell, SDL, one of the database packages, etc.) It's got to the point where I've simply given up trying. Most such packages just don't seem to work on Windows, and nobody on the mailing lists or on IRC has any clue why. (I guess because few people in the Haskell community use Windows and understand how it's supposed to work.) Some such packages build out of the box on windows, like the zlib package which contains the c source for the c zlib library. GHC is able to compile and build this packages without any other c compiler/libraries/unix emulators etc because ghc itself contains part of the gcc c compiler tool chain and comes with all c standard headers, c++ headers and c/c++ runtime libraries. Yes, I realised long ago that GHC uses GCC and other GNU build tools. (Presumably this makes porting to Windows far easier.) More recently I realised that it also includes a surprisingly large set of header files, seemingly including the entire Win32 API, which is interesting. There is only one gotch-ya - you need to have a import library for the gcc tool chain (thats what ghc uses) i.e. a .a library and not the native windows .LIB import library. They're different?? o_O Oh. Suddenly several things seem clearer... If you don't have .a import library but have the dll then the '.a' import library be built for any dll relativley easily. Any idea how? the bigest problem hamperring cleaner builds of haskell packages on windows is the lack of any standardised scheme for the installation of c-libraries and header files (and of course the availability of a suitable build of the library). Isn't one of Cabal's jobs to figure out where stuff is? Can't we get Cabal on Windows to say hey, I need to find foo.h, you know where that is? Or something like that? Another problem hampering the install of haskell packages on windows is the use of the unix autoconf build system (./configure) - package writters note! Heh. I found one Wiki page once describing how to set up a Cabal package. When it started talking about how to integrate Automake, I hung my head is dispair. (I believe the page in question is fixed now. But a lot of package authors seem to assume that everybody just uses Unix of some kind...) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: binding to C libraries on Windoww
Stephen Tetley wrote: Hi John Fair points - but aren't you always going to 'need' at least MinGW? (for some degree of 'need' of course, I use it quite a bit though prefer Cygwin, I suppose Andrew C. would care not to use either). I guess there's a difference in culture here. On Unix, it is usual to distribute programs as source, and build from source. (I guess in part because each one of the 12,657,234 different Unix variants is slightly different, and the program needs to work differently.) On Windows, it is usual to distribute everything as compiled binaries. (Indeed, for most commercial software, the sources simply aren't available at all.) And users get a binary program and binary DLLs or whatever. Developers get a binary DLL and whatever header files or import libraries are necessary to use it. GHC brings with it gcc and ld, ar ... but not much else. If I'm understanding this correctly, John is saying that GCC requires a different form of import library before you can access a DLL. For binary-only DLLs, this presumably won't be available. Hence the (abnormal) requirement to build the whole library from source, rather than just drop in a DLL and be done with it. Unix *expects* you to build everything from source, and so there are standard toolchains which are almost always available, and standard installation locations and so on and so forth. Windows does *not* expect you to be building things from source, and so is less-well set up in that regard. I don't suppose there's any danger of GHC ever switching to a native Win32 toolchain? (I don't actually know if one even exists with a sufficiently liberal license...) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What is the rank of a polymorphic type?
Apologies for the double-reply... Your mail prompted me to finally get around to adding a mono/polytype system to an interpreter I've been working on for pure type systems, to see what a GHC-alike type system would look like. Here's what I came up with. Constants are: *m, []m, *p and []p Axioms are: *m : []m, *p : []p Rules go as follows: (*m,*m,*m) This is obvious, because it allows normal functions. ([]m,[]m,[]m) This gives arbitrary order type constructors (that is, it expands the m-kinds to km ::= *m | km - km) ([]m,*m,*p) ([]m,*p,*p) These allows quantification over types. Note that if you erase the mono/poly distinctions, you get the single rule ([],*,*), which is the impredicative rule for the lambda cube. However, this system tracks a distinction, so it remains predicative (universal quantifiers don't range over types that contain universal quantifiers). With just these rules, I think we accept just the types valid in ordinary Haskell. We have higher order types, but we can only have polytypes in prenex normal form, because quantification sticks a type into *p, and the only thing we can do with a *p is add more quantifiers (over []m) to the beginning.r To get rank-n types back, we need to be able to write functions that accept and return polytypes as arguments. This corresponds to the rules: (*m,*p,*p) (*p,*m,*p) (*p,*p,*p) Note that []p never appears in our rules; it exists only to give *p a type (which may not strictly be necessary, even, but it doesn't hurt). Data types would have kinds like: Maybe : *m - *m and so types like Maybe (forall a. a - a) would be invalid, because it's trying to use the type constructor with a *p. This type system is a bit stricter than the one GHC uses for rank-n types, as if you have: id : forall a : *m. a - a You cannot instantiate a to forall a. a - a, because it has kind *p. GHC allows that sort of impredicative instantiation with just rank-n types turned on. As alluded to earlier, one can recover an ordinary impredicative F_w by erasing the mono/poly distinctions. The rules collapse to: (*,*,*) ([],*,*) ([],[],[]) If anyone's interested in playing with the checker, it can be found at http://code.haskell.org/~dolio/ in the pts repository (I'll try to get a little documentation for the REPL uploaded). And let me know if you find something that types but shouldn't, or some such nonsense. Cheers, -- Dan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: binding to C libraries on Windoww
Hi Andrew 2009/12/6 Andrew Coppin andrewcop...@btinternet.com: On Windows, it is usual to distribute everything as compiled binaries. (Indeed, for most commercial software, the sources simply aren't available at all.) And users get a binary program and binary DLLs or whatever. Developers get a binary DLL and whatever header files or import libraries are necessary to use it. Indeed, but the Haskell libraries you want to use are in source form, no? Being a Haskell developer you're at least one step out of the usual, and most of the libraries are coming from developers on Unix so they can't be expected to package things for Windows. If I'm understanding this correctly, John is saying that GCC requires a different form of import library before you can access a DLL. For binary-only DLLs, this presumably won't be available. Hence the (abnormal) requirement to build the whole library from source, rather than just drop in a DLL and be done with it. John mentioned pexports in another message. I'd never come across it before - it would seem to improve the situation significantly, certainly for libraries that are more easily compilable with MSVCC like PortAudio, Shiva OpenVG, or where you have a reasonable DLL distributed like SDL. Best wishes Stephen ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: binding to C libraries on Windoww
I guess there's a difference in culture here. On Unix, it is usual to distribute programs as source, and build from source. I see more than a cultural issue here. Suppose you write bindings to somelib-1.0.2, and release it with somelib-1.0.2. Then, somelib-1.0.3 is released to solve a serious security issue with 1.0.2. Linux or unix distributions will update their repositories, but users of your bindings will blindly keep using 1.0.2. Best, Maurício ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Optimizing Parsec 3 -- was: Wiki software?
On Fri, Dec 4, 2009 at 7:47 PM, Paulo Tanimoto tanim...@arizona.edu wrote: Great! Antoine, other tests we should do? Derek, I apologize if you're already following this, but can you give us your opinion? Paulo Well, the more eyes and test cases we can get on the new code the better. I'd also like to encourage anyone who's familiar with the idea of how parsec works to take a look at my changes to make sure they're comprehensible. Antoine ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: Re[2]: [Haskell-cafe] HP + Gtk2hs?
Hi Andrew, On 5 Dec 2009, at 16:15, Bulat Ziganshin wrote: Saturday, December 5, 2009, 6:40:23 PM, you wrote: Gtk2hs is currently the *only* GUI binding that actually works on Windows. i thought that wx and even qt are in rather good shape now Thanks for the vote, Bulat. wxHaskell installs out of the box easily on Windows now. See http:// haskell.org/haskellwiki/WxHaskell/Building. The hardest part is building wxWidgets itself. Prerequisites are: - MinGW C++ compiler Make, with MSys shell (to build wxWidgets) - wx-config binary for Windows To build wxWidgets, download the Windows source package from wxWidgets. 1) You will need the Windows port of wx-config in your path. This can be downloaded from http://wxconfig.googlepages.com/ 2) You will need to compile wxWidgets using MSys. We have tested against MinGW 5.1.6 with g++ compiler, MinGW Make, MSYS-1.0.11, wxMSW-2.8.10, which are the latest versions, and can be downloaded from their respective websites. I used a completely clean install of the latest Haskell Platform to validate the procedure. Please note: all commands to be entered in an MSys shell. cd /c/path/to/wxWidgets-2.8.10/build/msw mingw32-make -f makefile.gcc BUILD=release MONOLITHIC=1 SHARED=1 UNICODE=1 set PATH=$PATH:/c/path/to/wx-config set WXWIN=/c/path/to/wxWidgets-2.8.10 set WXCFG=gcc_dll/mswu At this point you have installed and configured wxWidgets on Windows. The Haskell part is more or less trivial: cabal install wx I'd encourage you to try wxHaskell again, and let us know how you get on. Regards Jeremy -- Jeremy O'Donoghue jeremy.odonog...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: [Haskell] ANN: readline-statevar-1.0.1.0
nerds ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: [Haskell] ANN: readline-statevar-1.0.1.0
Jochem Berndsen wrote: nerds This was a friend of mine trying to be funny. Apologies, Jochem -- Jochem Berndsen | joc...@functor.nl | joc...@牛在田里.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell-Newbie and Char-Function
On Sat, Dec 5, 2009 at 10:02 PM, ??? ?? m...@rkit.pp.ru wrote: fct a n = (snd $ break (==a) ['a'..'z']) !! n Not bad but you forgot that it might need to wrap around, besides break isn't really the best function to use here since we don't need the first part of the pair : shift n ch = dropWhile (/=ch) (cycle ['a'..'z']) !! n Still I think the ord and mod version will be faster. -- Jedaï ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: binding to C libraries on Windoww
Andrew Coppin andrewcop...@btinternet.com writes: I guess there's a difference in culture here. On Unix, it is usual to distribute programs as source, and build from source. (I guess in part because each one of the 12,657,234 different Unix variants is slightly different, and the program needs to work differently.) On Windows, it is usual to distribute everything as compiled binaries. I think the real cultural difference is that you aren't a user, you're a prospective Haskell developer, as others have said. Developers pretty much have to install tools (like compilers and preprocessors) and have to work with source code. Traditionally, Unix *comes with* thousands of tools that are useful to developers. Windows traditionally came with none, at least none that I was ever able to find. Since many of the traditional Unix tools are available free, it makes sense that somebody would want to port them to Windows *for doing development*. It's not so much a Unix emulation as a solution to the lack of native Windows tools. Of course this makes sense especially to somebody who has gotten used to the Unix tools (such as myself). I would never try to *develop* seriously under Windows using just what comes preinstalled. Users of Unix (not developers) are just as used to getting compiled binaries as users of Windows. A good example of this in today's world is Mac OS X (or the iPhone, which is a small Unix system in essence). In earlier times, I assure you that users of Solaris (say) didn't expect to get a source release of Oracle and compile it up from scratch. There were indeed a few different supported versions of Solaris (different releases and hardware platforms), but this was Sun's and/or Oracle's problem. The open source movement has complicated this picture (mostly for the good, from the user's standpoint), but this just makes more people into developers in essence. This is the price you pay for getting stuff for free. It seems to me it doesn't make a lot of sense to complain about this. If you don't want to be a developer you can usually find something to buy that will be precompiled for you, or you can hire somebody. This is not to say that on a given day it isn't frustrating when you can't get something to compile, especially if it's just a tool you need to compile something else. But this is why developers are so wealthy, they have the fortitude to work through these problems. (Ha ha.) Regards, Jeff Scofield Seattle ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: error-message
On Sat, Dec 05, 2009 at 02:13:10PM -0800, Gregory Crosswhite wrote: The problem comes from the fact that = takes a *function* as its second argument, and so if the first argument is an error then we can't evaluate the second argument in order to see if it has an error as well. Hmm, that's true. I guess I misspoke about liftM2 (+) being able to collect both error messages. instance Functor E where fmap _ (E (Left error)) = E (Left error) fmap f (E (Right argument)) = E (Right (f argument)) instance Applicative E where pure = E . Right (*) (E (Left error2)) (E (Left error1)) = E (Left (error1 ++ error2)) (*) (E (Left error)) _ = E (Left error) (*) _ (E (Left error)) = E (Left error) (*) (E (Right function)) (E (Right argument)) = E (Right (function argument)) OK, this looks like a perfectly valid Applicative instance for E (it satisfies the Applicative laws). So what we have here, it seems, is a type with at least two reasonable Applicative instances, one of which does *not* correspond to a Monad instance. My argument is that it is very strange (I might even go so far as to call it a bug) to have a type with an Applicative instance and a Monad instance which do not correspond, in the sense that pure = return (*) = ap although I certainly understand the motivation in this case. Hmm, I'll have to think about this a bit more. The Monad instance which tries passing undefined to the right-hand side of = if the left-hand side is an error is strangely compelling, if semantically unsound... -Brent ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Re: ANNOUNCE: Blueprint 0.1 -- PREVIEW
Gregory Crosswhite wrote: On Dec 4, 2009, at 11:02 AM, Ben Franksen wrote: Gregory Crosswhite wrote: I have posted Blueprint to Hackage so that people can see what I have done and possibly play with it. Very interesting, this. However, I could not build it. I get [...] At the moment you need to execute the setup script manually: runhaskell Setup.hs bootstrap ./Setup configure ./Setup build +RTS -N4 -RTS ./Setup install (The +RTS -N4 -RTS part is optional; it just tells Setup to use up to 4 threads to do building in parallel where possible.) Thanks. I recommend adding a small readme.txt explaining stuff like that. Anyway, thank you for checking out Blueprint! At this point it might be better to pull the sources directly from github (the Home Page link) Will do. since I have made many improvements since that release (though I haven't fixed the cabal install problem yet). And I do plan on thoroughly polishing and documenting Blueprint one of these days. :-) Thanks Cheers Ben ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] diff implementation in haskell
Are there pure haskell implementations of diff and diff3 algorithms. Like: data Diff a = Deleted [a] | Common [a] | Added [a] diff :: Eq a = [a] - [a] - [Diff a] diff3 :: Eq a = [a] - [a] - [a] - [a] or smth more general like: class Diff a where type Difference a diff :: a - a - Difference a patch :: a - Difference a - a prop_diffpatch a b = patch a (diff a b) == b ? If not, where can I start towards the implementation? What's the way to do it more functionally? -- Victor Nazarov ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] diff implementation in haskell
asviraspossible: Are there pure haskell implementations of diff and diff3 algorithms. Like: data Diff a = Deleted [a] | Common [a] | Added [a] diff :: Eq a = [a] - [a] - [Diff a] diff3 :: Eq a = [a] - [a] - [a] - [a] There's at least one on Hackage: http://hackage.haskell.org/package/Diff -- Donn ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Do you need Windows USB in Haskell?
Hi Mauricio, 2009/12/5 Maurício CA mauricio.antu...@gmail.com: Problem is: I don't have a Windows machine where I could test this. So, if you need USB in windows, please keep in touch. I wouldn't ask you to write any code, but I need to know what builds and what doesn't. I don't need usb and I can't say I'm a windows user, but I'd be glad to test it since I have it on a virtual machine. In my case, installation fails on bindings-common. Is there something I need to do first? I do have mingw32 and msys installed, if that's necessary. Log attached. Take care, Paulo c:\tools\haskell-platform\2009.2.0.2\bin\ghc.exe --numeric-version looking for package tool: ghc-pkg near compiler in c:\tools\haskell-platform\2009.2.0.2\bin found package tool in c:\tools\haskell-platform\2009.2.0.2\bin\ghc-pkg.exe c:\tools\haskell-platform\2009.2.0.2\bin\ghc-pkg.exe --version c:\tools\haskell-platform\2009.2.0.2\bin\ghc.exe --supported-languages Reading installed packages... c:\tools\haskell-platform\2009.2.0.2\bin\ghc-pkg.exe dump --global Reading available packages... Resolving dependencies... selecting usb-0.2.0.1 (hackage) and discarding bindings-libusb-0.0.1, 0.0.2, 0.0.3, 0.0.4, 0.0.5, 0.0.6, 0.0.7, 1.0, 1.1, 1.2, 1.4, text-0.1, 0.2, 0.3, 0.4, usb-0.1, 0.1.0.1 and 0.2 selecting bindings-libusb-1.3 (hackage) and discarding bindings-common-0.1, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.2, 0.2.1, 0.2.2, 0.2.3, 0.2.4, 0.2.5, 0.2.6, 1.0, 1.1, 1.2, bindings-posix-0.0.1, 0.0.2, 1.0, 1.0.1 and 1.1 selecting bindings-posix-1.2 (hackage) selecting text-0.5 (installed or hackage) selecting ghc-prim-0.1.0.0 (installed) selecting rts-1.0 (installed) selecting bytestring-0.9.1.4 (installed or hackage) and discarding bytestring-0.9, 0.9.0.1, 0.9.0.2, 0.9.0.3, 0.9.0.4, 0.9.1.0, 0.9.1.1, 0.9.1.2, 0.9.1.3 and 0.9.1.5 selecting bindings-common-1.3.4 (hackage) and discarding bindings-common-1.3, 1.3.1, 1.3.2 and 1.3.3 selecting base-3.0.3.1 (installed) and 4.1.0.0 (installed) and discarding syb-0.1.0.0 and 0.1.0.1 selecting integer-0.1.0.1 (installed) selecting syb-0.1.0.1 (installed) In order, the following would be installed: bindings-common-1.3.4 (new package) bindings-posix-1.2 (new package) bindings-libusb-1.3 (new package) usb-0.2.0.1 (new package) bindings-common-1.3.4 has already been downloaded. Extracting C:\Documents and Settings\tanimoto\Application Data\cabal\packages\hackage.haskell.org\bindings-common\1.3.4\bindings-common-1.3.4.tar.gz to C:\DOCUME~1\tanimoto\LOCALS~1\Temp\bindings-common-1.3.43288... Configuring bindings-common-1.3.4... Dependency base =3 5 ==3.0.3.1: using base-3.0.3.1 Using Cabal-1.6.0.3 compiled by ghc-6.10 Using compiler: ghc-6.10.4 Using install prefix: C:\Program Files\Haskell Binaries installed in: C:\Program Files\Haskell\bin Libraries installed in: C:\Program Files\Haskell\bindings-common-1.3.4\ghc-6.10.4 Private binaries installed in: C:\Program Files\Haskell\bindings-common-1.3.4 Data files installed in: C:\Program Files\Haskell\bindings-common-1.3.4 Documentation installed in: C:\Program Files\Haskell\doc\bindings-common-1.3.4 Using alex version 2.3.1 found on system at: c:\tools\haskell-platform\2009.2.0.2\extralibs\bin\alex.exe Using ar found on system at: c:\MinGW\bin\ar.exe No c2hs found No cpphs found No ffihugs found Using gcc version 3.4.5 found on system at: c:\tools\haskell-platform\2009.2.0.2\gcc.exe Using ghc version 6.10.4 found on system at: c:\tools\haskell-platform\2009.2.0.2\bin\ghc.exe Using ghc-pkg version 6.10.4 found on system at: c:\tools\haskell-platform\2009.2.0.2\bin\ghc-pkg.exe No greencard found Using haddock version 2.4.2 found on system at: c:\tools\haskell-platform\2009.2.0.2\bin\haddock.exe Using happy version 1.18.4 found on system at: c:\tools\haskell-platform\2009.2.0.2\extralibs\bin\happy.exe No hmake found Using hsc2hs version 0.67 found on system at: c:\tools\haskell-platform\2009.2.0.2\bin\hsc2hs.exe No hscolour found No hugs found No jhc found Using ld found on system at: c:\tools\haskell-platform\2009.2.0.2\gcc-lib\ld.exe No nhc98 found Using pkg-config version 0.23 found on system at: c:\tools\gtk2hs\0.10.1\bin\pkg-config.exe Using ranlib found on system at: c:\MinGW\bin\ranlib.exe Using strip found on system at: c:\MinGW\bin\strip.exe Using tar found on system at: C:\msys\1.0\bin\tar.exe c:\tools\haskell-platform\2009.2.0.2\gcc.exe -Bc:\tools\haskell-platform\2009.2.0.2\gcc-lib -Ic:\tools\haskell-platform\2009.2.0.2\include\mingw C:\DOCUME~1\tanimoto\LOCALS~1\Temp\3288.c -o C:\DOCUME~1\tanimoto\LOCALS~1\Temp\3288 -Bc:\tools\haskell-platform\2009.2.0.2\gcc-lib -Ic:\tools\haskell-platform\2009.2.0.2\include\mingw -D__GLASGOW_HASKELL__=610 -Isrc -I. -D_ISOC99_SOURCE -Ic:\tools\haskell-platform\2009.2.0.2\base-4.1.0.0\include -Ic:\tools\haskell-platform\2009.2.0.2/include Creating dist\build (and its parents) Creating dist\build\autogen (and its parents) Preprocessing library bindings-common-1.3.4... Creating dist\build\Bindings\C (and its parents)
[Haskell-cafe] Insert a laziness break into strict ST
I have lot of ST actions that shall be bound strictly (they write to a buffer), but somewhere between these actions I like to have a laziness break. I thought I could do this by temporarily switching to Lazy.ST, but this does not work. It follows a simplified example Prelude :module Control.Monad.ST.Lazy Prelude Control.Monad.ST.Lazy runST (Monad.liftM2 (,) (return 'a') (undefined::Monad m = m Char)) ('a',*** Exception: Prelude.undefined Prelude Control.Monad.ST.Lazy Control.Monad.ST.runST (lazyToStrictST $ Monad.liftM2 (,) (return 'a') (undefined::Monad m = m Char)) *** Exception: Prelude.undefined I hoped to get the first answer also for the second command. It seems that conversion from lazy to strict ST also removes laziness breaks. It seems that I have to stick to unsafeInterleaveIO, but I like to know, why the above method does not work. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: error-message
On Sun, Dec 06, 2009 at 03:50:55PM -0500, Brent Yorgey wrote: So what we have here, it seems, is a type with at least two reasonable Applicative instances, one of which does *not* correspond to a Monad instance. My argument is that it is very strange (I might even go so far as to call it a bug) to have a type with an Applicative instance and a Monad instance which do not correspond, in the sense that pure = return (*) = ap There are several of these. Another is the possible Applicative instance for lists with pure = repeat (*) = zipWith id In these cases we usually make the Applicative instance match the Monad one and define an equivalent type for each other Applicative instance (e.g. ZipList in Control.Applicative). ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE: PortAudio Windows Tutorial and Binaries
I got a lot of great help this weekend from Haskell-Cafe, thanks. Now that I have portaudio up and running I put up a tutorial and a 103 kb download of all the windows binaries and files. I hope this helps people exploring digital audio with Haskell. http://www.subreddits.org/misc/haskell/portaudio.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: [Haskell] ANN: readline-statevar-1.0.1.0
2009/12/7 Jochem Berndsen joc...@functor.nl: Jochem Berndsen wrote: nerds This was a friend of mine trying to be funny. You allow your friends (and what kind of a friend does this anyway) access to your email? -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com Ogden Nash - The trouble with a kitten is that when it grows up, it's always a cat. - http://www.brainyquote.com/quotes/authors/o/ogden_nash.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: [Haskell] ANN: readline-statevar-1.0.1.0
On Mon, Dec 07, 2009 at 10:31:01AM +1000, Ivan Miljenovic wrote: You allow your friends (and what kind of a friend does this anyway) access to your email? Accessing one's computer when the owner goes to the bathroom is not unheard of here. However people usually avoid sending these messages to serious mailing lists. -- Felipe. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Is anyone reading Pattern Calculus by Barry Jay?
I just bought a copy of Pattern Calculus [1] by Barry Jay and I would like to discuss the lambda- and pattern-calculus with anyone who is interested. Is there anyone else here who is reading the book and would like to discuss here (if it is appropriate) or take the discussion elsewhere? My knowledge of types has come primarily through reading this Haskell Cafe list, so I am by no means an expert. Just a tinkerer :) Regards, Duane Johnson [1] http://lambda-the-ultimate.org/node/3695___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Insert a laziness break into strict ST
On Sun, Dec 6, 2009 at 5:46 PM, Henning Thielemann lemm...@henning-thielemann.de wrote: I have lot of ST actions that shall be bound strictly (they write to a buffer), but somewhere between these actions I like to have a laziness break. I thought I could do this by temporarily switching to Lazy.ST, but this does not work. It follows a simplified example snip I hoped to get the first answer also for the second command. It seems that conversion from lazy to strict ST also removes laziness breaks. It seems that I have to stick to unsafeInterleaveIO, but I like to know, why the above method does not work. This isn't the answer you want, but there is an unsafeInterleaveST. Antoine ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Hayoo and Hoogle (beginner question)
Hello Hopefully Helpful Haskell Community! (I really wanted that to be alliteration... couldn't come up with an h word for community) I've just started learning Haskell (working my way through Real World Haskell and really liking it)! I have started to appreciate that there are a lot of Haskell libraries I will want to search and access quite regularly when I work on Haskell projects, so I had the following questions: 1. Hoogle and Hayoo: I'm a bit confused by the difference here. From initial impressions it seems that Hayoo is linked to Hackage, but Hoogle is not? And it seems that Hayoo is, well, Similar to Hoogle, but with less focus on type search. Should I check both of these when I want a library, or choose one and go with it...? Or is it indeed better to search Hayoo when I'm thinking of a named library and Hoogle when I think I know the type signature for just the function I need? 2. I much prefer a command line search interface to a browser, I see Hoogle offers such a tool, does Hayoo? P.S. If these questions are in the wrong place, or if they are already answered in detail somewhere that my Googling didn't find please feel free to paste a link and tell me to search better next time! -- View this message in context: http://old.nabble.com/Hayoo-and-Hoogle-%28beginner-question%29-tp26669924p26669924.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell-Newbie and Char-Function
On Dec 6, 2009, at 4:42 AM, MeAdAstra wrote: I only started learning Haskell some days ago. Maybe one of you can give me a hint on how to implement a function that needs a character in the range (a,b,...z) and an integer number k and returns the k-next neighbor of the character? For example, fct a 5 would result in output f. I'm reading between the lines here. I think you want alphabetic_successor :: Int - Char - Char {- alphabetic_successor k c requires k = 0 and c `elem` lower_case_letters ensures result `elem` lower_case_letters where lower_case_letters = abcdefghijklmnopqrstuvwxyz -} What's not clear from your description is what's supposed to happen if you ask for alphabetic_successor 5 'z'. I'll assume you want to think of the letters being in a circle. It is possible to hack this using character-integer and integer-character conversion, but I'm going to do it another way that doesn't depend on the characters being contiguous in the Unicode character set. You could use the code to find the successor in a sequence of consonants, for example. A. We want to find the position of c in lower_case_letters. The first thing to do is to read the documentation and see if there is a suitable function. There's one in the List module: elemIndex :: Eq x = x - [x] - Maybe Int. This will work for any type x (including characters) that supports equality (==). It takes an item, a list of items, and either returns Nothing (the item wasn't found) or (Just n) -- the item was found at position n, 0 offset. B. We add k to n and reduce it modulo the length of the list. C. Given our new position, we want to find the character at that position in the list. The function for that is list !! index. import List (elemIndex) alphabetic_successor k c = lower_case_letters !! new_index where Just index = List.elemIndex c lower_case_letters new_index = (k + index) `mod` length lower_case_letters lower_case_letters = abcdefghijklmnopqrstuvwxyz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: New Hackage category: Error Handling
Michael Snoyman wrote: On Sun, Dec 6, 2009 at 12:55 AM, Henning Thielemann lemm...@henning-thielemann.de wrote: On Sun, 6 Dec 2009, Michael Snoyman wrote: I think there are plenty of examples like web servers. A text editor with plugins? I don't want to lose three hours worth of work just because some plugin wasn't written correctly. For many classes of programs, the distinction between error and exception is not only blurred, it's fully irrelevant. Harping on people every time they use error in the wrong sense seems unhelpful. Hope my commenting on this subject doesn't become my own form of *pedantry*. In an earlier thread I have explained that one can consider a software architecture as divided into levels. What is an error in one level (text editor plugin, web server thread, operating system process) is an exception in the next higher level (text editor, web server, shell respectively). This doesn't reduce the importance to distinguish between errors and exceptions within one level. All approaches so far that I have seen in Haskell just mix exceptions and errors in an arbitrary way. I think we can all appreciate why it would be a bad thing is we treat exceptions as errors. For example, I don't want my program to crash on a file not found. On the other hand, what's so bad about treating errors as exceptions? If instead of the program crashing on an array-out-of-bound or pattern-match it throws an exception which can be caught, so what? The error gets hidden instead of fixed? Cheers Ben ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] OpenCL target for DPH?
Hi, I'm wondering if anyone has looked at OpenCL as target for Data Parallel Haskell? Specifically, having Haskell generate CL kernels, i.e. SIMD vector type aware C language backend, as opposed to just a Haskell language binding. Thanks, Marcus ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What is the rank of a polymorphic type?
On Sun, Dec 6, 2009 at 8:39 AM, Dan Doel dan.d...@gmail.com wrote: Apologies for the double-reply... Your mail prompted me to finally get around to adding a mono/polytype system to an interpreter I've been working on for pure type systems, to see what a GHC-alike type system would look like. Here's what I came up with. Have you read Henk: a typed intermediate language by Simon Peyton Jones and Erik Meijer? In section 4, they describe a PTS very similar to yours. http://research.microsoft.com/en-us/um/people/emeijer/Papers/Henk.pdf -- Dave Menendez d...@zednenem.com http://www.eyrie.org/~zednenem/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE: new installment of failure framework
We'd like to announce the next installment of the Failure Framework. Based on feedback, our main goals in this release is to reduce the number of external dependencies and avoid complications with monad transformer libraries at the core of the framework. We have made the following changes: * Failure is not tied directly to monads anymore. The main typeclass is Failure, which provides the failure function. MonadFailure, ApplicativeFailure and FunctorFailure are provided for convenience. * The Failure typeclass is now located in the failure package, which has no dependencies. All code dealing with transformers and mtl has been factored into control-monad-failure and control-monad-failure-mtl, respectively. In addition, we are simultaneously releasing the following packages: * safe-failure provides safe versions of dangerous, non total functions, such as head, by returning failures. It depends exclusively on failure. * attempt provides a concrete data type for handling extensible exceptions as failures. It depends exclusively on failure. * control-monad-attempt provides a monad transformer for attempt using the transformers library. We do not provide currently an mtl version of this package, but can provide one if there is demand. * control-monad-exception, explicitly typed, checked exceptions with monadic stack traces. Below are the links to the packages just released. Enjoy! http://hackage.haskell.org/package/failure-0.0.0 http://hackage.haskell.org/package/control-monad-failure-0.6.0 http://hackage.haskell.org/package/control-monad-failure-mtl-0.6.0 http://hackage.haskell.org/package/safe-failure-0.4.0 http://hackage.haskell.org/package/attempt-0.2.0 http://hackage.haskell.org/package/control-monad-attempt-0.0.0 http://hackage.haskell.org/package/control-monad-exception-0.8.0 http://hackage.haskell.org/package/control-monad-exception-mtl-0.8.0 http://hackage.haskell.org/package/control-monad-exception-monadsfd-0.8.0 http://hackage.haskell.org/package/control-monad-exception-monadstf-0.8.0 Michael Snoyman, Pepe Iborra, Nicolas Pouillard ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: New Hackage category: Error Handling
On Mon, Dec 7, 2009 at 5:30 AM, Ben Franksen ben.frank...@online.de wrote: Michael Snoyman wrote: On Sun, Dec 6, 2009 at 12:55 AM, Henning Thielemann lemm...@henning-thielemann.de wrote: On Sun, 6 Dec 2009, Michael Snoyman wrote: I think there are plenty of examples like web servers. A text editor with plugins? I don't want to lose three hours worth of work just because some plugin wasn't written correctly. For many classes of programs, the distinction between error and exception is not only blurred, it's fully irrelevant. Harping on people every time they use error in the wrong sense seems unhelpful. Hope my commenting on this subject doesn't become my own form of *pedantry*. In an earlier thread I have explained that one can consider a software architecture as divided into levels. What is an error in one level (text editor plugin, web server thread, operating system process) is an exception in the next higher level (text editor, web server, shell respectively). This doesn't reduce the importance to distinguish between errors and exceptions within one level. All approaches so far that I have seen in Haskell just mix exceptions and errors in an arbitrary way. I think we can all appreciate why it would be a bad thing is we treat exceptions as errors. For example, I don't want my program to crash on a file not found. On the other hand, what's so bad about treating errors as exceptions? If instead of the program crashing on an array-out-of-bound or pattern-match it throws an exception which can be caught, so what? The error gets hidden instead of fixed? Cheers Ben You're right; bad programmers could do this. A good programmer will know to do one of two things when it gets an exception it does not know how to handle: * Die with an error message. * In cases like web servers, print an informative error message (eg, hopefully more useful than Prelude: head) and continue doing something else. I think the kind of programmers who just ignore exceptions and try to keep going are what I think of as over-defensive programmers, who in a misguided attempt to make their code more robust think that they should eliminate any possibility of not returning a result. I saw my share of this kind of code at my previous job, and when you're dealing with data processing programs, it's *very* irritating when suddenly you have garbage data because someone thought huh, this should be negative, will just use the abs function. However, these people will find ways of doing these evils even without exceptions. Bonus: My favorite error-handling line of code at the company was a bit of VBA that went: On Error Goto Hell Michael ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] New Hackage category: Error Handling
On Sat, Dec 5, 2009 at 3:00 PM, Michael Snoyman mich...@snoyman.com wrote: On Sun, Dec 6, 2009 at 12:55 AM, Henning Thielemann lemm...@henning-thielemann.de wrote: On Sun, 6 Dec 2009, Michael Snoyman wrote: I think there are plenty of examples like web servers. A text editor with plugins? I don't want to lose three hours worth of work just because some plugin wasn't written correctly. For many classes of programs, the distinction between error and exception is not only blurred, it's fully irrelevant. Harping on people every time they use error in the wrong sense seems unhelpful. Hope my commenting on this subject doesn't become my own form of *pedantry*. In an earlier thread I have explained that one can consider a software architecture as divided into levels. What is an error in one level (text editor plugin, web server thread, operating system process) is an exception in the next higher level (text editor, web server, shell respectively). This doesn't reduce the importance to distinguish between errors and exceptions within one level. All approaches so far that I have seen in Haskell just mix exceptions and errors in an arbitrary way. I think we can all appreciate why it would be a bad thing is we treat exceptions as errors. For example, I don't want my program to crash on a file not found. On the other hand, what's so bad about treating errors as exceptions? If instead of the program crashing on an array-out-of-bound or pattern-match it throws an exception which can be caught, so what? Michael I think the key is in the difference between the user/client and programmer/developer. As Henning has been saying, these roles change as you go through the different levels of the program, but I see the difference between an error and an exception as this: when a problem is relevant to the user/client, it's an exception; when it is irrelevant to the user/client, it's an error. Suppose you were using some sort of exception framework and you got an error from a piece of library code (not the head function) saying that head had failed somewhere. This is absolutely meaningless to a client. It just means there's a problem in the library code; it doesn't mean anything is amiss in the client's space. The client basically has to throw the function out, whether by gracefully aborting the program, disabling the plugin, etc. Contrast this with an exception, such as index not in map. This is entirely relevant to the client. All of the code knows exactly what is going on; it's just that the index isn't in the map. The client can recover from this by, say, substituting a default value, adding the index to the map, etc. Now, suppose the client knew a priori that the index was *supposed* to be in the map. Now this becomes an *error* to the *client* of the client, since there is a bug in the first client's code. I guess my point is that if I have a function, say, sort :: Ord a = [a] - [a], and sort calls head somewhere in it, there's no point having sort throw an exception for Prelude.head: [] since that means nothing to the client. It would make more sense to have an InternalError type that just says OK, sorry client, I screwed up, just clean things up as best you can. If really were something that the client could have responded to, sort should have caught the head error inside the function definition and rethrown a different exception; say, SortEmptyListError if your sort function didn't work on empty lists (contrived example, sorry). Alex ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is anyone reading Pattern Calculus by Barry Jay?
2009/12/7 Duane Johnson duane.john...@gmail.com: I just bought a copy of Pattern Calculus [1] by Barry Jay and I would like to discuss the lambda- and pattern-calculus with anyone who is interested. Is there anyone else here who is reading the book and would like to discuss here (if it is appropriate) or take the discussion elsewhere? My knowledge of types has come primarily through reading this Haskell Cafe list, so I am by no means an expert. Just a tinkerer :) Regards, Duane Johnson [1] http://lambda-the-ultimate.org/node/3695 Hi Duane, The Melbourne FPU (functional programming union) is interested in topics like this, and some of us have a copy, or are about to get a copy of the book. http://groups.google.com.au/group/fpunion There's already a short thread on the topic - please feel free to sign up to the group. We welcome stimulating discussion. Cheers, Bernie. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hayoo and Hoogle (beginner question)
2009/12/7 drostin77 ml.nwgr...@gmail.com: Hello Hopefully Helpful Haskell Community! (I really wanted that to be alliteration... couldn't come up with an h word for community) House? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hayoo and Hoogle (beginner question)
'Hood? On Mon, Dec 7, 2009 at 2:43 PM, Colin Adams colinpaulad...@googlemail.com wrote: 2009/12/7 drostin77 ml.nwgr...@gmail.com: Hello Hopefully Helpful Haskell Community! (I really wanted that to be alliteration... couldn't come up with an h word for community) House? ___ 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] New Hackage category: Error Handling
On Sun, Dec 6, 2009 at 10:40 PM, Alexander Dunlap alexander.dun...@gmail.com wrote: On Sat, Dec 5, 2009 at 3:00 PM, Michael Snoyman mich...@snoyman.com wrote: On Sun, Dec 6, 2009 at 12:55 AM, Henning Thielemann lemm...@henning-thielemann.de wrote: On Sun, 6 Dec 2009, Michael Snoyman wrote: I think there are plenty of examples like web servers. A text editor with plugins? I don't want to lose three hours worth of work just because some plugin wasn't written correctly. For many classes of programs, the distinction between error and exception is not only blurred, it's fully irrelevant. Harping on people every time they use error in the wrong sense seems unhelpful. Hope my commenting on this subject doesn't become my own form of *pedantry*. In an earlier thread I have explained that one can consider a software architecture as divided into levels. What is an error in one level (text editor plugin, web server thread, operating system process) is an exception in the next higher level (text editor, web server, shell respectively). This doesn't reduce the importance to distinguish between errors and exceptions within one level. All approaches so far that I have seen in Haskell just mix exceptions and errors in an arbitrary way. I think we can all appreciate why it would be a bad thing is we treat exceptions as errors. For example, I don't want my program to crash on a file not found. On the other hand, what's so bad about treating errors as exceptions? If instead of the program crashing on an array-out-of-bound or pattern-match it throws an exception which can be caught, so what? Michael I think the key is in the difference between the user/client and programmer/developer. As Henning has been saying, these roles change as you go through the different levels of the program, but I see the difference between an error and an exception as this: when a problem is relevant to the user/client, it's an exception; when it is irrelevant to the user/client, it's an error. Suppose you were using some sort of exception framework and you got an error from a piece of library code (not the head function) saying that head had failed somewhere. This is absolutely meaningless to a client. It just means there's a problem in the library code; it doesn't mean anything is amiss in the client's space. The client basically has to throw the function out, whether by gracefully aborting the program, disabling the plugin, etc. Contrast this with an exception, such as index not in map. This is entirely relevant to the client. All of the code knows exactly what is going on; it's just that the index isn't in the map. The client can recover from this by, say, substituting a default value, adding the index to the map, etc. Now, suppose the client knew a priori that the index was *supposed* to be in the map. Now this becomes an *error* to the *client* of the client, since there is a bug in the first client's code. I guess my point is that if I have a function, say, sort :: Ord a = [a] - [a], and sort calls head somewhere in it, there's no point having sort throw an exception for Prelude.head: [] since that means nothing to the client. It would make more sense to have an InternalError type that just says OK, sorry client, I screwed up, just clean things up as best you can. If really were something that the client could have responded to, sort should have caught the head error inside the function definition and rethrown a different exception; say, SortEmptyListError if your sort function didn't work on empty lists (contrived example, sorry). Alex (Sorry for replying to myself.) This is, of course, assuming that a non-empty list was not an invariant of the sort function, in which case it would be a programming error on the part of the client that called sort if that happened. Alex ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] New Hackage category: Error Handling
On Mon, Dec 7, 2009 at 8:40 AM, Alexander Dunlap alexander.dun...@gmail.com wrote: On Sat, Dec 5, 2009 at 3:00 PM, Michael Snoyman mich...@snoyman.com wrote: On Sun, Dec 6, 2009 at 12:55 AM, Henning Thielemann lemm...@henning-thielemann.de wrote: On Sun, 6 Dec 2009, Michael Snoyman wrote: I think there are plenty of examples like web servers. A text editor with plugins? I don't want to lose three hours worth of work just because some plugin wasn't written correctly. For many classes of programs, the distinction between error and exception is not only blurred, it's fully irrelevant. Harping on people every time they use error in the wrong sense seems unhelpful. Hope my commenting on this subject doesn't become my own form of *pedantry*. In an earlier thread I have explained that one can consider a software architecture as divided into levels. What is an error in one level (text editor plugin, web server thread, operating system process) is an exception in the next higher level (text editor, web server, shell respectively). This doesn't reduce the importance to distinguish between errors and exceptions within one level. All approaches so far that I have seen in Haskell just mix exceptions and errors in an arbitrary way. I think we can all appreciate why it would be a bad thing is we treat exceptions as errors. For example, I don't want my program to crash on a file not found. On the other hand, what's so bad about treating errors as exceptions? If instead of the program crashing on an array-out-of-bound or pattern-match it throws an exception which can be caught, so what? Michael I think the key is in the difference between the user/client and programmer/developer. As Henning has been saying, these roles change as you go through the different levels of the program, but I see the difference between an error and an exception as this: when a problem is relevant to the user/client, it's an exception; when it is irrelevant to the user/client, it's an error. Suppose you were using some sort of exception framework and you got an error from a piece of library code (not the head function) saying that head had failed somewhere. This is absolutely meaningless to a client. It just means there's a problem in the library code; it doesn't mean anything is amiss in the client's space. The client basically has to throw the function out, whether by gracefully aborting the program, disabling the plugin, etc. Contrast this with an exception, such as index not in map. This is entirely relevant to the client. All of the code knows exactly what is going on; it's just that the index isn't in the map. The client can recover from this by, say, substituting a default value, adding the index to the map, etc. Now, suppose the client knew a priori that the index was *supposed* to be in the map. Now this becomes an *error* to the *client* of the client, since there is a bug in the first client's code. I guess my point is that if I have a function, say, sort :: Ord a = [a] - [a], and sort calls head somewhere in it, there's no point having sort throw an exception for Prelude.head: [] since that means nothing to the client. It would make more sense to have an InternalError type that just says OK, sorry client, I screwed up, just clean things up as best you can. If really were something that the client could have responded to, sort should have caught the head error inside the function definition and rethrown a different exception; say, SortEmptyListError if your sort function didn't work on empty lists (contrived example, sorry). Alex The WrapFailure typeclass in the the failure package makes this kind of library design fairly straightforward. I think you're making an argument for treating errors and exceptions the same way. Michael ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe