Re: [GHC] #2999: yi darcs crashes ghc 6.11.20090201
#2999: yi darcs crashes ghc 6.11.20090201 +--- Reporter: wolverian|Owner: chak Type: bug | Status: closed Priority: normal |Milestone: Component: Compiler (Type checker) | Version: 6.11 Severity: normal | Resolution: fixed Keywords: xen, linux, yi | Difficulty: Unknown Testcase: | Os: Linux Architecture: x86_64 (amd64) | +--- Changes (by simonpj): * status: new = closed * difficulty: = Unknown * resolution: = fixed Old description: {{{Building yi-0.5.3... [ 1 of 107] Compiling System.FriendlyPath ( System/FriendlyPath.hs, dist/build/System/FriendlyPath.o ) [ 2 of 107] Compiling Shim.ProjectContent ( Shim/ProjectContent.hs, dist/build/Shim/ProjectContent.o ) WARNING: file simplCore/SimplCore.lhs line 545 Simplifier still going after 4 iterations; bailing out. Size = 4969 [ 3 of 107] Compiling Parser.Incremental ( Parser/Incremental.hs, dist/build/Parser/Incremental.o ) ghc: panic! (the 'impossible' happened) (GHC version 6.11.20090201 for x86_64-unknown-linux): ASSERT failed! file typecheck/TcTyFuns.lhs line 286 [Wanted t_a89i{tv} [tau] :: a{tv a89b} [sk] ~ a{tv a89a} [sk] - t_a89h{tv} [tau]] }}} New description: {{{ Building yi-0.5.3... [ 1 of 107] Compiling System.FriendlyPath ( System/FriendlyPath.hs, dist/build/System/FriendlyPath.o ) [ 2 of 107] Compiling Shim.ProjectContent ( Shim/ProjectContent.hs, dist/build/Shim/ProjectContent.o ) WARNING: file simplCore/SimplCore.lhs line 545 Simplifier still going after 4 iterations; bailing out. Size = 4969 [ 3 of 107] Compiling Parser.Incremental ( Parser/Incremental.hs, dist/build/Parser/Incremental.o ) ghc: panic! (the 'impossible' happened) (GHC version 6.11.20090201 for x86_64-unknown-linux): ASSERT failed! file typecheck/TcTyFuns.lhs line 286 [Wanted t_a89i{tv} [tau] :: a{tv a89b} [sk] ~ a{tv a89a} [sk] - t_a89h{tv} [tau]] }}} Comment: I've pushed a patch that makes it a warning only. That should resolve it. {{{ Wed Feb 4 08:38:00 GMT 2009 simo...@microsoft.com * Fix Trac #2999: change an ASSERT to a WARN }}} Simon -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2999#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2883: setitimer(ITIMER_VIRTUAL) is not always available
#2883: setitimer(ITIMER_VIRTUAL) is not always available -+-- Reporter: sthibaul |Owner: igloo Type: bug | Status: new Priority: high |Milestone: 6.10.2 Component: Compiler | Version: 6.8.2 Severity: normal| Resolution: Keywords:| Difficulty: Unknown Testcase:| Os: Unknown/Multiple Architecture: Unknown/Multiple | -+-- Changes (by simonmar): * owner: = igloo Comment: Patch looks ok to me - Ian, could you apply please? -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2883#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #3000: :break command should recognize also nonexported top level symbols in qualified IDs
#3000: :break command should recognize also nonexported top level symbols in qualified IDs --+- Reporter: phercek | Owner: Type: feature request | Status: new Priority: normal| Milestone: Component: GHCi |Version: 6.10.1 Severity: normal| Resolution: Keywords: debugger | Testcase: Os: Unknown/Multiple | Architecture: Unknown/Multiple --+- Comment (by phercek): Actually it would be cool if function names of the form'' ( '''conid .''' )* ( '''varid .''' )* '''varid''' '' could be recognized too.[[BR]] The identifer can have a sequence of '''varid'''s at the end. The idea is to identify a function which is defined in a where clause (or even a let clause (the first let function with given name)).[[BR]] E.g. for this source file: {{{ fn s = 'a' : add s where add = (++z) }}} it could look like ''':break Main.fn.add''' and it would be tha same as ''':break 2''' (breakpoint on 'add'). -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3000#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
[GHC] #3002: Documentation for Data.Map.unionWithKey makes reference to new and old values which have no meaning in a union.
#3002: Documentation for Data.Map.unionWithKey makes reference to new and old values which have no meaning in a union. -+-- Reporter: guest | Owner: Type: bug | Status: new Priority: normal| Component: libraries (other) Version: 6.10.1| Severity: trivial Keywords:| Testcase: Os: Unknown/Multiple | Architecture: Unknown/Multiple -+-- The example given for unionWithKey uses rather odd names new_value and old_value for the values in the two maps. Perhaps more appropriate names would be leftValue and rightValue. This has been commented on in #haskell that where the values come from is not clear. let f key new_value old_value = (show key) ++ : ++ new_value ++ | ++ old_value unionWithKey f (fromList [(5, a), (3, b)]) (fromList [(5, A), (7, C)]) == fromList [(3, b), (5, 5:a|A), (7, C)] -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3002 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2958: ghc-pkg describe is lying
#2958: ghc-pkg describe is lying -+-- Reporter: josef |Owner: Type: bug | Status: new Priority: normal|Milestone: Component: Build System | Version: 6.10.1 Severity: normal| Resolution: Keywords:| Difficulty: Unknown Testcase:| Os: Linux Architecture: Unknown/Multiple | -+-- Comment (by duncan): Yep, it's in the Cabal trac (it's been open a year): http://hackage.haskell.org/trac/hackage/ticket/236 I've marked it easy so hopefully some volunteer will pick it up. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2958#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2980: Data.Generics reports wrong package?
#2980: Data.Generics reports wrong package? --+- Reporter: Martijn|Owner: simonmar Type: bug| Status: new Priority: normal |Milestone: 6.10.2 Component: libraries (other) | Version: 6.10.1 Severity: normal | Resolution: Keywords: | Difficulty: Unknown Testcase: | Os: Windows Architecture: Unknown/Multiple | --+- Changes (by simonmar): * owner: = simonmar * difficulty: = Unknown * milestone: = 6.10.2 Comment: Is this better? {{{ Prelude import Data.Generics Could not find module `Data.Generics': it is a member of the hidden package `base-3.0.3.0' it is a member of the hidden package `syb' Use -v to see a list of the files searched for. }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2980#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2905: require -XGADTs in order to pattern-match GADTs
#2905: require -XGADTs in order to pattern-match GADTs +--- Reporter: guest|Owner: Type: proposal | Status: closed Priority: normal |Milestone: 6.12 branch Component: Compiler (Type checker) | Version: 6.10.1 Severity: normal | Resolution: fixed Keywords: | Difficulty: Unknown Testcase: | Os: Unknown/Multiple Architecture: Unknown/Multiple | +--- Changes (by simonpj): * status: new = closed * resolution: = fixed Comment: Done {{{ Wed Feb 4 15:09:19 GMT 2009 simo...@microsoft.com * Check -XGADTs in (a) type family decls (b) pattern matches }}} Don't merge to the branch; it's a small change in behaviour. Simon -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2905#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2994: give better error messages for instance declarations with the wrong number of parameters
#2994: give better error messages for instance declarations with the wrong number of parameters +--- Reporter: rwbarton |Owner: Type: feature request | Status: closed Priority: normal |Milestone: Component: Compiler | Version: 6.11 Severity: normal | Resolution: fixed Keywords: | Difficulty: Unknown Testcase: typecheck/should_fail/T2994 | Os: Unknown/Multiple Architecture: Unknown/Multiple | +--- Changes (by simonpj): * testcase: = typecheck/should_fail/T2994 * difficulty: = Unknown * status: new = closed * resolution: = fixed Comment: Your wish is my command. I spent way too long on this, but it was fun. {{{ Wed Feb 4 15:07:36 GMT 2009 simo...@microsoft.com * Improve error reports for kind checking (Trac #2994) }}} Let's not merge to 6.10. It's an unforced change, and quite a lot of lines of code are touched. Simon -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2994#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2678: hLookAhead + hSetBuffering = unsupported operation (Illegal seek)
#2678: hLookAhead + hSetBuffering = unsupported operation (Illegal seek) -+-- Reporter: igloo |Owner: simonmar Type: bug | Status: new Priority: normal|Milestone: 6.12 branch Component: libraries/base| Version: 6.8.3 Severity: normal| Resolution: Keywords:| Difficulty: Unknown Testcase:| Os: Unknown/Multiple Architecture: Unknown/Multiple | -+-- Changes (by simonmar): * owner: = simonmar * milestone: 6.10.2 = 6.12 branch Comment: This is fixed in the unicode IO library; bumping to 6.12. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2678#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2808: createDirectoryIfMissing should be atomic
#2808: createDirectoryIfMissing should be atomic +--- Reporter: EricKow |Owner: igloo Type: merge| Status: new Priority: normal |Milestone: 6.10.2 Component: libraries/directory | Version: 6.10.1 Severity: normal | Resolution: Keywords: | Difficulty: Unknown Testcase: | Os: Unknown/Multiple Architecture: Unknown/Multiple | +--- Changes (by simonmar): * owner: simonmar = igloo * type: bug = merge Comment: See also #2924, uncovered while testing this patch. To merge: {{{ Thu Dec 18 14:47:04 GMT Standard Time 2008 Duncan Coutts dun...@haskell.org * Alternative implementation of createDirectoryIfMissing Mon Dec 22 16:41:05 GMT Standard Time 2008 Duncan Coutts dun...@haskell.org * Fix createDirectoryIfMissing to not throw if the dir got deleted When we call createDirectory and some file system object already exists we have a problem. We need to distinguish if it is a file that already exists or if it is a directory because in the latter case it is not an error. Previously we called doesDirectoryExist however that does not distinguish the dir not existing (due to another thread deleting it) and an ordinary file existing. We now use withFileStatus to throw the original AlreadyExistsError only if a non-directory object exists. So now the only time we should get a spurious exception is if another thread deletes the directory and puts a file in its place between our call to createDirectory and withFileStatus. It should now be safe to race createDirectoryIfMissing with itself or deleteDirectoryRecursive. Wed Feb 4 16:33:19 GMT Standard Time 2009 Simon Marlow marlo...@gmail.com * fix this test for the new version of createDirectoryIfMissing (#2808) - add another race test, for two threads both doing create;cleanup - ignore isDoesNotExistErrors in create }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2808#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2870: User signals are not blocked before 'fork' in runInteractiveProcess
#2870: User signals are not blocked before 'fork' in runInteractiveProcess ---+ Reporter: dsh |Owner: simonmar Type: bug | Status: new Priority: high|Milestone: 6.10.2 Component: libraries/process | Version: 6.10.1 Severity: normal | Resolution: Keywords: threaded runInteractiveProcess | Difficulty: Unknown Testcase: | Os: Unknown/Multiple Architecture: x86_64 (amd64) | ---+ Changes (by simonmar): * owner: = simonmar -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2870#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2954: System.Process.terminateProcess sends SIGTERM rather than SIGKILL on unix
#2954: System.Process.terminateProcess sends SIGTERM rather than SIGKILL on unix --+- Reporter: guest |Owner: simonmar Type: bug| Status: new Priority: normal |Milestone: 6.10.2 Component: libraries/process | Version: 6.10.1 Severity: normal | Resolution: Keywords: | Difficulty: Unknown Testcase: | Os: Unknown/Multiple Architecture: Unknown/Multiple | --+- Changes (by simonmar): * owner: = simonmar * difficulty: = Unknown * milestone: = 6.10.2 Comment: We'll fix the docs for 6.10.2, and add a killProcess for 6.12. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2954#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2958: ghc-pkg describe is lying
#2958: ghc-pkg describe is lying -+-- Reporter: josef |Owner: Type: bug | Status: new Priority: normal|Milestone: Component: Build System | Version: 6.10.1 Severity: normal| Resolution: Keywords:| Difficulty: Unknown Testcase:| Os: Linux Architecture: Unknown/Multiple | -+-- Changes (by simonmar): * cc: duncan.cou...@worc.ox.ac.uk (added) * difficulty: = Unknown Comment: Duncan - is this really a bug in Cabal/cabal-install? If so could you move it to the appropriate Trac? -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2958#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2958: ghc-pkg describe is lying
#2958: ghc-pkg describe is lying -+-- Reporter: josef |Owner: Type: bug | Status: closed Priority: normal|Milestone: Component: Build System | Version: 6.10.1 Severity: normal| Resolution: invalid Keywords:| Difficulty: Unknown Testcase:| Os: Linux Architecture: Unknown/Multiple | -+-- Changes (by simonmar): * status: new = closed * resolution: = invalid -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2958#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: Ready for testing: Unicode support for Handle I/O
Max Vasin wrote: Wouldn't it be more correct to separate binary IO, which return [Word8] (or ByteString) and text IO which return [Char] and deal with text encoding? IIRC that was done in Bulat Ziganshin's streams library. That's exactly what I meant. Text IO could be then implemented on top of binary IO. Would it be possible to envision a solution that enables composition of IO low level strategies vs binary - text conversion strategies? Pao ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Ready for testing: Unicode support for Handle I/O
Simon Marlow wrote: The only change to the existing behaviour is that by default, text IO is done in the prevailing encoding of the system. Handles created by openBinaryFile use the Latin-1 encoding, as do Handles placed in binary mode using hSetBinaryMode. wouldn't be semantically correct for a binary handle to return [Word8]? also switching from text to binary (hSetBinaryMode) doesn't seem natural I understand that this has heavy consequences... Pao ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Temporarily overriding Data.Generic
Sorry for those who receive this who have already gotten it from haskell-cafe. --- Hi I'm currently working on hacking Data.Generics for my master thesis. I'm basically trying to find out whether it can be made any faster using e.g. rewrite rules. The problem I'm having is that I need an easy way to import my own modified version of Data.Generics (currently located in the same directory as my testing program) without unregistering or hiding syb-0.1.0.0 as base seems to depend on it. I've read the GHC user manual trying to find nice ways to do this using a bunch of different parameters to ghc, but I can't figure it out. Does anyone here know? Any help appreciated, Deniz ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Temporarily overriding Data.Generic
On Thu, 2009-02-05 at 00:11 +0100, Deniz Dogan wrote: I'm currently working on hacking Data.Generics for my master thesis. I'm basically trying to find out whether it can be made any faster using e.g. rewrite rules. The problem I'm having is that I need an easy way to import my own modified version of Data.Generics (currently located in the same directory as my testing program) without unregistering or hiding syb-0.1.0.0 as base seems to depend on it. This should just work. If ./Data/Generics.hs exists in / relative to the current directory then by default that overrides the module of the same name from the syb package. There's clearly some specific problem you're hitting, can you tell us more about it? When you say currently located in the same directory as my testing program do you mean you've got Generics.hs in the same dir as your Test.hs module or do you mean you've got ./Test.hs and ./Data/Generics.hs, ie in a subdirectory? The problems you're likely to run into will be with other code that already uses the syb:Data.Generics module as the types are necessarily not substitutable for each other. I've read the GHC user manual trying to find nice ways to do this using a bunch of different parameters to ghc, but I can't figure it out. Does anyone here know? The command line options for controlling the module search path are basically the -package flags and the -i flag. The default if you don't say anything is -i. meaning look first in the current directory. Duncan ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Temporarily overriding Data.Generic
Hi Deniz, On Thu, Feb 5, 2009 at 00:11, Deniz Dogan deniz.a.m.do...@gmail.com wrote: Sorry for those who receive this who have already gotten it from haskell-cafe. --- Hi I'm currently working on hacking Data.Generics for my master thesis. I'm basically trying to find out whether it can be made any faster using e.g. rewrite rules. Great! Please let us know of the results when you have them :-) The problem I'm having is that I need an easy way to import my own modified version of Data.Generics (currently located in the same directory as my testing program) without unregistering or hiding syb-0.1.0.0 as base seems to depend on it. I've read the GHC user manual trying to find nice ways to do this using a bunch of different parameters to ghc, but I can't figure it out. Does anyone here know? I've had my own problems while developing a successor version of the syb package. For starters, cabal fails to install the package: cabal install Resolving dependencies... cabal: dependencies conflict: base-3.0.3.0 requires syb ==0.1.0.0 however syb-0.1.0.0 was excluded because syb-0.2.0.0 was selected instead syb-0.1.0.0 was excluded because of the top level dependency syb ==0.2.0.0 Note that this package explicitly requires base = 4.0. Anyway, runghc Setup.hs install does it, though. However, after having it installed I can't use it, getting this when any module imports Data.Generics: Bad interface file: C:\Program Files (x86)\Haskell\syb-0.2.0.0\ghc-6.10.1\Data\Generics.hi Something is amiss; requested module syb:Data.Generics differs from name found in the interface file syb-0.2.0.0:Data.Generics Failed, modules loaded: none. I talked about this on IRC before and remember this might have had something to do with syb having been unversioned in the release of GHC 6.10.1. But I hope someone can clarify this better... Cheers, Pedro Any help appreciated, Deniz ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
[Haskell] Re: HOC
On Sat, 31 Jan 2009 21:34:34 +0100, Thomas Davie tom.da...@gmail.com wrote: I noticed recently that HOC has moved over to google code, and seems a little more active than it was before. Is there a mailing list where I can talk to other users and get myself kick started, or is it a case of just using the standard Haskell ones? According to the HOC: Support site (see http://hoc.sourceforge.net/support.html), There are four mailing lists where you can contact the HOC developers and other users: hoc-announce Announcements of HOC releases and related tools (low-traffic) hoc-users General HOC discussions hoc-devel HOC developer implementation discussions hoc-cvsCVS commit log messages The above-mentioned links point to the following sites: hoc-announce Info Page https://lists.sourceforge.net/lists/listinfo/hoc-announce hoc-users Info Page https://lists.sourceforge.net/lists/listinfo/hoc-users hoc-devel Info Page https://lists.sourceforge.net/lists/listinfo/hoc-devel hoc-cvs Info Page https://lists.sourceforge.net/lists/listinfo/hoc-cvs You can subscribe to the above-mentioned mailing lists at the above-indicated sites. Hope this helps. Enjoy! -- Benjamin L. Russell -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 Furuike ya, kawazu tobikomu mizu no oto. -- Matsuo Basho^ ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
Re: [Haskell] Re: HOC
On 4 Feb 2009, at 13:33, Benjamin L.Russell wrote: On Sat, 31 Jan 2009 21:34:34 +0100, Thomas Davie tom.da...@gmail.com wrote: I noticed recently that HOC has moved over to google code, and seems a little more active than it was before. Is there a mailing list where I can talk to other users and get myself kick started, or is it a case of just using the standard Haskell ones? According to the HOC: Support site (see http://hoc.sourceforge.net/support.html), There are four mailing lists where you can contact the HOC developers and other users: hoc-announce Announcements of HOC releases and related tools (low-traffic) hoc-users General HOC discussions hoc-devel HOC developer implementation discussions hoc-cvs CVS commit log messages The above-mentioned links point to the following sites: hoc-announce Info Page https://lists.sourceforge.net/lists/listinfo/hoc-announce hoc-users Info Page https://lists.sourceforge.net/lists/listinfo/hoc-users hoc-devel Info Page https://lists.sourceforge.net/lists/listinfo/hoc-devel hoc-cvs Info Page https://lists.sourceforge.net/lists/listinfo/hoc-cvs You can subscribe to the above-mentioned mailing lists at the above-indicated sites. Ah, neat – I guess they have a lot of updating to do having moved away from Sourceforge. Bob___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
[Haskell] Postdoc Positions at the CLIP group, Spain
** Application deadline 13th of February (for the 5 years position) and 18th of February (for the 3 years position) ** The CLIP (Computational Logic, Implementation and Parallelism) group is searching for candidates for postdoctoral research positions in the research areas in which the group is involved. A PhD in Computer Science or related areas is required. These are research positions (no teaching is compulsory, although it is allowed) and renewable for up to 3 or 5 years. The initial salary (for the 5 year positions) is 44370 Euros/year plus an initial budget of 15000 Euros for travel and other expenses during the first year. Knowledge of Spanish is not a prerequisite for application and candidates can be of any nationality. The working language at the CLIP group for research is English. The number of positions available depends on the quality of the applicants. The positions are co-funded by the Spanish Ministry of Science and Technology and the Technical University of Madrid within the Ramon y Cajal and Juan de la Cierva programs. Selection Process: Interested applicants should send their c.v. and a description of their researchinterests tothe CLIP groupat hats-gra...@clip.dia.fi.upm.es. The CLIP group will perform a pre-selection of the best applicants based on their scientific merits and the relevance of their research interests and experience to the research activities of the group. The CLIP group will then assist the pre-selected candidates in accomplishing all required steps to present the required documentation for the final evaluation step. The applications, will then be sent to the Spanish Ministry of Science and Technology which performs the final selection. The details of this step are described here. http://clip.dia.fi.upm.es/Job_Openings/RyC2009.html More details on the CLIP group, publications, projects, and research areas of interest can be found at our WWW site (see e.g. the group description and the listing of research topics and publications): http://clip.dia.fi.upm.es/ For more information on any of the above, please contact hats-gra...@clip.dia.fi.upm.es -- ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
[Haskell] ANN: Happstack 0.1 Released!
Hello Haskell Universe, I just wanted to inform you that the Happstack project has shipped it's 0.1 release. For those of you who don't know, Happstack is the successor for the HAppS project. More details on the release can be found at http://blog.happstack.com/2009/02/03/happstack-01-released . Thanks for your time, Matthew Elder -- Need somewhere to put your code? http://patch-tag.com Want to build a webapp? http://happstack.com -- Need somewhere to put your code? http://patch-tag.com Want to build a webapp? http://happstack.com ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
[Haskell] Call for Papers: 2nd International Conference on Software Language Engineering
___ Call for Papers - SLE 2009 2nd International Conference on Software Language Engineering http://planet-sl.org/sle2009 Denver, Colorado, October 5-6, 2009 ___ Co-located with 12th International Conference on Model-Driven Engineering Languages and Systems (MODELS 2009) and 8th International Conference on Generative Programming and Component Engineering (GPCE 2009) Proceedings will be published in the LNCS series (subject to Springer's approval). The 2nd International Conference on Software Language Engineering (SLE) is devoted to topics related to artificial languages in software engineering. SLE's foremost mission is to encourage and organize communication between communities that have traditionally looked at software languages from different, more specialized, and yet complementary perspectives. SLE emphasizes the fundamental notion of languages as opposed to any realization in specific technical spaces. SLE 2009 will be co-located with the 12th IEEE/ACM International Conference on Model-Driven Engineering Languages and Systems (MODELS 2009). Scope - The term 'software language' comprises all sorts of artificial languages used in software development including general-purpose programming languages, domain-specific languages, modeling and meta-modeling languages, data models, and ontologies. Used in its broadest sense, examples include modeling languages such as UML-based and domain-specific modeling languages, business process modeling languages, and web application modeling languages. The term 'software language' also comprises APIs and collections of design patterns that are implicitly defined languages. Software language engineering is the application of a systematic, disciplined, quantifiable approach to the development, use, and maintenance of these languages. Thus, the SLE conference is concerned with all phases of the life cycle of software languages; these include the design, implementation, documentation, testing, deployment, evolution, recovery, and retirement of languages. Of special interest are tools, techniques, methods and formalisms that support these activities. In particular, tools are often based on or even automatically generated from a formal description of the language. Hence, of special interest is the treatment of language descriptions as software artifacts, akin to programs - while paying attention to the special status of language descriptions, subject to tailored engineering principles and methods for modularization, refactoring, refinement, composition, versioning, co-evolution, and analysis. Topics of interest -- We solicit high-quality contributions in the area of SLE ranging from theoretical and conceptual contributions to tools, techniques and frameworks that support the aforementioned life cycle activities. Some examples of tools, techniques, applications, and problems are listed below in order to clarify the types of contributions sought by SLE. * Formalisms used in designing and specifying languages and tools that analyze such language descriptions. * Language implementation techniques, grammar-based and metamodel-based. * Program and model transformation tools. * Composition, integration, and mapping tools for managing different aspects of software languages or different manifestations of a given language. * Language evolution. * Approaches to the elicitation, specification, and verification of requirements for software languages. * Language development frameworks, methodologies, techniques, best practices, and tools for the broader language life cycle covering phases such as analysis, testing, and documentation. * Design challenges in SLE. * Applications of languages including innovative domain-specific languages or little languages Do note that this list is not exclusive and many examples of tools, techniques, approaches have not been listed. Please visit the conference web site to see a more elaborate description of the topics of interests. The program committee chairs encourage potential contributors to contact them with questions about the scope and topics of interest of SLE. Paper Submission We solicit the following types of papers: * Research papers. These should report a substantial research contribution to SLE and/or successful application of SLE techniques. Full paper submissions must not exceed 20 pages. * Short papers. These may describe interesting or thought-provoking concepts that are not yet fully developed or evaluated, make an initial contribution to challenging research issues in SLE, or discuss and analyze controversial issues in the field. These papers must not exceed 10 pages. * Tool demonstration papers. Because
Re: [Haskell-cafe] Re: ANN: #haskell-in-depth IRC channel
On Wed, Feb 4, 2009 at 5:32 AM, Benjamin L. Russell dekudekup...@yahoo.com wrote: If neither #haskell nor #haskell-in-depth is appropriate, perhaps they would feel more comfortable in a Haskell-beginners-specific channel? The danger with that is the only people who go there are beginners looking for advice. Without advisers also, it would quickly wither. How has the beginners' mailing list worked out, in this regard? At least with a ML it's possible to set aside some part of the day to answering questions... the same is not really possible for 5-hour-old conversations on IRC. Cheers, D ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Purely funcional LU decomposition
On Wed, Feb 4, 2009 at 04:42, Thomas Davie tom.da...@gmail.com wrote: Shinyness indeed – a quick note though, as ghc doesn't support dynamic linking of Haskell code, the above is equivalent to the GPL. I always use LGPL. Anyway, I will keep it that way, as I still have hopes on dynamic linking Haskell becoming a reality Would be lovely if you packaged this up and stuck it on Hackage :) I may do that when I am finished with all the other stuff. I am building a (very primitive) circuit simulator using Haskell. It is a toy I am doing just to learn Haskell (until now I learned how to use Arrays and Parsec)... Bob -- Rafael Gustavo da Cunha Pereira Pinto Electronic Engineer, MSc. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: ANN: #haskell-in-depth IRC channel
On Wed, 4 Feb 2009 09:35:03 +, Dougal Stanton ith...@gmail.com wrote: On Wed, Feb 4, 2009 at 5:32 AM, Benjamin L. Russell dekudekup...@yahoo.com wrote: If neither #haskell nor #haskell-in-depth is appropriate, perhaps they would feel more comfortable in a Haskell-beginners-specific channel? The danger with that is the only people who go there are beginners looking for advice. Without advisers also, it would quickly wither. How has the beginners' mailing list worked out, in this regard? At least with a ML it's possible to set aside some part of the day to answering questions... the same is not really possible for 5-hour-old conversations on IRC. It seems to have been working out quite well. Last month, there were a total of 57 threads, including 192 messages in Haskell-Beginners. Most questions get responses within a few minutes. You can see the archives for last month at http://www.haskell.org/pipermail/beginners/2009-January/thread.html . -- Benjamin L. Russell -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 Furuike ya, kawazu tobikomu mizu no oto. -- Matsuo Basho^ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: UrlDisp, a friendly URL dispatching library
Hello, I would like to announce the first release of UrlDisp. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/UrlDisp It's a small library for URL dispatching (aka routing). Right now it works with CGI, and should be compatible with FastCGI as well (not tested). Happstack compatibility is planned. Documentation and usage examples are available at HaskellWiki: http://www.haskell.org/haskellwiki/UrlDisp Thanks to Sterling Clover for his HVAC; this is where inspiration came from. Cheers, Artyom Shalkhakov. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Ready for testing: Unicode support for Handle I/O
Max Vasin wrote: Wouldn't it be more correct to separate binary IO, which return [Word8] (or ByteString) and text IO which return [Char] and deal with text encoding? IIRC that was done in Bulat Ziganshin's streams library. That's exactly what I meant. Text IO could be then implemented on top of binary IO. Would it be possible to envision a solution that enables composition of IO low level strategies vs binary - text conversion strategies? Pao ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Open unqualified imports
Ian Lynagh wrote: On Fri, Jan 16, 2009 at 06:42:46AM -0800, eyal.lo...@gmail.com wrote: Closed-unqualified import: import Data.Map(Map, lookup) One problem with this style is that you can get lots of conflicts from your VCS if you have multiple people working on the same module. Right; in GHC we actively discourage the use of explict import lists (or closed-unqualified import to use the terminology of this thread). http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Imports I find that the reasons not to use explicit import lists outweigh the reasons to use them, at least for code that I'm working on (rather than just reading). Ideally the import lists would be maintained automatically by an IDE, and would be intelligently handled by the VCS. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Ready for testing: Unicode support for Handle I/O
On Wed, 2009-02-04 at 13:31 +, Simon Marlow wrote: Duncan Coutts wrote: On Tue, 2009-02-03 at 11:03 -0600, John Goerzen wrote: Will there also be something to handle the UTF-16 BOM marker? I'm not sure what the best API for that is, since it may or may not be present, but it should be considered -- and could perhaps help autodetect encoding. I think someone else mentioned this already, but utf16 (as opposed to utf16be/le) will use the BOM if its present. I'm not quite sure what happens when you switch encoding, presumably it'll accept and consider a BOM at that point. Yes; the utf16 and utf32 encodings accept a BOM (and generate a BOM in write mode). This caused interesting bugs when doing re-decoding after switching encodings, because the BOM constitutes state in the decoder, which means that decoding is not necessarily repeatable unless you save the state (which iconv doesn't provide a way to do). Are there other encodings that have this kind of state? If so, then they might be restricted to NoBuffering at least when switching encodings. Yes, I believe there are some Asian encodings that are stateful. Duncan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Automation and COM
Hi, has anyone yet been using Sigbjorns COM package? Sigbjorn hasn't had the time yet to gather some docs on how to use it, so I wonder if someone else could post some examples on how to use it. I'm asking because I need to do some COM stuff with excel, which I know how to do in another language, but can't seem to get it even started with haskell. Any help appreciated. Günther ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Ready for testing: Unicode support for Handle I/O
Simon Marlow wrote: The only change to the existing behaviour is that by default, text IO is done in the prevailing encoding of the system. Handles created by openBinaryFile use the Latin-1 encoding, as do Handles placed in binary mode using hSetBinaryMode. wouldn't be semantically correct for a binary handle to return [Word8]? also switching from text to binary (hSetBinaryMode) doesn't seem natural I understand that this has heavy consequences... Pao ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Purely funcional LU decomposition
Matt's code is pretty comprehensive. His LU implementation is much cleaner, essentially because he used the ijk format, while I used the kij. I'll take a look and e-mail him eventually. Thanks! On Tue, Feb 3, 2009 at 23:26, Paulo Tanimoto tanim...@arizona.edu wrote: Hi Rafael, 2009/2/3 Rafael Gustavo da Cunha Pereira Pinto rafaelgcpp.li...@gmail.com : Hello folks After a discussion on whether is possible to compile hmatrix in Windows, I decided to go crazy and do a LU decomposition entirely in Haskell... At first I thought it would be necessary to use a mutable or monadic version of Array, but then I figured out it is a purely interactive process. I am releasing this code fragment as LGPL. Pretty cool, thanks for releasing this into the wild. I remember looking into this about a year ago. By the way, have you seen Matt's DSP library? http://haskelldsp.sourceforge.net/ He's got LU and others in there, if my memory serves me. The last release seems to be 2003, so it might be worth emailing him to see what happened and if he has plans for the future. Regards, Paulo ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Rafael Gustavo da Cunha Pereira Pinto Electronic Engineer, MSc. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] about integer and float operations
Hi. During some experiments with Python and Haskell I found some important differences about how some integer and float operations are implemented. The first difference is about a `mod` b, when a and b are Float types. Python use the fmod function, and it also implement divmod; Haskell seems to lack support for this operation. The second difference is about the division of two integers. Consider this Python code: from __future__ import division def fac(n): ... return reduce(lambda a, b: a * (b + 1), xrange(n), 1) ... float(fac(777)) Traceback (most recent call last): File stdin, line 1, in module OverflowError: long int too large to convert to float fac(777) / fac(777) 1.0 Here CPython does not convert the two integers to float before to divide them, but make use of a special algorithm. GHC, instead, returns NaN I don't know if the implementations of divMod and true integer division in CPython are robust, but there is some important reason why these operations are not supported in Haskell? Thanks Manlio Perillo ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] pure crisis :)
Bulat Ziganshin wrote: Hello haskell-cafe, pure functional denotation for crisis: (_|_) Buy ⊥, sell ⊤! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: ANN: diagrams 0.2
On Sun, Feb 1, 2009 at 1:37 AM, John MacFarlane j...@berkeley.edu wrote: Not too hard, I think. Here's code for something similar (for graphviz diagrams), derived from plugins/DotPlugin.hs in SVN pandoc. transform :: Block - IO Block transform (CodeBlock (id, classes, namevals) contents) | dot `elem` classes = do let (name, outfile) = case lookup name namevals of Just fn - ([Str fn], fn ++ .png) Nothing - ([], uniqueName contents ++ .png) result - readProcess dot [-Tpng] contents writeFile outfile result return $ Para [Image name (outfile, )] transform x = return x -- | Generate a unique filename given the file's contents. uniqueName :: String - String uniqueName = showDigest . sha1 . fromString The 'transform' function will transform delimited code blocks such as ~~~ {.dot name=diagram1} digraph G {Hello-World} ~~~ into images generated by running the contents through graphviz's dot. To lift this into a transformation of Pandoc documents, you can use syb: convertGraphviz :: Pandoc - IO Pandoc convertGraphviz = everywhereM (mkM transform) With minimal modifications, the same technique should work for diagrams... Best, John This certainly does seem reasonable, but I don't think the sandboxing/interpretation question is addressed. In your GraphViz example, you dump out to the 'dot' executable and it does things which you read back. But with Diagrams, we're interested in running arbitrary Haskell code - that's what makes Diagrams so useful, that we can exploit the full power of Haskell in our expressions. Now, to implement it, I would probably say to myself, well, we'll create a temporary file, we'll write some basic imports into it, then we'll write the user's expression into it as the definition of a function 'foo', and main will be defined as 'main = renderFile foo'. Then we use 'runhaskell' on the temporary file to create the picture, delete the temp file, and bob's your uncle. Except of course there's nothing to prevent DoS attacks or other exploits in the arbitrary code. So do we accept this and say that this is a plugin one uses at one's own risk? -- gwern ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Elegant powerful replacement for CSS
You might be interested in some of the recent work by Leo Meyerovich et al. at Berkeley. They wanted to parallelize CSS processing, and found they had to construct a simplified, orthogonal version of CSS and express their algorithms in terms of that subset. This is very much work in progress, but there's a description and pointer to talk slides here: http://www.eecs.berkeley.edu/~lmeyerov/#projects Presumably their forthcoming HotPar paper will yield more details. -Jan-Willem Maessen On Feb 3, 2009, at 2:39 PM, Conal Elliott wrote: [Spin-off from the haskell-cafe discussion on functional/ denotational GUI toolkits] I've been wondering for a while now what a well-designed alternative to CSS could be, where well-designed would mean consistent, composable, orthogonal, functional, based on an elegantly compelling semantic model (denotational). - Conal ___ 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] Ready for testing: Unicode support for Handle I/O
Duncan Coutts wrote: On Tue, 2009-02-03 at 11:03 -0600, John Goerzen wrote: Will there also be something to handle the UTF-16 BOM marker? I'm not sure what the best API for that is, since it may or may not be present, but it should be considered -- and could perhaps help autodetect encoding. I think someone else mentioned this already, but utf16 (as opposed to utf16be/le) will use the BOM if its present. I'm not quite sure what happens when you switch encoding, presumably it'll accept and consider a BOM at that point. Yes; the utf16 and utf32 encodings accept a BOM (and generate a BOM in write mode). This caused interesting bugs when doing re-decoding after switching encodings, because the BOM constitutes state in the decoder, which means that decoding is not necessarily repeatable unless you save the state (which iconv doesn't provide a way to do). Are there other encodings that have this kind of state? If so, then they might be restricted to NoBuffering at least when switching encodings. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Elegant powerful replacement for CSS
Conal Elliott wrote: I've been wondering for a while now what a well-designed alternative to CSS could be, where well-designed would mean consistent, composable, orthogonal, functional, based on an elegantly compelling semantic model (denotational). Me too. I think there are several aspects 1. Layout description, i.e. sidebar `besides` (content `above` footer) 2. Visual properties, like red borders or blue backgrounds. 3. Applying the style sheet to the document, i.e. to the semantic markup. Current CSS is very weak at point 1, a clean box model in the spirit of TeX or Lout http://en.wikipedia.org/wiki/Lout is preferable. Point 2 is solved fairly well by current CSS. Background and border colors are primitives, after all; so it boils down to a list of attributes. But a higher-order language is preferably as well, for example to capture common combinations in a variable instead of having to cascade it. Concerning point 3, CSS does ok for a hard-coded and specific output medium. Ideally, one and the same content could be visualized for different output media like web browsers (resizable), printer (PDF quality) or an overhead projector. I imagine some kind of macro language like LaTeX, Lout or XML with macros; but none of these examples are elegant enough for my taste. It should be possible to embed other languages for instance for mathematical formulas, highlighted source code, etc. I imagine that 3 is compiled to some kind of CSS bytecode consisting of 2 and 1. Regards, apfelmus -- http://apfelmus.nfshost.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Ready for testing: Unicode support for Handle I/O
Paolo Losi пишет: wouldn't be semantically correct for a binary handle to return [Word8]? Wouldn't it be more correct to separate binary IO, which return [Word8] (or ByteString) and text IO which return [Char] and deal with text encoding? IIRC that was done in Bulat Ziganshin's streams library. -- WBR, Max Vasin. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Ready for testing: Unicode support for Handle I/O
Paolo Losi wrote: Simon Marlow wrote: The only change to the existing behaviour is that by default, text IO is done in the prevailing encoding of the system. Handles created by openBinaryFile use the Latin-1 encoding, as do Handles placed in binary mode using hSetBinaryMode. wouldn't be semantically correct for a binary handle to return [Word8]? also switching from text to binary (hSetBinaryMode) doesn't seem natural Yes, and as I said in the original message I haven't done the binary/text separation (yet). I agree it's something that should be done, and the current API leaves a lot to be desired, but the main goal was to get Unicode text I/O working without breaking any existing code (or at least without breaking any code that isn't already morally broken :-). As a side-effect I managed to do some useful refactoring which should make further separation of layers much easier. So you should think of this as a step in the right direction, with further steps to come in the future. A while back there was a lot of activity on developing new IO library designs. There are a bunch of these: Bulat's streams library, a variant of Bulat's done by Takano Akio, John Goerzen's HVIO, and I had a prototype streams library too. The problem is, it's a lot of work to make a complete IO library implementation, agree on the API, and migrate over from the old one. And while we're on the subject of redesigning IO libraries, it's not at all clear that the imperative approach is the right one either. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Monad explanation
I put up a small Monad explanation (I wouldn't quite call it a tutorial): http://www.thenewsh.com/~newsham/haskell/monad.html The intent here is to is to have a short description of what a Monad is that is approachable by Haskell beginners or non- Haskell programmers who are looking for an intuitive definition but may not yet have the background or the inclination to jump into full tutorial to tackle the subject. Tim Newsham http://www.thenewsh.com/~newsham/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Monad explanation
This is nice and simple. My only concern is I'm not sure there's enough of a distinction between Monad and State Monad. That is, I'm not sure it's clear enough that the way you're binding the small programs together in the initial example is only one way you could bind them together, and thus it's only one instance of Monad. On Wed, Feb 4, 2009 at 12:41 PM, Tim Newsham news...@lava.net wrote: I put up a small Monad explanation (I wouldn't quite call it a tutorial): http://www.thenewsh.com/~newsham/haskell/monad.html The intent here is to is to have a short description of what a Monad is that is approachable by Haskell beginners or non- Haskell programmers who are looking for an intuitive definition but may not yet have the background or the inclination to jump into full tutorial to tackle the subject. Tim Newsham http://www.thenewsh.com/~newsham/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Happstack 0.1 Released!
Hello Haskell Cafe, I just wanted to inform you that the Happstack project has shipped it's 0.1 release. For those of you who don't know, Happstack is the successor for the HAppS project. More details on the release can be found at http://blog.happstack.com/2009/02/03/happstack-01-released . Thanks for your time, Matthew Elder -- Need somewhere to put your code? http://patch-tag.com Want to build a webapp? http://happstack.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] about integer and float operations
Manlio Perillo wrote: The first difference is about a `mod` b, when a and b are Float types. Python use the fmod function, and it also implement divmod; Haskell seems to lack support for this operation. Yes, Haskell does not implement the full IEEE. There are differing opinions about that: some say we should add it all in, and some say we should take it all out. Floating point is ugly, but useful. It seems that enough of IEEE is implemented for the vast majority of applications, so far. The second difference is about the division of two integers. fac(777) / fac(777) 1.0 Here CPython does not convert the two integers to float before to divide them, but make use of a special algorithm. GHC, instead, returns NaN No, actually here Haskell shines. Perhaps this GHCi session will illuminate the issue for you: Prelude let fac n = product [2..n] Prelude fac 777 `div` fac 777 1 Prelude fac 777 / fac 777 NaN In Haskell, the various integral and floating point types are completely separate. The literal 777 is overloaded - its type is 777 :: Num a = a so it can be used for both integral and floating point types. But the division operators are separate: div :: Integral a = a - a - a (/) :: Fractional a = a - a - a So when you use 777 together with /, the 777 is interpreted as a Fractional (defaulting to Double). And when you use it with div, the 777 is interpreted as an Integral (defaulting to Integer). Hope this helps, Yitz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Purely funcional LU decomposition
2009/2/3 Rafael Gustavo da Cunha Pereira Pinto rafaelgcpp.li...@gmail.com: After a discussion on whether is possible to compile hmatrix in Windows, I decided to go crazy and do a LU decomposition entirely in Haskell... import Data.Array.IArray ... e_an i j=a!(i,j)-(lik i)*a!(k,j) There are three different representations of arrays in this code: arrays, lists and a functional one where f represents an array with elements (f i j). Looks like a candidate for a stream fusion type thing so the user only writes code using one representation and some RULES switch back and forth between representations behind the scenes. -- Dan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] about integer and float operations
Manlio Perillo wrote: The first difference is about a `mod` b, when a and b are Float types. Python use the fmod function, and it also implement divmod; Haskell seems to lack support for this operation. I wrote: Yes, Haskell does not implement the full IEEE. I spoke too soon. Data.Fixed.mod' supports this operation. I doubt that it is implemented via the IEEE primitive though. -Yitz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Data Parallel Haskell Question
I am somewhat of a beginner with DPH and wanted to ask a few (maybe elementary) questions. There appear to be two main libraries - regular and unlifted. I was a little unclear on the difference between the two and was hoping to get some clarification. If you use the 'regular' api, it seems that you can use the sort of 'syntactic sugar' language extensions (e.g. [: blah blah :]), but you are restricted to the somewhat limited Prelude explicitly written for use with code that is to be vectorised. If you use the 'unlifted' libraries, are you able to use functions/types from the standard Prelude? My problem is that I want to write a recursively-subdividing radix sort (for integer keys), where on each iteration I partition my keys into separate sets based on whether a certain bit is set or not. So I start with the most significant digit bit (say 31), and then work down to the least significant digit. I can write this in DPH just fine, but I'm getting 'panic' errors when I attempt to compile, and I wonder if it has something to do with the fact that I'm using the standard Data.Bits to inspect bits of each key. {-# LANGUAGE PArr, ParallelListComp #-} {-# OPTIONS -fvectorise #-} module RankPar(radix_sort) where import qualified Prelude import Data.Array.Parallel.PArray (fromList) import Data.Array.Parallel.Prelude ((+:+), fromPArrayP, not) import Data.Array.Parallel.Prelude.Int import Data.Bits {-# NOINLINE radix_sort #-} radix_sort :: Int - [:Int:] - [:Int:] radix_sort (-1) keys = keys radix_sort bit [:k:] = [:k:] radix_sort bit [: :] = [: :] radix_sort bit keys = (radix_sort (bit - 1) left) +:+ (radix_sort (bit - 1) right) where right = [: x | x - keys, (testBit x bit) :] left = [: y | y - keys, (not (testBit y bit)) :] Syntactically, this looks correct to me, but won't compile. Any ideas? Thanks all! -James ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Monad explanation
For me, the key to understanding monads was that monad is a value that know how to apply functions to itself. Or, more correctly, a container that knows how to apply functions to whatever is inside it. Before understanding this I read a lot of tutorials that presented monads as computations, IO sequencing structures, side effects encapsulation mechanisms, but it was a little bit too abstract, even though now ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Monad explanation
For me, the key to understanding monads was that monad is a value that know how to apply functions to itself. Or, more correctly, a container that knows how to apply functions to whatever is inside it. Before understanding this I read a lot of tutorials that presented monads as computations, IO sequencing structures, side effects encapsulation mechanisms, but it was a little bit too abstract, even though now I know how they are used for these purposes. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Monad explanation
On Wed, Feb 4, 2009 at 12:16 PM, Tymur Porkuian shooshpanch...@gmail.com wrote: For me, the key to understanding monads was that monad is a value that know how to apply functions to itself. Or, more correctly, a container that knows how to apply functions to whatever is inside it. You've just described a Functor rather than a Monad. :-) -- Dan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Monad explanation
On Wed, 2009-02-04 at 22:16 +0200, Tymur Porkuian wrote: For me, the key to understanding monads was that monad is a value that know how to apply functions to itself. Or, more correctly, a container that knows how to apply functions to whatever is inside it. Close. (Monads are not `values' but types, but I'll let that slide). Remembering that all Haskell functions take a single argument, but we use currying to support an arbitrary number of arguments, we can arrange the Monad type class hierarchy like this: * Functor: A functor F allows a single function to be applied to a single F value. Multiple arguments (or none) are not supported; the definition of application does what you probably *don't* want if the function returns an F value itself. * Applicative: An applicative functor A allows a function of n arguments (for n = 0) to be applied to n A values. However, the definition of application does what you probably *don't* want if the function returns an A value itself. * Monad: A monad M allows a function of n arguments (for n = 0) to be applied to n M values; in addition, if the function returns an M value itself, you can combine that result with the arguments in a sensible way. jcc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Purely funcional LU decomposition
On Wed, Feb 4, 2009 at 17:09, Dan Piponi dpip...@gmail.com wrote: 2009/2/3 Rafael Gustavo da Cunha Pereira Pinto rafaelgcpp.li...@gmail.com : After a discussion on whether is possible to compile hmatrix in Windows, I decided to go crazy and do a LU decomposition entirely in Haskell... import Data.Array.IArray ... e_an i j=a!(i,j)-(lik i)*a!(k,j) There are three different representations of arrays in this code: arrays, lists and a functional one where f represents an array with elements (f i j). Looks like a candidate for a stream fusion type thing so the user only writes code using one representation and some RULES switch back and forth between representations behind the scenes. -- Dan Those different representations are derived from my (very) low Haskell handicap! :-D 1) I used lists for the intermediate L and U matrices so I wouldn't have the overhead of calling accumArray and assocs everywhere 2) I used the function that returns an array element just to shorten the line length, and to make sure I was typing it right! When I started this, I thought I would end with a couple of folds, but then I turned to the recursive version, so I could implement pivoting on matrix a' more easily. List comprehension also derived from this. I started thinking of a fold for L matrix and then it hit me that it was a list comprehension... Matt's DSP library has one of the most elegant implementations I saw, but it is harder to implement pivoting, which is really important for my application. lu :: Array (Int,Int) Double -- ^ A - Array (Int,Int) Double -- ^ LU(A) lu a = a' where a' = array bnds [ ((i,j), luij i j) | (i,j) - range bnds ] luij i j | ij = (a!(i,j) - sum [ a'!(i,k) * a'!(k,j) | k - [1 ..(j-1)] ]) / a'!(j,j) | i=j = a!(i,j) - sum [ a'!(i,k) * a'!(k,j) | k - [1 ..(i-1)] ] bnds = bounds a -- Rafael Gustavo da Cunha Pereira Pinto Electronic Engineer, MSc. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] about integer and float operations
Yitzchak Gale ha scritto: Manlio Perillo wrote: [...] The second difference is about the division of two integers. fac(777) / fac(777) 1.0 Here CPython does not convert the two integers to float before to divide them, but make use of a special algorithm. GHC, instead, returns NaN No, actually here Haskell shines. Perhaps this GHCi session will illuminate the issue for you: Prelude let fac n = product [2..n] Prelude fac 777 `div` fac 777 1 Prelude fac 777 / fac 777 NaN No, this is not as complete as it is done in Python. In recent versions of Python you have two division operators. The `/` operator *always* perform a true division. As an example, the division of two integers return a float. The `//` operator *always* perform a floor division. This happens for both integers and floats: 2.5 // 1.5 1.0 2.5 / 1.5 1.6667 In Haskell: Prelude 2.5 `div` 1.5 interactive:1:0: Ambiguous type variable `t' in the constraints: `Integral t' arising from a use of `div' at interactive:1:0-12 `Fractional t' arising from the literal `1.5' at interactive:1:10-12 Probable fix: add a type signature that fixes these type variable(s) (but this seems to be available with Data.Fixed, however on Debian Etch I still have GHC 6.8.2). As for your example: Prelude let fac n = product [2..n] Prelude fac 777 `div` (4 * fac 776) 194 This is incorrect, because `div` returns an integer, but I want a float with the exact result (194.25 with Python). If I'm correct, there is no operator/function, in Haskell, that perform an exact division between two integers and return a float: exactDiv :: (Integral a, Real b) = a - a - b I personally prefer the Python solution, where we have two operators with the same behaviour over all the numbers. In Haskell, something like (/) :: (Num a, Real b) = a - a - b (//) :: (Num a, Integral b) = a - a - b [...] Thanks Manlio Perillo ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Monad explanation
Actually, I understand these types in terms of containers that override standard method of function application for their contents. In fact, there may be no contents, or several items, or nothing at all, or something strange, but the container behaves like there is a value of some type inside it. In these terms: Maybe - container that may or may not contain something [a] - container that contains several values and applies function to all of them State - container that has some other secondary value in it. IO - container that remembers passed functions and later will ask user for value, then apply functions to it. * Monad: A monad M allows a function of n arguments (for n = 0) to be applied to n M values; in addition, if the function returns an M value itself, you can combine that result with the arguments in a sensible way. Here, what does sensible mean? What do we override? Also, would it be right to say that Arrow is a container for functions that overrides function chaining? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Purely funcional LU decomposition
On Wed, Feb 4, 2009 at 12:57 PM, Rafael Gustavo da Cunha Pereira Pinto rafaelgcpp.li...@gmail.com wrote: Those different representations are derived from my (very) low Haskell handicap! :-D BTW That wasn't intended in any way as a criticism. I think it's interesting to look at real matrix code that people have written and think about what would be needed in a library to make it easier to write. -- Dan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Monad explanation
On Wed, Feb 4, 2009 at 11:41 AM, Tim Newsham news...@lava.net wrote: I put up a small Monad explanation (I wouldn't quite call it a tutorial): http://www.thenewsh.com/~newsham/haskell/monad.htmlhttp://www.thenewsh.com/%7Enewsham/haskell/monad.html The values of the IO monad are programs that do IO. That's a fairly common representation, seems to work for lots of people, but it caused me no end of trouble. Values are mathematical objects; how, I asked myself, can they possibly /be/ programs that do IO (or actions, or computations, or your metaphor here)? It doesn't make sense, says I, so I must be misunderstanding something about values; better spend hours and hours researching and trying to figure this out. But it turns out the answer is simple: they can't. They're not actions, or IO procedures, or anything else other than plain old mathematical values, no different than '2' or Int - Char. They happen to correspond in some way to the external physical behavior of the program, but that correspondence is an implementation detail beyond the scope of the formal (mathematical) semantics of the language. You don't even need monads for this part; they only enter the picture in order to provide ordered evaluation. In fact there really aren't any monadic values, since a monad is pure morphism; the values at issue are functoric values if anything. It's (the implementation of) getChar the does the IO, not IO Char. So you could say that the monad itself is a purely mathematical structure that has the felicitous if accidental side effect of imposing temporal sequence on the physical interpretation (events) associated with the program. -g ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Monad explanation
On Wed, 2009-02-04 at 23:13 +0200, Tymur Porkuian wrote: Actually, I understand these types in terms of containers that override standard method of function application for their contents. Huh? You can't actually over-ride function application --- Haskell's built-in application always does exactly the same thing, at every type. You can, however, define new application-like operators that have other application-like behaviors. Haskell has a few of these: * return * ($) * (*) * (=) In fact, there may be no contents, or several items, or nothing at all, or something strange, but the container behaves like there is a value of some type inside it. In these terms: Maybe - container that may or may not contain something [a] - container that contains several values and applies function to all of them State - container that has some other secondary value in it. IO - container that remembers passed functions and later will ask user for value, then apply functions to it. Nice but irrelevant. And I think your definition of IO is wrong. * Monad: A monad M allows a function of n arguments (for n = 0) to be applied to n M values; in addition, if the function returns an M value itself, you can combine that result with the arguments in a sensible way. Here, what does sensible mean? Sensible. As in, the definition of `join' in your monad can't be senseless, or irrelevant to the monad's intended use. What do we override? join Also, would it be right to say that Arrow is a container for functions that overrides function chaining? No. jcc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] about integer and float operations
Manlio Perillo ha scritto: [...] I personally prefer the Python solution, where we have two operators with the same behaviour over all the numbers. In Haskell, something like (/) :: (Num a, Real b) = a - a - b This should be (/) :: (Num a, Fractional b) = a - a - b but I'm not sure it is correct. (//) :: (Num a, Integral b) = a - a - b Manlio Perillo ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] about integer and float operations
On Wed, Feb 4, 2009 at 1:09 PM, Manlio Perillo manlio_peri...@libero.it wrote: In Haskell, something like (/) :: (Num a, Real b) = a - a - b You probably want (Real a, Fractional b) = a - a - b. Int is an instance of Real... Real is the class of types that can be converted to Rational. Then we can define (/.) :: (Real a1, Real a2, Fractional a) = a1 - a2 - a x /. y = fromRational $ toRational x / toRational y whose type is more general than the one I gave above, but we can restrict it to that by changing the signature, if you like. (//) :: (Num a, Integral b) = a - a - b Again, Num is inappropriate, but we can define something similar: (//) :: (Integral b, Real a, Real a1) = a - a1 - b x // y = floor $ toRational x / toRational y Hope that helps, Max ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] about integer and float operations
Prelude let i2fDiv a b = fromIntegral a / fromIntegral b Prelude :t i2fDiv i2fDiv :: (Integral a, Fractional b, Integral a1) = a - a1 - b Prelude 10 `i2fDiv` 3 3.3335 That what you're looking for? -Ross On Feb 4, 2009, at 4:22 PM, Manlio Perillo wrote: Manlio Perillo ha scritto: [...] I personally prefer the Python solution, where we have two operators with the same behaviour over all the numbers. In Haskell, something like (/) :: (Num a, Real b) = a - a - b This should be (/) :: (Num a, Fractional b) = a - a - b but I'm not sure it is correct. (//) :: (Num a, Integral b) = a - a - b Manlio Perillo ___ 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] Purely funcional LU decomposition
On Wed, Feb 4, 2009 at 19:14, Dan Piponi dpip...@gmail.com wrote: On Wed, Feb 4, 2009 at 12:57 PM, Rafael Gustavo da Cunha Pereira Pinto rafaelgcpp.li...@gmail.com wrote: Those different representations are derived from my (very) low Haskell handicap! :-D BTW That wasn't intended in any way as a criticism. I think it's Not taken! interesting to look at real matrix code that people have written and think about what would be needed in a library to make it easier to write. -- Dan What I miss most is a data structure with O(1) (amortized) direct access. One of the changes I thought today was to remove the ++ operator and create a list of lists that I would concat in the last call. -- Rafael Gustavo da Cunha Pereira Pinto Electronic Engineer, MSc. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Elegant powerful replacement for CSS
On Wed, Feb 4, 2009 at 1:50 AM, Achim Schneider bars...@web.de wrote: I don't believe that it's possible to draw a clear destinction between concerns the programmer and concerns the designer. In fact, I get offended by the notion that I'm inherently incapable of distinguishing readable from unreadable text, and think that the notion of designers being unable to do anything but assembling a colourful collage of the data they're given is more of a self-fulfilling prophecy than a truth. Having worked in the nexgen games industry with lots of designers and artists, I can only agree with Achim here. One cannot draw a hard line between programmers and designers, because these two come in all kinds of flavors ;-) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] about integer and float operations
Ross Mellgren ha scritto: Prelude let i2fDiv a b = fromIntegral a / fromIntegral b Prelude :t i2fDiv i2fDiv :: (Integral a, Fractional b, Integral a1) = a - a1 - b Prelude 10 `i2fDiv` 3 3.3335 Prelude fac 777 `i2fDiv` fac 777 NaN That what you're looking for? No. I'm looking for an exact integer division that avoids overflows, if possible. -Ross Manlio Perillo ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] about integer and float operations
No. I'm looking for an exact integer division that avoids overflows, if possible. Use Data.Ratio: *Main Data.Ratio (fac 777) / (4 * fac 776) :: Ratio Integer 777%4 Convert to a float , if you want, before displaying it. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] about integer and float operations
Manlio Perillo wrote: fac(777) / fac(777) 1.0 Here CPython does not convert the two integers to float before to divide them, but make use of a special algorithm. GHC, instead, returns NaN I wrote: No, actually here Haskell shines. Perhaps this GHCi session will illuminate the issue for you: Prelude let fac n = product [2..n] Prelude fac 777 `div` fac 777 1 Prelude fac 777 / fac 777 NaN No, this is not as complete as it is done in Python. The `/` operator *always* ...return a float... The `//` operator *always* perform a floor division. This happens for both integers and floats: If I'm correct, there is no operator/function, in Haskell, that perform an exact division between two integers and return a float: exactDiv :: (Integral a, Real b) = a - a - b exactDiv :: (Real a, Real b, Fractional c) = a - b - c x `exactDiv` y = realToFrac x / realToFrac y Python does that same type coercion automatically at runtime. This can sometimes make your code look a bit neater, but other times really gets in the way. I personally prefer the Python solution, where we have two operators with the same behaviour over all the numbers. If you really like exactDiv better, you can define an operator to do it for you. But most people don't. Haskell gives you total control, since the types of everything are strictly defined at compile time. This has the extra advantage of giving you a really powerful type checker that can find many of your bugs at compile time. -Yitz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Temporarily overriding Data.Generics
Hi I'm currently working on hacking Data.Generics for my master thesis. I'm basically trying to find out whether it can be made a bit faster using e.g. rewrite rules. The problem I'm having is that I need an easy way to import my own modified version of Data.Generics (currently located in the same directory as my testing program) without unregistering or hiding syb-0.1.0.0 as base seems to depend on it. I've read the GHC user manual trying to find nice ways to do this using a bunch of different parameters to ghc, but I can't figure it out. Does anyone here know? Any help appreciated, Deniz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Monad explanation
Huh? You can't actually over-ride function application --- Haskell's built-in application always does exactly the same thing, at every type. It's a metaphor. In every case container has its own method of applying functions to its contents - e.g. instead of f x we write x fmap f. You can, however, define new application-like operators that have other application-like behaviors. Haskell has a few of these: * return * ($) * (*) * (=) I know Haskell, that's not what I'm talking about. What I'm trying to do is to create a simple explanation for monads that doesn't involve neither mathematics nor computation metaphor. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Monad explanation
It's a metaphor. In every case container has its own method of applying functions to its contents - e.g. instead of f x we write x fmap f. x `fmap` f, of course ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Monad explanation
x `fmap` f disregard that, f `fmap` x ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] about integer and float operations
Manlio Perillo wrote: No. I'm looking for... Manlio - can you describe exactly what you want? Do you know exactly what you want? You have said that you want division like in Python - but that even that is not well defined: Python 2.6.1 3/5 0 Python 3.1 3/5 0.59998 Please tell us *exactly* what you want your division to do, on integers and on floating point. Or tell us you want division like / in Python 3.1, or whatever. -Yitz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] about integer and float operations
Max Rabkin ha scritto: [...] Then we can define (/.) :: (Real a1, Real a2, Fractional a) = a1 - a2 - a x /. y = fromRational $ toRational x / toRational y [...] (//) :: (Integral b, Real a, Real a1) = a - a1 - b x // y = floor $ toRational x / toRational y Hope that helps, Max Yes, thanks. However there is still a *big* problem: it is inefficient. Here is a Python version of the Chudnovsky algorithm [1] for computing Pi: http://paste.pocoo.org/show/102800/ On my system it takes 10 seconds. Here is an Haskell version: http://paste.pocoo.org/show/102801/ On my system it takes 30 seconds. Thanks Manlio Perillo [1] http://upload.wikimedia.org/math/6/6/8/6681cd21f3ca9bf13248a87d4202e06a.png ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] about integer and float operations
On Wed, Feb 4, 2009 at 2:03 PM, Manlio Perillo manlio_peri...@libero.it wrote: Max Rabkin ha scritto: [...] Then we can define (/.) :: (Real a1, Real a2, Fractional a) = a1 - a2 - a x /. y = fromRational $ toRational x / toRational y [...] (//) :: (Integral b, Real a, Real a1) = a - a1 - b x // y = floor $ toRational x / toRational y Hope that helps, Max Yes, thanks. However there is still a *big* problem: it is inefficient. It sure is. To get the type you asked for, one *has* to go via rationals. But... Here is an Haskell version: http://paste.pocoo.org/show/102801/ On my system it takes 30 seconds. You're only dividing integers by integers to get Doubles. x /. y = fromIntegral x / fromIntegral y works just fine in this case. --Max ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] about integer and float operations
Yitzchak Gale ha scritto: Manlio Perillo wrote: No. I'm looking for... Manlio - can you describe exactly what you want? Do you know exactly what you want? You have said that you want division like in Python - but that even that is not well defined: Python 2.6.1 3/5 0 You have to: from __future__ import division In Python 3.x this is now the default behaviour Python 3.1 3/5 0.59998 Please tell us *exactly* what you want your division to do, on integers and on floating point. I'm posting more details in another response. Thanks Manlio Perillo ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] about integer and float operations
Yitzchak Gale ha scritto: [...] exactDiv :: (Real a, Real b, Fractional c) = a - b - c x `exactDiv` y = realToFrac x / realToFrac y Python does that same type coercion automatically at runtime. No, this is not correct. CPython converts to float only for a simple integer (since conversion from machine int to machine float will never overflow). For a long integer it uses a special algorithm for computing the division, that avoids overflow if the final result is in the range of a float. http://code.python.org/hg/trunk/file/tip/Objects/longobject.c#l2657 [...] Thanks Manlio Perillo ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] about integer and float operations
Manlio Perillo ha scritto: [...] Here is an Haskell version: http://paste.pocoo.org/show/102801/ On my system it takes 30 seconds. Sorry, I compiled without optimizations enabled. With -O2 it now runs in 20 seconds. What other optimizations should I enable? Thanks Manlio Perillo ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] about integer and float operations
What other optimizations should I enable? -fexcess-precision or some such ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] about integer and float operations
Max Rabkin ha scritto: [...] Here is an Haskell version: http://paste.pocoo.org/show/102801/ On my system it takes 30 seconds. You're only dividing integers by integers to get Doubles. x /. y = fromIntegral x / fromIntegral y works just fine in this case. No, this *does not works*. I get Nan as result, since fromIntegral a, when a is out of range of a double, returns Infinity. Prelude (fromIntegral (fac 777)) :: Double Infinity CPython, does not try to convert to double, but, instead, to a scaled double. --Max Manlio Perillo ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Monad explanation
On Wed, 2009-02-04 at 23:55 +0200, Tymur Porkuian wrote: Huh? You can't actually over-ride function application --- Haskell's built-in application always does exactly the same thing, at every type. It's a metaphor. Oh, right. That one word that means `inaccurate way of putting things'! Invoking it solves everything! I maintain that my claims were entirely accurate. I maintain your claims are in-accurate and confusing. In every case container has its own method of applying functions to its contents - e.g. instead of f x we write x fmap f. (NB. Typically only one of these will type-check; you know that, right?) jcc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] about integer and float operations
Thomas DuBuisson ha scritto: What other optimizations should I enable? -fexcess-precision or some such There is pratically no performance gain (maybe about 1 second). Thanks Manlio Perillo ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Reminder about hard questions about GHC (was [Haskell-cafe] Temporarily overriding Data.Generics)
For low-level or obscure questions about GHC such as this, it might be better to use glasgow-haskell-us...@haskell.org. There are one or two people who don't read haskell-cafe because it's so busy (and they're so busy). -- Robin On Wed, 4 Feb 2009 22:54:15 +0100 Deniz Dogan deniz.a.m.do...@gmail.com wrote: Hi I'm currently working on hacking Data.Generics for my master thesis. I'm basically trying to find out whether it can be made a bit faster using e.g. rewrite rules. The problem I'm having is that I need an easy way to import my own modified version of Data.Generics (currently located in the same directory as my testing program) without unregistering or hiding syb-0.1.0.0 as base seems to depend on it. I've read the GHC user manual trying to find nice ways to do this using a bunch of different parameters to ghc, but I can't figure it out. Does anyone here know? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] about integer and float operations
Manlio Perillo wrote: However there is still a *big* problem: it is inefficient. Here is a Python version of the Chudnovsky algorithm [1] for computing Pi: http://paste.pocoo.org/show/102800/ On my system it takes 10 seconds. Here is an Haskell version: http://paste.pocoo.org/show/102801/ On my system it takes 30 seconds. Ah, OK. Thanks. Now we have a well-defined problem. :) And that makes it clear that what you want is Python 3 division. Well, first of all, there are a few bugs in the Haskell version of your program - don't forget that unlike in Python, ranges in Haskell *include* the last number. Second, we should note that it is silly to compute 1000 terms in this sum. By the end, you are getting terms whose order of magnitude is 10 ^ (-15000). The Haskell version is spending a bit more time on those (useless) later terms. The reason is that in Haskell we are first reducing the fraction, then converting to Double. If you really did care about that amount of accuracy, you would leave the result as a Rational. Or as one of various other unlimited-precision floating point types that are available in Haskell libraries. This calculation in Haskell would take the same amount of time as it takes now. You would need to rewrite your Python program to do this, and I would guess it would run a lot slower. In our case, the Python division first does a quick estimate of the sizes of the two integers, and just returns zero if it sees that there will be underflow on conversion to double. So I made the following rough change to the Haskell: -- An exact division (/.) :: Integer - Integer - Double x /. y | y `div` x 5*10^323 = 0 | otherwise= fromRational $ toRational x / toRational y Now the Haskell runs in about half the time as the Python on my machine. Obviously, the Haskell could easily be further optimized. -Yitz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] about integer and float operations
Yitzchak Gale ha scritto: Manlio Perillo wrote: However there is still a *big* problem: it is inefficient. Here is a Python version of the Chudnovsky algorithm [1] for computing Pi: http://paste.pocoo.org/show/102800/ On my system it takes 10 seconds. Here is an Haskell version: http://paste.pocoo.org/show/102801/ On my system it takes 30 seconds. Ah, OK. Thanks. Now we have a well-defined problem. :) Good :). And that makes it clear that what you want is Python 3 division. Well, first of all, there are a few bugs in the Haskell version of your program - don't forget that unlike in Python, ranges in Haskell *include* the last number. Ah right, thanks! Second, we should note that it is silly to compute 1000 terms in this sum. By the end, you are getting terms whose order of magnitude is 10 ^ (-15000). Yes, of course. But I wrote the Python script as a response to a post on it.comp.lang.python, where an user was having overflow problems with a naive implementation of the algorithm. I have tested it with 1000 iterations just to check the raw performances. Then I tried to code it in Haskell, noting that there was no direct method for an exact division of two integer numbers. The Haskell version is spending a bit more time on those (useless) later terms. The reason is that in Haskell we are first reducing the fraction, then converting to Double. If you really did care about that amount of accuracy, you would leave the result as a Rational. This is not possible, since there is an irrational number: c ** (3. / 2.). Moreover the sum of rational numbers is rather expensive, in this case. [...] In our case, the Python division first does a quick estimate of the sizes of the two integers, and just returns zero if it sees that there will be underflow on conversion to double. So I made the following rough change to the Haskell: -- An exact division (/.) :: Integer - Integer - Double x /. y | y `div` x 5*10^323 = 0 | otherwise= fromRational $ toRational x / toRational y Right, but I would like to see a proper implemented function for exact integer division in GHC. Now the Haskell runs in about half the time as the Python on my machine. Obviously, the Haskell could easily be further optimized. -Yitz Thanks Manlio ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] about integer and float operations
On Thu, 2009-02-05 at 01:10 +0100, Manlio Perillo wrote: Yitzchak Gale ha scritto: In our case, the Python division first does a quick estimate of the sizes of the two integers, and just returns zero if it sees that there will be underflow on conversion to double. So I made the following rough change to the Haskell: -- An exact division (/.) :: Integer - Integer - Double x /. y | y `div` x 5*10^323 = 0 | otherwise= fromRational $ toRational x / toRational y Right, but I would like to see a proper implemented function for exact integer division in GHC. (%) *is* a proper function for exact integer division. But you'll find plenty of Haskellers to balk at calling anything that returns a Double `proper'. jcc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Open unqualified imports
On Wed, 4 Feb 2009, Simon Marlow wrote: Ian Lynagh wrote: On Fri, Jan 16, 2009 at 06:42:46AM -0800, eyal.lo...@gmail.com wrote: Closed-unqualified import: import Data.Map(Map, lookup) One problem with this style is that you can get lots of conflicts from your VCS if you have multiple people working on the same module. Right; in GHC we actively discourage the use of explict import lists (or closed-unqualified import to use the terminology of this thread). http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Imports I find that the reasons not to use explicit import lists outweigh the reasons to use them, at least for code that I'm working on (rather than just reading). Ideally the import lists would be maintained automatically by an IDE, and would be intelligently handled by the VCS. This will work only if you exclusively import from modules of the same project, where you can choose identifiers to never clash, and external library modules where no functions are added anymore. Certainly for GHC this works since the compiler as basis tool must not depend on many libraries. However for me the situation is that I use many libraries, each maintained by only a few people. Within this kind of development name clashes are more likely than versioning conflicts. The only style that avoids both kinds of conflicts is the qualified import, which I try to use whereever possible. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Open unqualified imports
On Wed, Feb 4, 2009 at 4:22 PM, Henning Thielemann lemm...@henning-thielemann.de wrote: On Wed, 4 Feb 2009, Simon Marlow wrote: Ian Lynagh wrote: On Fri, Jan 16, 2009 at 06:42:46AM -0800, eyal.lo...@gmail.com wrote: Closed-unqualified import: import Data.Map(Map, lookup) One problem with this style is that you can get lots of conflicts from your VCS if you have multiple people working on the same module. Right; in GHC we actively discourage the use of explict import lists (or closed-unqualified import to use the terminology of this thread). http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Imports I find that the reasons not to use explicit import lists outweigh the reasons to use them, at least for code that I'm working on (rather than just reading). Ideally the import lists would be maintained automatically by an IDE, and would be intelligently handled by the VCS. This will work only if you exclusively import from modules of the same project, where you can choose identifiers to never clash, and external library modules where no functions are added anymore. Certainly for GHC this works since the compiler as basis tool must not depend on many libraries. However for me the situation is that I use many libraries, each maintained by only a few people. Within this kind of development name clashes are more likely than versioning conflicts. The only style that avoids both kinds of conflicts is the qualified import, which I try to use whereever possible. Another solution would be an automated tool to add explicit import lists as part of the release process. Then you don't have to worry about maintaining them but once you do the final release, you know that it won't break if new functions are added to dependencies. Perhaps I will create such a tool sometime... Alex ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Monad explanation
On 5 Feb 2009, at 10:20 am, Gregg Reynolds wrote: That's a fairly common representation, seems to work for lots of people, but it caused me no end of trouble. Values are mathematical objects; how, I asked myself, can they possibly /be/ programs that do IO (or actions, or computations, or your metaphor here)? It doesn't make sense, says I, without reference to the rest of your message, of course values can /be/ programs. One of the fundamental insights in programming is that (all) programs are values, which, in combination with the observation that some programs exist, means that some values are programs. Indeed, in the pure lambda calculus, _everything_ is a function (= program). If you don't like it put that way, say that values can be _names for_ programs, or that values can _be treated as_ programs by interpreters. I'd rather not get too far into White Knight territory, though. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] about integer and float operations
On 5 Feb 2009, at 10:38 am, Manlio Perillo wrote: I'm looking for an exact integer division that avoids overflows, if possible. What this sounds like to me is a request that the Prelude function 'fromRational' should work well. Since The floating point literal f is equivalent to fromRational (n Ratio.% d), where fromRational is a method in class Fractional and Ratio.%constructs a rational from two integers, as defined in the Ratio library. The integers n and d are chosen so that n/d = f. If you cannot divide two Integers n, d accurately using (fromRational (n Ratio.% d) :: Double) that casts doubt on the trustworthiness of floating point literals. Suppose we have a function decodeIntegerAsFloat :: RealFloat a = Integer - (Integer,a) such that if (s,m) = integer_to_scaled_float x then either x = 0 and s = 0 and m = 0 or x = m * 2**s (mathematically) and abs m \in [0.5,1.0). Then integer_ratio_as_float :: Floating a = Integer - Integer - a integer_ratio_as_float p q = (mp/mq)*(2.0^(sp-sq)) where (sp,mp) = decodeIntegerAsFloat p (sq,mq) = decodeIntegerAsFloat q You'd actually use scaleFloat; if the difference sp-sq is outside the range of Int the answer is going to be a signed zero or a signed infinity anyway. decodeIntegerAsFloat would sit very well in the RealFloat class alongside its model, decodeFloat. It has other uses. For example, you can use it to compute logarithms of Integers with much less worry about overflow. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] pure crisis :)
On Thu, Feb 5, 2009 at 2:52 AM, Seth Gordon se...@ropine.com wrote: Bulat Ziganshin wrote: Hello haskell-cafe, pure functional denotation for crisis: (_|_) Buy ⊥, sell ⊤! so you're saying the T industry is going to be the next growth industry? -markb ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] darcs send errors that I don't understand ....
Shall I send this patch? (1/1) [ynWvpxqadjk], or ? for help: y Error in execvp: No such file or directory darcs: timer_settime: Invalid argument Failed to execute external command: /usr/sbin/sendmail -i -t Lowlevel error: execvp: Illegal seek Redirects: (File /home/vigalchin/FTP/Ketil/biolib/darcsOuDSC9,Null,AsIs) Can anybody help me on the errors above? (The /usr/sbin/sendmail I think I understand ... probably haven't set up sendmail yet). Kind regards, Vasili ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Monad explanation
On Thu, 5 Feb 2009 15:18:09 +1300, Richard O'Keefe o...@cs.otago.ac.nz wrote: On 5 Feb 2009, at 10:20 am, Gregg Reynolds wrote: That's a fairly common representation, seems to work for lots of people, but it caused me no end of trouble. Values are mathematical objects; how, I asked myself, can they possibly /be/ programs that do IO (or actions, or computations, or your metaphor here)? It doesn't make sense, says I, without reference to the rest of your message, of course values can /be/ programs. One of the fundamental insights in programming is that (all) programs are values, which, in combination with the observation that some programs exist, means that some values are programs. Indeed, in the pure lambda calculus, _everything_ is a function (= program). Indeed. Perhaps at least part of this confusion is caused by a difference in style of thinking between the functional and imperative programming paradigms; in functional programming, functions are first-class values, so they are treated just like any other values. Therefore, functional programs are values. This style of thinking contrasts with that of imperative programming, where programs are typically considered to be composed of statements which change global state when executed (see Functional programming - HaskellWiki: 1 What is functional programming? at http://www.haskell.org/haskellwiki/Functional_programming#What_is_functional_programming.3F . If you don't like it put that way, say that values can be _names for_ programs, or that values can _be treated as_ programs by interpreters. I'd rather not get too far into White Knight territory, though. Actually, I have a question myself on this issue. I had intended to give an example of a self-referential program that modifies itself to illustrate programs as first-class values, but then I just discovered that it seems that Haskell doesn't support reflection (see http://en.wikipedia.org/wiki/Reflection_(computer_science)). In particular, I just came across the following archived post in Haskell-Cafe, Re: [Haskell-cafe] To yi or not to yi, is this really the question? A plea for a cooperative, ubiquitous, distributed integrated development system., dated Mon, 18 Jun 2007 14:05:53 -0700 (see http://www.mail-archive.com/haskell-cafe@haskell.org/msg25257.html), in which Pasqualino 'Titto' Assini wrote as follows: Most languages, even Java, have a reflection capability to dynamically inspect an object. It is surprising that Haskell doesn't offer it. In the same thread, Claus Reinke, in his response, dated Mon, 18 Jun 2007 15:45:50 -0700 (see http://www.mail-archive.com/haskell-cafe@haskell.org/msg25270.html), wrote as follows: Most languages, even Java, have a reflection capability to dynamically inspect an object. It is surprising that Haskell doesn't offer it. it has to be done with care, or it will invalidate *all* your nice reasoning about haskell programs. random example reify (f . g) == [| f . g |] =/= [| \x- f (g x) |] == reify (\x- f (g x)) I tried looking up self-reference on HaskellWiki, but my search did not result in any hits. Is it possible to write a self-referential function in Haskell that modifies itself? My intuition is that this would violate referential transparency, so it is probably not possible, but as long as the program is only allowed to reference itself without actually modifying itself, then there should be a way. Alternatively, it should be possible for a Haskell program to create a copy of itself, and then to modify that copy, as long as referential transparency is not violated. To what extent are self-reference and reflection supported n Haskell? -- Benjamin L. Russell -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 Furuike ya, kawazu tobikomu mizu no oto. -- Matsuo Basho^ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Monad explanation
On Wed, Feb 4, 2009 at 9:38 PM, Benjamin L. Russell dekudekup...@yahoo.com wrote: Is it possible to write a self-referential function in Haskell that modifies itself? Is it possible to write *any* kind of function in Haskell that modifies *anything*? --Max ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] darcs send errors that I don't understand ....
2009/2/5 Galchin, Vasili vigalc...@gmail.com: Shall I send this patch? (1/1) [ynWvpxqadjk], or ? for help: y Error in execvp: No such file or directory darcs: timer_settime: Invalid argument Failed to execute external command: /usr/sbin/sendmail -i -t Lowlevel error: execvp: Illegal seek Redirects: (File /home/vigalchin/FTP/Ketil/biolib/darcsOuDSC9,Null,AsIs) Can anybody help me on the errors above? (The /usr/sbin/sendmail I think I understand ... probably haven't set up sendmail yet). What kind of system are you using? To me it looks like you haven't set up any mailserver, most mail servers come with a tool named 'sendmail' simply because there are a lot of programs that depend on it. /M -- Magnus Therning(OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe