[Haskell] ANNOUNCE: HWSProxyGen version 0.1
We are glad to present version 0.1 of HWSProxyGen, a web services proxy generator for the Haskell functional language, implemented in Haskell and C#. The final purpose is to show that Haskell and functional languages in general can be used as a viable way to the implementation of distributed components and applications, interacting with services implemented in different languages and/or platforms. Plese note that this first version is guaranteed to work only for web services generated with Visual Studio .NET. Binaries, source code and more information can be found in: http://www.cin.ufpe.br/~haskell/hwsproxygen/ HWSProxyGen was conceived and implemented in the Informatics Center of the Federal University of Pernambuco, Brazil, by: - Andre W. B. Furtado - Andre L. M. Santos - Carlos A. G. Ferraz - Gustavo A. Santos - Adeline S. Silva - Carla M. P. Nascimento Cheers, -- AFurtado ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
[Haskell] ANNOUNCE: Haskell support for Visual Studio .NET 2003 and Assignment Manager tools
We are pleased to announce an alpha/preview version of VHS (Visual Haskell), which integrates the Haskell functional language with the Microsoft Visual Studio .NET 2003 IDE, and VHS-AM, which allows the use of VHS with the Microsoft Assignment Manager tools. This preview version supports: - Syntax coloring - Brace matching through CTRL+] (including module/where, let/in, etc.)* - Brace highlighting (including module/where, let/in, etc.)* - Brace matching text indicated in the status bar - TODO comments in code are added to the task list and can be reached by double-clicking it - Quick-info* - Word-completion* - Method tip* - Member-list popup* - Haskell Console Application creation - Haskell Console Application compilation (integrated with GHC) - Haskell Console Application execution - The presence of parse errors is indicated on-the-fly in the task list (specific errors are still not specified) - Error source location can be reached by double-clicking the task list - Haskell Assignment Manager exercise creation and advertisement - Haskell Assignment Manager exercise answering and submission - Compilation checking (via GHC) and output checking of Haskell exercises by Assignment Manager server Please note that this first release of VHS has some known bugs: - A VS.NET session can become unstable if you open a .hs file or create a Haskell Console Application project. - After opening a .hs file, the devenv.exe process is not being killed when VS.NET exits. - The above features marked with * sometimes do not work 100% as expected, mainly if the haskell module under development has errors. - Some features do not work in a inter-module fashion. - The Visual Haskell logo does not disappear from VS.NET splash screen after uninstall. Note: development of a Visual Studio plugin for Haskell has been proceeding on two fronts. Simon Marlow Krasimir Angelov have been working on adding complete editor support and a project framework integrated with Cabal, whereas this release is based on a fork of the codebase several months ago, and has a different feature set. We hope to combine these versions and make further releases in the future. Downloads, documentation and screenshots can be found in: http://www.cin.ufpe.br/~haskell/vhs-am/ http://www.cin.ufpe.br/~haskell/vhs/ The VHS/VHS-AM team is: - Simon Marlow - Krasimir Angelov - Andre Santos - Andre Furtado - Mauro La-Salette - Marden Costa This project was partially supported by a MS grant for extending the Assignment Manager tool. ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
Re: [Haskell] Building from source
Christian Maeder wrote: [compilation] failed in the directory hood, because the target boot is unknown there. Could/Should this be fixed? BTW, nofib is also breaking the fptools suite compilation. Cheers, -- AFurtado ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
[Haskell] HTTP and Borwser modules maintainer
Who is actually responsible for the Haskell HTTP and Browser modules (http://homepages.paradise.net.nz/warrickg/haskell/http/)? The e-mail indicated in the site (oinutter [at] hotmail.com) is returning... Thanks, -- Andre ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
Re: [Vhs-ufpe] problems building GHC from source in Windows
Starting with a completely fresh tree indeed solved the problem. Finally I was able to compile GHC from source, but I'd like to report that nofib and hood are actually breaking the fptools build. nofib error is: /bin/sh -c ././exp3_8_p +RTS -SC:/TEMP/stats392 -RTS +RTS -H10m -K10m -RTS 8 /dev/null 1 C:/TEMP/runtest392.1 2 C:/TEMP/runtest392.2 3 C:/TEMP/runtest392. 3 ././exp3_8_p +RTS -H10m -K10m -RTS 8 /dev/null expected stdout not matched by reality *** exp3_8.stdout Tue Nov 26 11:46:26 1996 --- C:/TEMP/runtest392.1Thu Feb 26 18:42:44 2004 *** *** 1 ! 6561 --- 1 ! 6561 make[4]: *** [runtests] Error 1 make[3]: *** [all] Error 1 make[2]: *** [all] Error 1 make[1]: *** [all] Error 1 make[1]: Leaving directory `/cygdrive/c/haskell/cvs2/fptools/nofib' make: *** [build] Error 1 hood error is: make[1]: Leaving directory `/cygdrive/c/haskell/cvs2/fptools/hdirect' make[1]: Entering directory `/cygdrive/c/haskell/cvs2/fptools/hood' make[1]: *** No rule to make target `boot'. Stop. make[1]: Leaving directory `/cygdrive/c/haskell/cvs2/fptools/hood' make: *** [build] Error 1 Removing them from my local machine made it possible to proceed. Cheers, -- Andre - Original Message - From: Simon Peyton-Jones [EMAIL PROTECTED] To: Andre Santos [EMAIL PROTECTED]; Andre W B Furtado [EMAIL PROTECTED] Cc: GHC bugs [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, February 23, 2004 8:23 AM Subject: RE: [Vhs-ufpe] problems building GHC from source in Windows [redirecting to ghc-bugs] I have seen this before. Things are going wrong when you use the newly built compiler to compile the run-time system. (This is the first RTS file it compiles, right?) Trouble is, I can't remember what was wrong. I hope you configured with --with-gcc=c:/mingw/bin/gcc as specified?Is this a completely clean build, starting with autoreconf, in a tree with no old files lying around in it? (If not, start a completely fresh tree -- I do have a vague memory that make clean didn't make clean enough...) Simon | -Original Message- | From: [EMAIL PROTECTED] [mailto:glasgow-haskell-users- | [EMAIL PROTECTED] On Behalf Of Andre Santos | Sent: 22 February 2004 07:10 | To: Andre W B Furtado | Cc: glasgow-haskell-users; [EMAIL PROTECTED] | Subject: Re: [Vhs-ufpe] problems building GHC from source in Windows | | Hi Andre, | | are you sure you have a ../../ghc/compiler/ghc-inplace file/compiler? | You need to have compiled the ghc/compiler directory to have that. | | If you are only building a different rts you should have used | make HC=your-ghc-compiler otherwise it will try to use | the inplace one (which is the usual/standard behaviour). | | Andre. | | Andre W B Furtado wrote: | | I was trying to build GHC in my Windows XP, using Cygwin, following the | steps in the building guide. I'm stuck in the following error when executing | make in fptools: | | creating libgmp.la | (cd .libs rm -f libgmp.la ln -s ../libgmp.la libgmp.la) | make[6]: Leaving directory `/cygdrive/c/haskell/cvs/fptools/ghc/ghc/rts/gmp' | make[5]: Leaving directory `/cygdrive/c/haskell/cvs/fptools/ghc/ghc/rts/gmp' | ../../ghc/compiler/ghc-inplace -H16m -O -O2 -static-c Apply.hc -o | Apply.o | make[3]: *** [Apply.o] Error 1 | make[2]: *** [all] Error 1 | make[2]: Leaving directory `/cygdrive/c/haskell/cvs/fptools/ghc/ghc' | make[1]: *** [build] Error 1 | make[1]: Leaving directory `/cygdrive/c/haskell/cvs/fptools/ghc' | make: *** [build] Error 1 | | Any suggestions? | Thanks, | -- Andre | | ___ | Vhs-ufpe mailing list | [EMAIL PROTECTED] | http://noronha.cin.ufpe.br/mailman/listinfo/vhs-ufpe | | ___ | Glasgow-haskell-users mailing list | [EMAIL PROTECTED] | http://www.haskell.org/mailman/listinfo/glasgow-haskell-users ___ Glasgow-haskell-bugs mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
locating package.conf II
Hi, In July 2003, a discussion in this list named locating package.conf (http://www.haskell.org/pipermail/glasgow-haskell-users/2003-July/005511.htm l) concluded that make install on Windows is not supported. Has this evolved since then? Thanks, -- Andre ___ Glasgow-haskell-bugs mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
inconsistent GHC building documentaion
Hi, In the Building the Glasgow Functional Programming Tools Suite, chapter 12, Notes for building under Windows (http://www.haskell.org/ghc/docs/6.2/html/building/winbuild.html), it is said: Install an executable Happy, from http://www.haskell.org/happy;. The latest version of happy in its website is 1.13. When running configure in fptools, however, I get the error: configure: error: Happy version 1.14 or later is required to compile GHC. Suggestions: 1) Make happy 1.14 available in its website 2) Change GHC building instructions in chapter 12 (saying that version 1.14 of Happy must be used and it can be built from the CVS sources). BTW, is there any problem using happy 1.14 compiled from source? Cheers, -- Andre ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
haskell for educative games
Does anyone know if Haskell is/was used to develop educative games? Do you recommend some papers on the subject? Thanks a lot, -- Andre Furtado ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
Haskell for educative games
Does anyone know if Haskell is/was used to develop educative games? Do you recommend some papers on the subject? Thanks a lot, -- Andre Furtado ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
literal default value for an unknown type
Is it possible replace the question mark in the following code in order to make defaultMyType return a don't care value for b? data MyType t = MyType { a :: Int, b :: t} defaultMyType :: MyType defaultMyType = MyType {a = 0, b = ?} Cheers, -- Andre ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
deprecated non-standard syntax
The following line: foreign import shutdownHaskellAndExit :: Int - IO () causes a compiler warning: foreign declaration uses deprecated non-standard syntax Which is the correct way to use a foreign declaration? Thanks, -- Andre ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Labelled types question
I'm guessing you're using the current release of Hugs. It doesn't implement the Haskell98 module system really, [...] This answers my question, indeed. Thank you all. (compiling the code with GHC was ok!) -- Andre ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
Re: Haddock installing problems
Andre W B Furtado wrote: [Haddock cannot find perl] This works for me, but I'm not a Cygwin/Windows expert so I'm not sure what the canonical answer should be. On my system I have the Cygwin perl.exe in /cygwin/bin, and this is also /bin under cygwin, because by default Cygwin seems to want to mount /cygwin as /. I've just successfully build Haddock on WinXP with a fresh install of Cygwin, GHC 5.02.3, and surprisingly little fiddling about (I think I had to set PATH to include GHC, but that was it). Looking the output produced by ./configure, I noticed that: checking for ghc... /PROGS/GHC5023/BIN/ghc checking version of ghc... /PROGS/GHC5023/BIN/ghc: not found I wonder why haddock thinks my ghc dir is /PROGS/GHC5023/BIN/ghc when it should be /progs/ghc5023/bin/ghc. Perhaps that's why it can't find perl: ghc itself was not found. Any ideas? -- Andre ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
ObjectIO install
The INSTALL file that comes with the objectIO files says that one must use the following commands to register the package: $ ghc-pkg -r objectio $ ghc-pkg -a objectio -f pckg.cfg The second command is not recognized as a valid one, and the ghc-pkg help appears showing the correct syntax. I needed to use $ ghc-pkg -a pckg.cfg in order to get the package correctly registered. Am I missing something or is the INSTALL file wrong? -- Andre ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
ANNOUNCE: FunGEn-0.1 released!
--- FunGEn Functional Game Engine --- I am pleased to announce the first release of FunGEn, a 2D platform-independent game engine implemented in and for Haskell, using HOpenGL. Actually, FunGEn supports: * Initialization, updating, removing, rendering and grouping routines for game objects; * Definition of a game background (or map), including texture-based maps and tile maps; * Reading and intepretation of the player's keyboard input; * Collision detection; * Time-based functions and pre-defined game actions; * Loading and displaying of 24-bit bitmap files; * Some debugging and game performance evaluation facilities; * Sound support (actually for windows platforms only... :-[ ) You can download and find more info about FunGEn in: http://www.cin.ufpe.br/~haskell/fungen Your feedback is highly welcome! Nice coding... -- Andre W B Furtado ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
register error
While trying to install GHC-5.02.3 (win32 release) in my computer (Windows 98), I got the following error message: Error 1406: Could not write value _MainFeature to key HKEY_LOCAL_MACHINES\Software\Microsoft\Windows\CurrentVersion\Installer\Feat ures\8C655693FA0801D4E87FA1CA60C4AAE1 Verify that you have sufficient access to that key, or contact your support personel. I then finished the installation, and would like to ask 2 things: 1. What problems am I supposed to expect with this error? 2. Why this happened? I though I had sufficient access to all needed register keys... :) Thanks, -- Andre ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
functional programming contest
I was visiting http://www.ai.mit.edu/extra/icfp-contest/ and noticed that there was a functional programming contest in ICFP 98. I'd like to know if there are any periodic functional progamming contests around the world, such as the ACM contest for the C language. -- Andre ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
handling errors in Happy
Is it possible to get the result of function happyError, in the main module of my program (which imports the module generated by Happy)? Thanks a lot, -- Andre ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
Re: newbie:: getting random Ints
the function randomRIO :: (a,a) - IO a defined in module Random gives you a random number between the two input parameters (including themselves). -- Andre - Original Message - From: Peter Rooney [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 28, 2002 3:05 AM Subject: newbie:: getting random Ints hello all, total newbie to haskell, armed with the craft of functional programming. i can't seem to generate random numbers. i have read this: http://www.haskell.org/onlinelibrary/random.html and searched the web and archives, and read thru Random.hs (mostly over my head), but have been unable to get any combination of getStdRandom randomR, etc. to work. even the example in the 98 report, import Random rollDice :: IO Int rollDice = getStdRandom (randomR (1,6)) gets me: Main rollDice Main after loading the file, which makes me think i'm missing something! TCFP has an example of how to do it yourself, but i can see that my needs are more than met by Random.hs. my various attempts all look a lot like this: Main getStdGen (random 5) ERROR - Type error in application *** Expression : getStdGen (random 5) *** Term : getStdGen *** Type : IO StdGen *** Does not match : a - b could someone post an example of how to generate random integers within a range? tia, peter ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
uniqueness typing
I found the following text when visiting the Clean (a functional language) site: Clean is the only functional language in the world which has a special type system, uniqueness typing. It enables to update function arguments destructively retaining the purity of the language. Then I have some questions: 1. Can anyone explain what does update function arguments destructively mean? 2. If this is a desirable thing, why does Haskell not implement it? Thanks, -- Andre ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
pattern-matching with labelled types
If I have: data MyType = MT { x :: Int, y :: Char } How do I update the Int value of MyType leaving the Char value unaffected? I tryied something like: MT {x = newValue} but GHC gave me a warning about the Char value and it indeed caused strange effects. Of course, it is possible to do something like update :: MyType - Int - MyType update mt newValue = MT {x = newValue, y = oldValue} where oldValue = y mt but this really annoys me when MyType has too many fields. Suggestions? Thanks a lot, -- Andre ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
labelled types efficiency
Another question about labelled types, this time concerning about efficiency: is there any efficiency differences between functions f and g below? data RType = R Int Char data Stype = S {x :: Int, y :: Char} f :: RType - Int f (R x _) = x g :: SType - Int g s = x s Thanks again, -- Andre ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
strip effect
What is the effect of using the strip command with the files generated by ghc (besides reducing the file size)? -- Andre ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
declaring a generic type in type synonyms
Is is possible to declare a generic type without using data or newtype? For example, I woud like that pair is a type synonym for (t,t) where t is a generic type, but just saying: type pair = (t,t) won't work: i get a parse error. Thanks, -- Andre ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
Re: forcing IO operations
liftIOtoMyMonad_ :: IO () - MyMonad () liftIOtoMyMonad_ m = liftIOtoMyMonad' (const m) () I'm having problems compiling this one: The last statement in a 'do' construct must be an expression ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
Re: forcing IO operations
[answering myself...] liftIOtoMyMonad_ :: IO () - MyMonad () liftIOtoMyMonad_ m = liftIOtoMyMonad' (const m) () I'm having problems compiling this one: The last statement in a 'do' construct must be an expression The problem is not related with liftIOtoMyMonad_ , but with liftIOtoMyMonad and liftIOtoMyMonad'. I think its an identation problem. Re-writing these funcions as follows solves the problem: liftIOtoMyMonad' :: (a - IO ()) - a - MyMonad () liftIOtoMyMonad' p q = StateMonad $ \s - (do p q return ((),s)) liftIOtoMyMonad :: IO a - MyMonad a liftIOtoMyMonad p= StateMonad $ \s - (do y - p return (y,s)) At least by now, all the ideas are working very well... great help Jay, thanks a lot! -- Andre ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
Re: Composition Monad
Hal Daume III wrote: I'm not sure exactly what you mean. Say I have something like that, then what's the difference between saying: f = do { action1; action2; action3 } and simply f = do action3 ? If the result of each of the actions is ignored for the following ones, why do we need to do this monadically? If g is an IORef, for example, action1 can modify the content of this IORef, but the reference itself is still the same. That's why I'd like to use the SAME g to all actions, although the content of g will be changed. -- Andre ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
Re: Composition Monad
Hal Daume III wrote: I'm not sure exactly what you mean. Say I have something like that, then what's the difference between saying: f = do { action1; action2; action3 } and simply f = do action3 ? If the result of each of the actions is ignored for the following ones, why do we need to do this monadically? If g is an IORef, for example, action1 can modify the content of this IORef, but the reference itself is still the same. That's why I'd like to use the SAME g to all actions, although the content of g will be changed. -- Andre ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
Composition Monad
Roughly speaking, I'm in need of a monad (say MyIO) that interprets the following code f :: MyIO () f = do action1 action2 action3 ... return () as applying action1 to g, then action2 to the SAME g (not the result of action1) and so on... Of course, this g will be specified when starting the monad (something like runMyIO g). Does this composition monad already exist? If no, can anyone give me some hints to create my own? Thanks a lot -- Andre ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
unIO vs. unsafePerformIO
What's the difference between unIO and unsafePerformIO? And why is the former safe? (I would like to apply the same questions to unsafeIOToST and ioToST) Thanks, -- Andre ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
if-then-else inside a do
In the following code, will other things be executed or the return () will end function f? I guess the answer is yes (other things WILL be executed anyway), but I'd like to understand why won't the return () be the [state change/result produced] created by f. f :: IO () f = do -- lots of things if False then doSomething else (return ()) -- other things Thanks, -- Andre ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
st monad
How do I find the implementation of the module ST? In the GHC documentation, I can only find the signatures of the functions.
Re: monad thinking process
Just check this monad tutorial (attached). It's really great for beginners. -- Andre ---BeginMessage--- -- Forwarded message -- Date: Tue, 05 Jun 2001 11:26:12 -0300 From: Andre Santos [EMAIL PROTECTED] Newsgroups: depto.cursos.grad.if098 Subject: Monads for the Working Haskell Programmer http://www.engr.mun.ca/~theo/Misc/haskell_and_monads.htm Title: Monads for the Working Haskell Programmer Monads for the Working Haskell Programmer -- a short tutorial. Theodore Norvell Memorial University of Newfoundland New: Updated to Haskell '98. This short tutorial introduces monads to Haskell programmers. It applies to Haskell '98. Gofer programmers (are there any left?) can read it too; there is a section at the end detailing the differences between Haskell and Gofer around monads and another about the differences between Haskell 1.3, Haskell 1.4, and Haskell 98. The reader is assumed to have a familiarity with the basics of Haskell programming such as data declarations, function definitions, and lambda expressions. Familiarity with classes and instance declarations will help. Simulating states without Monads Consider the following function f1 w a = let (b, x) = g1 w a (c, y) = h1 w x b (d, z) = i1 w x y c in (d, z) where a, b, c, and d all have the same type, State. In a sense this definition is very similar to an imperative program in which a represents the initial state, d represents the final state, and b and c represent intermediate states. The functions f1 w, g1 w, h1 w x, and i1 w x y can be thought of as imperative routines that transform the state and produce results. The results are like the return values in C programs and are bound to variables x, y, and z in the example. A C routine that corresponds to this would look something like this: int f1(float w) { const char x = g1(w) ; const double y = h1(w, x) ; const intz = i1(w, x, y) ; return z ; } All this explicit passing of states around can get a bit tedious, especially when programs are modified. It also makes the program hard to read vs. the equivalent C program. Note that if we ignore the w, x, y, and z, then g1, h1, and i1 are being composed. Can we define a kind of composition operator that allows us to deal with the returned values as well as the state? Simulating states with Monads The functions that transform the state in the example above all have the type State - (State, a) for some result type a. Let's generalize over the type of the state and create a type to represent these transforms type StateTrans s a = s - (s, a) Let us define two functions. The first is a kind of composition function. (=) :: StateTrans s a - (a - StateTrans s b) - StateTrans s b p = k = \s0 - let (s1, a) = p s0 q = k a in q s1 The second is a function that turns a value into an imperative program that does not change the state, but returns the result. return :: a - StateTrans s a return a = \s - (s, a) Our original function may now be written with all the shunting of state around hidden by these operators: f w = (g w) = (\x - (h w x) = (\y - (i w x y) = (\z - return z))) You could also format this as follows f w = g w = \x - h w x = \y - i w x y = \z - return z You should verify that f is equal to f1, if g = g1, h = h1, and i = i1. (Warning, if you really try to make the above definitions of = and return, your Haskell compiler will complain, for reasons that will be explained later. However, you could try changing the names a little, e.g. change = to == and change return to rtn.) A nicer syntax Now Haskell provides a nice syntax to sugar-coat the calls to =. It turns out that the definition of f can also be written as f w = do x - g w y - h w x z - i w x y return z The do is a keyword of Haskell. Any program involving a do can be translated to one that doesn't use do by the following 4 rules: 1 An expression do pattern - expression morelines becomes expression = (\ pattern - do morelines) 2 An expression do expression morelines becomes expression do morelines 3 An expression do let declarationList morelines becomes let declarationList in do morelines 4. Finally when there is only one line in the do, an expression do expression becomes expression In the second rule, we saw the operator; this is used when the result of the first operand is not subsequently used. It can always be defined as p q = p = (\ _ - q) So do p q is the same as do _ - p q The do notation follows the same conventions as other multi-line constructs in Haskell. All lines must be vertically alligned. Alternatively, you may use braces and semicolons if you prefer free format: do {x - g w ;
Re: Monad composition
Well, it's also possible to interchange data between these two monads by: unsafeIOToST :: IO a - ST s a stToIO :: ST s a - IO a Can anyone tell the possible problems related to unsafeIOToST? ^^ -- Andre - Original Message - From: Tom Bevan [EMAIL PROTECTED] To: Andre W B Furtado [EMAIL PROTECTED] Cc: Haskell Cafe List [EMAIL PROTECTED] Sent: Thursday, January 24, 2002 4:13 AM Subject: Re: Monad composition Andre, I can't work out how it should be done. The way I see it, the StateIO monad should have four functions associated with it. 1/ update - a function to update the state 2/ retrieve - a function to retrieve the state from the monad These two are inherited from the standard State monad 3/ input - make a character from stndIn available to the state transformation functions 4/ output - send the state of the monad after a certain set of transformations to stndOut I've managed to write functions 1-3 but not 4. Here's my work so far.I'm not really sure if this is on the right track. Tom On Thu, 2002-01-24 at 14:32, Andre W B Furtado wrote: Hi, I have the same problem. Did anyone answered your question? Thanks, -- Andre - Original Message - From: Tom Bevan [EMAIL PROTECTED] To: Haskell Cafe List [EMAIL PROTECTED] Sent: Wednesday, January 23, 2002 4:29 AM Subject: Monad composition Hi all, I'm writing a programme which requires IO actions to be interleaved with operations on a State monad. From what I can work out, this means that the IO Monad and the StateTransformation monad need to be composed into a single highr order monad. Does anyone have any references or pointers on how this should be done? Tom ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
GHC-5.02(.1) InstallShield for Windows
I just would like to report that, if you have GHC-5.02 installedand want to install GHC-5.02.1 (under Windows), you'll need to uninstall GHC-5.02 first, otherwise the InstallShield for GHC-5.02.1 won't work as expected. Is this a bug? -- Andre
Re: profiling problem
Turn down the context switching time and/or the delta between profiling samples, e.g., to get the max amount of data, do prog +RTS -h -C0 -i0 When I did this, the size of the .ps file increased, but I'm still getting an empty graph... Can anyone compile the following simple program with GHC-5.02(.1) under a Windows platform and check how the heap profile looks like? main = print (f 25 + g 25) f n = nfib n g n = nfib (n `div` 2) nfib n = if n 2 then 1 else nfib (n-1) + nfib (n-2) -- Andre ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
profiling behavior
If module A imports B, and if B was compiled without the profiling options (but A was), is the final program expected to abort (illegal operation or something like that)? If it is, why? -- Andre ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: profiling behavior
If module A imports B, and if B was compiled without the profiling options (but A was), is the final program expected to abort (illegal operation or something like that)? If it is, why? You must compile (and link) the whole program with -prof, because that option changes certain fundamental properties of the virtual machine. If you link modules compiled in different ways, the behaviour is unspecified ;-) Then I ask: if I have a compiled version of a Haskell binding/API/(something like that), without the profiling options, will I have to hack the source code of this binding/API/(something like that) and compile it again to enable profiling, even though I want to profile a part of a program that doesn't make any call to the binding/API/(something like that) functions? -- Andre ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Strange fatal error
Can anyone explain me the following error? fatal error: scavenge: unimplemented/strange closure type 0 @ 08C03FD0 (this happened with a program that reads and do some manipulations in a 3MB bitmap file, using HOpenGL-1.01 and GHC-5.02under Windows 98 + Cygwin) Thanks, -- Andre
Broken link
The link to The Graph Visualisation Tool daVinci, in GHC profiling documentation (http://www.haskell.org/ghc/docs/latest/set/prof-xml-tool.html), seems to be broken. I think the link should point to http://www.informatik.uni-bremen.de/daVinci/ -- Andre ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: problem definind a function
The following code works... = \x y - (x+y - length [1..(gcd x y)] = round (((fromIntegral x)+1)/2) ) -- Andre hello, Does anybody know why it is not possible to define the folowing function in ghc? = \x y - (x+y - length [1..(gcd x y)] = round ((x+1)/2)) ) The message obtained was this one: No instance for (RealFrac Int) arising from use of `round' at num-s-divs.hs:253 In the second argument of `(=)', namely `round ((x + 1) / 2)' In a lambda abstraction: (((x + y) - (length [1 .. (gcd x y)])) = (round ((x + 1) / 2))) Thanks in advance, J. I. GarcĂa ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Profiling in GHC-4.08.1
I was trying to compile a .hs file with the profiling option enabled (-prof -auto-all) but I got an error message: /usr/bin/ld: cannot find -lHSstd_p_imp collect2: ld returned 1 exit status Does anyone know what is this -lHSstd_p_imp? I am using GHC-4.08.1 (with Cygwin) under a Windows 98 platform. Thanks, -- Andre ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Uninstall warning...
I had GHC-4.08.1 installed in my computer (which runs under a Windows98 platform), and then I decided to install GHC-5.00.2 (this was its latest version at that time). It is said that GHC-5.00.2 can co-exist with other versions of GHC under a Windows platform, because it does not use cygwin anymore. At this point, everything was ok. But when I uninstalled GHC-5.00.2 (in order to install GHC-5.02), a lot of DLL files were removed from the bin directory of GHC-4.08.1 (ex.: HSlang.dll). I don't have any idea why this happened, but a lot of my programs that were compiled with GHC-4.08.1 became impossible to run. I had to recover the DLLs from a backup... Is this a uninstall bug? (ps: installing GHC-5.02 didn't bring my old DLLs back). -- Andre ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Unistall warning... again!
Now things really got worse... when I try to use GHC-4.08.1, I got the following message: ghc: permission denied ghc: not found make[1]: *** [depend] Error 127 How can I use the old GHC-4.08.1 back again? I have some APIs that still need it... Thanks, -- Andre ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
suggestion
What do you all think about activating the mechanism that automatically includes the name of the list before the subject of a mailing list email? For example: [hugs-users] Installation problems or [haskell] newbie question. I think this would be a nice way to make massages more organized and help people who sign multiple lists. I heard somewhere that this is possible, isn't it Simon? Cheers, -- Andre ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
Working character by character in Haskell
I'm trying to create a fast program in Haskell that reads the content of a file, do some stuff with its characters (one by one) an then save the final result (the modified characters) in another file. The fastest program I've developed so far is: main :: IO () main = do bmFile - openFileEx in.txt (BinaryMode ReadMode) bmString - hGetContents bmFile str - copyFile bmString [] writeFile out.txt str hClose bmFile copyFile :: String - String - IO String copyFile [] s = return (reverse s) copyFile (a:as) s = copyFile as ( (doSomeStuffWith a):s) What I can't understand is why a similar program, written in C, is much faster than the Haskell program. Here you have the C program: void main() { FILE *in, *out; char ch; in = fopen(in.txt,rb); out = fopen(out.txt,wb); while ( (ch=getc(in)) != EOF) putc(doSomeStuffWith(ch),out); fclose(out); fclose(in); } For example, suppose function doSomeStuffWith returns its own parameter. Using a 1.5MB file in this case, the Haskell program ends in almost 5 seconds, while the C program ends in less than 0.5 seconds... Is my Haskell program too bad implemented? (I'm using GHC 4.08-1 under a Windows 98 platform.) Thanks, -- Andre ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Working character by character in Haskell
Humn... I agree with both of you, Albert and Tom. I started it from the beginning, using map and don't using reverse anymore. But the C program is still 7x faster than the Haskell one. Here is the code of the Haskell program: main :: IO () main = do bmFile - openFileEx in.txt (BinaryMode ReadMode) bmString - hGetContents bmFile writeFile out.txt (map inc bmString) hClose bmFile inc :: Char - Char inc a = toEnum ((fromEnum a) + 1) And now the C program: #include stdio.h void main() { FILE *in, *out; char ch; in = fopen(in.txt,rb); out = fopen(out.txt,wb); while ( (ch=getc(in)) != EOF) putc(ch + 1,out); fclose(out); fclose(in); } As you noticed, the main idea here is to increment the character by one. Is the Haskell program now a nice translation of the C program? If it is (I think so...) why is the C program so much faster than it? Thanks again, -- Andre - Original Message - From: Albert Lai [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, October 18, 2001 9:42 PM Subject: Re: Working character by character in Haskell Andre W B Furtado [EMAIL PROTECTED] writes: [...] For example, suppose function doSomeStuffWith returns its own parameter. Using a 1.5MB file in this case, the Haskell program ends in almost 5 seconds, while the C program ends in less than 0.5 seconds... Is my Haskell program too bad implemented? (I'm using GHC 4.08-1 under a Windows 98 platform.) I indeed think that your Haskell program is inefficient and is not a translation of your C program. It reverses a huge string, which takes not only execution time but also garbage collection time and memory, which entails even more time for OS overhead and swapping out other things in the physical memory. (Many programmers complain my linear-time algorithm takes just 1 second on a 100M list, so why is it taking 5 seconds on a 200M list? They forget that because of issues such as cache locality and virtual memory, their computers do not scale.) I am wondering that if doSomeStuffWith is pure-functional, why are you writing and using copyFile instead of just using map? I mean: main :: IO () main = do bmFile - openFileEx in.txt (BinaryMode ReadMode) bmString - hGetContents bmFile writeFile out.txt (map doSomestuffWith bmString) hClose bmFile Because both hGetContents and map are lazy and use O(1) memory, this program behaves exactly as your C program plus occasional garbage collections that don't hurt too much. In partcular, the OS will see no difference (although the cache does). ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Working character by character in Haskell
I'm trying to create a fast program in Haskell that reads the content of a file, do some stuff with its characters (one by one) an then save the final result (the modified characters) in another file. The fastest program I've developed so far is: main :: IO () main = do bmFile - openFileEx in.txt (BinaryMode ReadMode) bmString - hGetContents bmFile str - copyFile bmString [] writeFile out.txt str hClose bmFile copyFile :: String - String - IO String copyFile [] s = return (reverse s) copyFile (a:as) s = copyFile as ( (doSomeStuffWith a):s) What I can't understand is why a similar program, written in C, is much faster than the Haskell program. Here you have the C program: void main() { FILE *in, *out; char ch; in = fopen(in.txt,rb); out = fopen(out.txt,wb); while ( (ch=getc(in)) != EOF) putc(doSomeStuffWith(ch),out); fclose(out); fclose(in); } For example, suppose function doSomeStuffWith returns its own parameter. Using a 1.5MB file in this case, the Haskell program ends in almost 5 seconds, while the C program ends in less than 0.5 seconds... Is my Haskell program too bad implemented? (I'm using GHC 4.08-1 under a Windows 98 platform.) Thanks, -- Andre ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
Re: Working character by character in Haskell
Humn... I agree with both of you, Albert and Tom. I started it from the beginning, using map and don't using reverse anymore. But the C program is still 7x faster than the Haskell one. Here is the code of the Haskell program: main :: IO () main = do bmFile - openFileEx in.txt (BinaryMode ReadMode) bmString - hGetContents bmFile writeFile out.txt (map inc bmString) hClose bmFile inc :: Char - Char inc a = toEnum ((fromEnum a) + 1) And now the C program: #include stdio.h void main() { FILE *in, *out; char ch; in = fopen(in.txt,rb); out = fopen(out.txt,wb); while ( (ch=getc(in)) != EOF) putc(ch + 1,out); fclose(out); fclose(in); } As you noticed, the main idea here is to increment the character by one. Is the Haskell program now a nice translation of the C program? If it is (I think so...) why is the C program so much faster than it? Thanks again, -- Andre - Original Message - From: Albert Lai [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, October 18, 2001 9:42 PM Subject: Re: Working character by character in Haskell Andre W B Furtado [EMAIL PROTECTED] writes: [...] For example, suppose function doSomeStuffWith returns its own parameter. Using a 1.5MB file in this case, the Haskell program ends in almost 5 seconds, while the C program ends in less than 0.5 seconds... Is my Haskell program too bad implemented? (I'm using GHC 4.08-1 under a Windows 98 platform.) I indeed think that your Haskell program is inefficient and is not a translation of your C program. It reverses a huge string, which takes not only execution time but also garbage collection time and memory, which entails even more time for OS overhead and swapping out other things in the physical memory. (Many programmers complain my linear-time algorithm takes just 1 second on a 100M list, so why is it taking 5 seconds on a 200M list? They forget that because of issues such as cache locality and virtual memory, their computers do not scale.) I am wondering that if doSomeStuffWith is pure-functional, why are you writing and using copyFile instead of just using map? I mean: main :: IO () main = do bmFile - openFileEx in.txt (BinaryMode ReadMode) bmString - hGetContents bmFile writeFile out.txt (map doSomestuffWith bmString) hClose bmFile Because both hGetContents and map are lazy and use O(1) memory, this program behaves exactly as your C program plus occasional garbage collections that don't hurt too much. In partcular, the OS will see no difference (although the cache does). ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
Examples of some nice Haskell programs
There are some nice examples (binaries) of [Haskell + HOpenGL] programs at: www.cin.ufpe.br/~haskell/hopengl/examples.html I think they may be of interest to the community because they confirm that it's really possible to use Haskell in the development of complex, fast and robust graphic applications and games that involve animation and other interesting issues (texturing, lighting, checking and analyzing multiple user inputs, etc.) -- Andre ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
Re: Harmful spammers
Or alternatively just report it using Spamcop (http://spamcop.net) or some other reporting tool. Life is just too short to do this by hand every time you get spam. CAUCE (The Coalition Against Unsolicited Commercial Email) seems to me a nice alternative. Check www.cauce.org. On the Haskell mailing list we have a good compromise at the moment: the mailing list software's auto-filtering catches most of the spam (not allowing Bcc's to the list is a good one), and for any spam that gets through I just add it to the list of disallowed addresses. I asked recently if we should move to allowing subscriber-only posting, and I got a small number of responses, which were split roughly 50/50 so no action was taken. I think moving the list to allowing subscriber-only posting may cause some trouble to the subscribers too... (now there isn't a 50/50 split anymore ) ) Andre W B Furtado Recife - Brazil www.cin.ufpe.br/~haskell/hopengl/ ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
hGetContents bug?
If I open a file using openFile from the IO module (x - openFile foo.txt ReadMode) and convert it to a String via hGetContents (y - hGetContents x) and finally try to print the file on the screen (putStrLn y) I'll get a strange result if the file contains the character 1A-hexadecimal (or 26-decimal): all characters beyond this point won't be printed on the screen. If I use openFileEx (from IOExts module) rather than openFile, some characters will be printed after the 1A/26, but not all of them. I know this special character is related to EOF or something like that in Windows platforms, but is this the expected behavior of function hGetContents? (please reply to both the list AND me) Thanks, -- Andre Furtado ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
HOpenGL mailing list (?)
Is there any interest out there in creating a HOpenGL mailing list? Thanks, Andre W B Furtado
mouse HOpenGL
Does anybody know if (H)OpenGL can recognize a mouse movement even if the mouse cursor doesn't move? For example, suppose the mouse cursor is placed at the top left corner of the screen, and I movemy mouse to the top left corner direction. The mouse cursor won't move, although the mouse WAS moved. Unfortunately, the "motionFunc" and "passiveMotionFunc" are related to the new position of the mouse cursor, rather than the mouse movement... (in the Allegro library, this is solved by a thing called"mouse mickeys"). Thanks a lot, Andre W B Furtado
Profiles in GHC
Can anyone give me a brief explanation (or show me where in the web I can find some info) about using the profiling library in GHC? Is it avaible for Windows 98/NT? Thanks in advance, Andre W B Furtado
hbc
Why hbc did not succeeded? It is still possible to make it reach Haskell 98? Or why doesn't ghc uses some of its techniques to compile/run programs faster? Andre W B Furtado ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
Announcement: new HOpenGL Tutorial
Hello there. I've just released the first version ofmy HOpenGL (Haskell Open Graphics Library) tutorial. I hope it will encourage (and help) people around the world to use this great library/binding. I also would like to hear some feedback from you. You can visit the tutorial at: www.cin.ufpe.br/~haskell/hopengl/ Thank you, Andre W B Furtado
Re: running for long enough...
Actually, my version of the program would halt and print the SWITCHED! message if it changed from as to bs. But that's ok, I understood why this example won't work well in GHC, but isn't it too disappointing that the Haskell Concurrent basic example for beginners is not working well? Andre. - Original Message - From: Simon Marlow [EMAIL PROTECTED] To: Andre W B Furtado [EMAIL PROTECTED]; [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, April 25, 2001 7:57 AM Subject: RE: running for long enough... About the program below, someone (I think Simon Marlow) said that if I run it for long enough, I'll see as rather than bs. I would like to know for how long I will have to wait, since 2 hours were not enough to see it switching from bs to as. main = forkIO a b where a = putStrLn a a b = putStrLn b b Did you watch it continuously for two hours? It might have changed quicky to as and back again without you noticing. Watch it very carefully. mischevous grin :) But seriously, don't waste your time on this example. It just doesn't work too well with GHC, because of the contention between the two threads both trying to access standard output. Cheers, Simon ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
Concurrent Haskell (Ops...)
[I mean "CONCURRENT Haskell" rather than "Haskell DIRECT" in the last email. Sorry.] --- I am trying to create a program that prints interleaved sequences of'a'sand 'z's, using Haskell Direct (under GHC). I've tryied the following: import Concurrent main :: IO()main = let loop ch = putStr(ch) loop ch in forkIO (loop "a") loop "z" But this program prints only 'z's, and no 'a's.I was surprised by this, since GHC uses preemptive multitasking, not cooperative multitasking. Does anyone knows what's going wrong? Thanks, Andre WB Furtado
Concurrent Haskell
I am trying to create a program that prints interleaved sequences of'a'sand 'z's, using Haskell Direct (under GHC). I've tryied the following: import Concurrent main :: IO()main = let loop ch = putStr(ch) loop ch in forkIO (loop "a") loop "z" But this program prints only 'z's, and no 'a's.I was surprised by this, since GHC uses preemptive multitasking, not cooperative multitasking. Does anyone knows what's going wrong? Thanks, Andre W b Furtado
EOF marker
[Sorry if you are receiving this message for the second time] Hello there. I used the code below to read and print the bitmap file attached (bitmap.bmp), which cointains the character ASCII 26 (or 1A-hexa), that is used as an end of file marker in MS-DOS: import IOimport IOExts main :: IO ()main = dobmFile - openFileEx "bitmap.bmp" (BinaryMode ReadMode)charloop bmFile 0charloop :: Handle - Integer - IO ()charloop bmFile 70 = hClose bmFilecharloop bmFile n = dohSeek bmFile AbsoluteSeek na - hGetChar bmFileputStrLn [a]charloop bmFile (n+1) This program did not stuck at the special character ASCII 26, but if you change putStrLn by putStr, a strange thing will happen: after reading the ASCII 26 char, the program won't show characters anymore. Does anyone know why this happens? Thanks, Andre Furtado bitmap.bmp
Problem reading files...
Hello there. I was trying to read a bitmap file using hGetChar but I had a problem: if the file contains the byte 26-decimal (or 1A-hexa) the program aborts. Here you have the output: Fail: end of file Action: hGetChar Since hGetChar is implemented with getc, I created a similar program in C, using getc. This program written in C had no problems. Is this a haskell bug or does anyone know what'sgoing on? Thanks, Andre Furtado
Problem reading files...
Hello there. I was trying to read a bitmap file using hGetChar but I had a problem: if the file contains the byte 26-decimal (or 1A-hexa) the program aborts. Here you have the output: Fail: end of file Action: hGetChar Since hGetChar is implemented with getc, I created a similar program in C, using getc. This program written in C had no problems. Is this a haskell bug or does anyone know what'sgoing on? Thanks, Andre Furtado
Please help :)
Hi out there. I would really appreciate if anyone can tell me if there exists any haskell/hugs library that can PLAY midi files during the execution of a program. Unfortunately, the FRAN library is limitated to wav files... Pleasereply to [EMAIL PROTECTED]. Thanks a lot. Andre W B Furtado [EMAIL PROTECTED] Recife - Brazil
Please help :)
Hi out there. I would really appreciate if anyone can tell me if there exists any haskell/hugs library that can PLAY midi files during the execution of a program. Unfortunately, the FRAN library is limitated to wav files... Pleasereply to [EMAIL PROTECTED]. Thanks a lot. Andre W B Furtado [EMAIL PROTECTED] Recife - Brazil