[Haskell-cafe] Cabal ignores ld-options? - 2011 remix
Hi cafe, I am trying to link a .a file built by a separate makefile into my library. GHC has no problem with it, but I need to convince cabal to do it for the package to be hackage-friendly. There's a thread about this back in 2007: http://www.haskell.org/pipermail/cabal-devel/2007-April/000507.html Is there a method for this now, or is the state of affairs the same as before? Thanks, -Ryan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Instantiation problem
On 29/01/2011 20:56, Henning Thielemann wrote: Is there a reason why you use an individual type for every unit? The existing implementations of typed physical units only encode the physical dimension in types and leave the unit factors to the value level. I found this to be the most natural way. I am studying type classes using examples from the literature [1]. There is no particular intension to implement anything. I am confused about the unit function in the code below. My understanding is: The signature of the unit function is defined in the MetricDescription class. Any valid instantce of MetricDescription will respect the functional dependency (FD): The FD | description - unit is exactly the signature of the unit function. My confusions I do not understand the definitions of unit in the instances. I do not know how the constant 1 can be equated with a *type*, Where did 1 come from? I do not know how the constant 1 can be equated with *two distinct* definitions of the function uint and still produce the following correct results Ok, modules loaded: A. *A unit (LengthInMetres 7) Metre *A unit (LengthInCentimetres 7) Centimetre *A [1] http://ifgi.uni-muenster.de/~lutzm/odbase04_schade_et_al.pdf == module A where -- Each member of the Unit class has one operator convertFactorToBaseUnit -- that takes a measurement unit (say metre) and returns a conversion factor for that unit of measurement class Unit unit where convertFactorToBaseUnit :: unit - Double class (Unit unit) = MetricDescription description unit | description - unit where unit :: description - unit valueInUnit :: description - Double valueInBaseUnit :: description - Double valueInBaseUnit d = (convertFactorToBaseUnit(unit d)) * (valueInUnit d) data Dog = Dog deriving Show data Metre = Metre deriving Show data Centimetre = Centimetre deriving Show -- An instance for metres, where the convert factor is 1.0 instance Unit Metre where convertFactorToBaseUnit Metre = 1.0 -- An instance for centimetres, where the convert factor is 0.1 instance Unit Centimetre where convertFactorToBaseUnit Centimetre = 0.1 data LengthInMetres = LengthInMetres Double deriving Show data LengthInCentimetres = LengthInCentimetres Double deriving Show instance MetricDescription LengthInMetres Metre where valueInUnit (LengthInMetres d) = d unit l = Metre instance MetricDescription LengthInCentimetres Centimetre where valueInUnit (LengthInCentimetres d) = d unit l = Centimetre This message has been scanned for content and viruses by the DIT Information Services E-Mail Scanning Service, and is believed to be clean. http://www.dit.ie ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [Haskell] ANNOUNCE: jhc 0.7.7 is out.
Greetings! A few questions about the inclusion of parsec: 1. It is parsec-2, not parsec-3, right? 2. Does this change consist of merely inclusion parsec as a standard library, or are there any compiler improvements in this release that made it possible to build parsec? * John Meacham j...@repetae.net [2011-01-29 20:47:20-0800] Announcing jhc 0.7.7! This release fixes a large number of bugs that cropped up when compiling haskell out in the wild as well as adds some more features. A major one being the garbage collector is enabled by default. http://repetae.net/computer/jhc/ Changes: (including some changes from the unannounced 0.7.6 release) * The Garbage Collector is now enabled by default. * new standard libraries * transformers * parsec * QuickCheck * report proper errors with line numbers for various issues with compiled code. * New option '-C' that compiles to C code and stops, useful for targeting other platforms or building shared libraries. * Nintendo Wii added as target (thanks to Korcan Hussein) * Fix major performance bug that kept WRAPPERs from being inlined in certain places. * Typechecking speed greatly increased. * monomorphism-restriction flag is now respected * empty class contexts now work * unicode in haskell source supported now * Type Defaulting now works properly * RULES parse like ghc now for compatibility * 'do' 'where' on same indent now parses * Build system fixes and cleanups * irrefutable lambda pattern bindings desugar properly now. * GHC parsing regression tests have been ported to jhc, helped find and fix many bugs. * Certain optimizations would discard RULES, these have been fixed. * Removed quadratic behavior in optimizer, speeds things up noticibly. * Garbage collector improvements, caches are pre-initialized. * Fix shiftL/R implementations for built in types. * All Num, Real, and Integral magic removed from compiler. This is a very good thing. * improved help messages John ___ Haskell mailing list hask...@haskell.org http://www.haskell.org/mailman/listinfo/haskell -- Roman I. Cheplyaka :: http://ro-che.info/ Don't worry what people think, they don't do it very often. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: nanoparsec 0.1.1
Nanoparsec is currently simply a port of attoparsec on the ListLike (the abstraction of lists used by iteratee). It allows to achive in parsing a near-attoparsec levels of speed (benchmarks from attoparsec library shown a 0.450 ± 0.028 for attoparsec, 0.479 ± 0.043 for nanoparsec and 1.532 ± 0.084 for parsec 3) combining the flexibility of stream of parsec 3 with the iterative approach and speed of attoparsec. Changes since version 0.1: - Lowered conditions on base to allow using GHC 6.12.x (haven't been tested) - Added IsString instance and (.*) (*.) helper functions Regards signature.asc Description: This is a digitally signed message part ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: nanoparsec 0.1.1
On Sun, 2011-01-30 at 13:13 -0200, Felipe Almeida Lessa wrote: On Sun, Jan 30, 2011 at 1:03 PM, Maciej Piechotka uzytkown...@gmail.com wrote: It allows to achive in parsing a near-attoparsec levels of speed (benchmarks from attoparsec library shown a 0.450 ± 0.028 for attoparsec, 0.479 ± 0.043 for nanoparsec and 1.532 ± 0.084 for parsec 3) combining the flexibility of stream of parsec 3 with the iterative approach and speed of attoparsec. Nice! How does it compare to attoparsec-text performance-wise? I haven't checked. So far there are specializations for ByteString but not Text. I would expect similar penalty for it anyway (I'll try to port tests and report values). Although I'm its maintainer, duplicating libraries isn't funny =). Deduplication was a goal of the nanoparsec. Most of the code and documentation is from attoparsec anyway. Cheers, Regards signature.asc Description: This is a digitally signed message part ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Code from Haskell School of Expression hanging.
OK, what about Hugs? I used Cabal to download the GLFW package to GHC. Must I do the same from Hugs? Or is this also a fools mission? From: http://plucky.cs.yale.edu/soe/software1.htm follow the installation instructions for Gtk2Hs at http://www.haskell.org/gtk2hs, then import the module Graphics.SOE.Gtk instead of SOE.hs in your code. That link appears to be broken. What must I do? Or am I at a dead end? Michael [michael@localhost ~]$ cd ./SOE/SOE/src [michael@localhost src]$ hugs __ __ __ __ ___ _ || || || || || || ||__ Hugs 98: Based on the Haskell 98 standard ||___|| ||__|| ||__|| __|| Copyright (c) 1994-2005 ||---|| ___|| World Wide Web: http://haskell.org/hugs || || Bugs: http://hackage.haskell.org/trac/hugs || || Version: September 2006 _ Haskell 98 mode: Restart with command line option -98 to enable extensions Type :? for help Hugs :l Snowflake.lhs ERROR ./SOE.hs - Can't find imported module Graphics.UI.GLFW Hugs --- On Sun, 1/30/11, Brandon S Allbery KF8NH allber...@gmail.com wrote: From: Brandon S Allbery KF8NH allber...@gmail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: haskell-cafe@haskell.org Date: Sunday, January 30, 2011, 2:00 AM -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 1/29/11 21:27 , michael rice wrote: I'm using the OpenGL stuff (GLFW). Same set of problems? None of the lower level libraries support multithreading. If any of those libraries use FFI bindings that run in a bound thread, they'll fail in the threaded runtime. gtk2hs was modified to allow ghci to work, IIRC. - -- brandon s. allbery [linux,solaris,freebsd,perl] allb...@kf8nh.com system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk1FDIkACgkQIn7hlCsL25V6twCgn5JcK8Y0yerY5EkiyJyULOeM 6sYAoLkj8JS/CfquHfHCzl3DbGPKAhgo =Ybo6 -END PGP SIGNATURE- ___ 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] Code from Haskell School of Expression hanging.
I don't know about the rest of your question, but I've found that a lot of broken links on haskell.org can be fixed by inserting /haskellwiki/ between the .org/ and the term in the broken URL. Therefore, the link you were looking for is: http://www.haskell.org/haskellwiki/Gtk2Hs On 1/30/11 10:28 AM, michael rice wrote: OK, what about Hugs? I used Cabal to download the GLFW package to GHC. Must I do the same from Hugs? Or is this also a fools mission? From: http://plucky.cs.yale.edu/soe/software1.htm follow the installation instructions for Gtk2Hs at http://www.haskell.org/gtk2hs, then import the module Graphics.SOE.Gtk instead of SOE.hs in your code. That link appears to be broken. What must I do? Or am I at a dead end? Michael [michael@localhost ~]$ cd ./SOE/SOE/src [michael@localhost src]$ hugs __ __ __ __ ___ _ || || || || || || ||__ Hugs 98: Based on the Haskell 98 standard ||___|| ||__|| ||__|| __|| Copyright (c) 1994-2005 ||---|| ___|| World Wide Web: http://haskell.org/hugs || || Bugs: http://hackage.haskell.org/trac/hugs || || Version: September 2006 _ Haskell 98 mode: Restart with command line option -98 to enable extensions Type :? for help Hugs :l Snowflake.lhs ERROR ./SOE.hs - Can't find imported module Graphics.UI.GLFW Hugs --- On *Sun, 1/30/11, Brandon S Allbery KF8NH /allber...@gmail.com/* wrote: From: Brandon S Allbery KF8NH allber...@gmail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: haskell-cafe@haskell.org Date: Sunday, January 30, 2011, 2:00 AM -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 1/29/11 21:27 , michael rice wrote: I'm using the OpenGL stuff (GLFW). Same set of problems? None of the lower level libraries support multithreading. If any of those libraries use FFI bindings that run in a bound thread, they'll fail in the threaded runtime. gtk2hs was modified to allow ghci to work, IIRC. - -- brandon s. allbery [linux,solaris,freebsd,perl] allb...@kf8nh.com /mc/compose?to=allb...@kf8nh.com system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu /mc/compose?to=allb...@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk1FDIkACgkQIn7hlCsL25V6twCgn5JcK8Y0yerY5EkiyJyULOeM 6sYAoLkj8JS/CfquHfHCzl3DbGPKAhgo =Ybo6 -END PGP SIGNATURE- ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org /mc/compose?to=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 mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Automatically move cursor focus in split window in haskell-mode in emacs on load (C-c C-l) command?
With the community server down it looks like I can't join the haskell-mode mailing list, and also I thought someone might have already done this, so I've posted here. I'm new to Haskell and emacs... and don't know any elisp at all! I'm trying to set up my haskell-mode so that when I've finished inputting code in a buffer that's in haskell-mode, and I then do C-c C-l to split the screen and load the code into ghci in the lower buffer, the cursor focus will automatically jump down to the bottom half of the split screen and I can instantly begin to interact with ghci. The way it defaults to now is that the cursor stays in the topmost editing half of the split screen, and I inevitably begin typing and mess up my code and have to do some backspacing and then mouse over to the bottom half. :) I checked on #haskell and #emacs last night, and someone suggested either doing it with elisp or keyboard macros, but I'm not sure how to do the first, and I think the second is not what I'm looking for. I'd like for haskell-mode to otherwise remain the same, and to still use the same C-c C-l key sequence, but I'd just like it to always be set up to add the step in the load sequence of jumping the cursor focus down to the lower half of the split for me. Any ideas? (Thanks in advance.) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Code from Haskell School of Expression hanging.
Thanks. I already found it, and there doesn't seem to be any support for Linux. Michael --- On Sun, 1/30/11, JETkoten jetko...@gmail.com wrote: From: JETkoten jetko...@gmail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: haskell-cafe@haskell.org Date: Sunday, January 30, 2011, 11:22 AM I don't know about the rest of your question, but I've found that a lot of broken links on haskell.org can be fixed by inserting /haskellwiki/ between the .org/ and the term in the broken URL. Therefore, the link you were looking for is: http://www.haskell.org/haskellwiki/Gtk2Hs On 1/30/11 10:28 AM, michael rice wrote: OK, what about Hugs? I used Cabal to download the GLFW package to GHC. Must I do the same from Hugs? Or is this also a fools mission? From: http://plucky.cs.yale.edu/soe/software1.htm follow the installation instructions for Gtk2Hs at http://www.haskell.org/gtk2hs, then import the module Graphics.SOE.Gtk instead of SOE.hs in your code. That link appears to be broken. What must I do? Or am I at a dead end? Michael [michael@localhost ~]$ cd ./SOE/SOE/src [michael@localhost src]$ hugs __ __ __ __ ___ _ || || || || || || ||__ Hugs 98: Based on the Haskell 98 standard ||___|| ||__|| ||__|| __|| Copyright (c) 1994-2005 ||---|| ___|| World Wide Web: http://haskell.org/hugs || || Bugs: http://hackage.haskell.org/trac/hugs || || Version: September 2006 _ Haskell 98 mode: Restart with command line option -98 to enable extensions Type :? for help Hugs :l Snowflake.lhs ERROR ./SOE.hs - Can't find imported module Graphics.UI.GLFW Hugs --- On Sun, 1/30/11, Brandon S Allbery KF8NH allber...@gmail.com wrote: From: Brandon S Allbery KF8NH allber...@gmail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: haskell-cafe@haskell.org Date: Sunday, January 30, 2011, 2:00 AM -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 1/29/11 21:27 , michael rice wrote: I'm using the OpenGL stuff (GLFW). Same set of problems? None of the lower level libraries support multithreading. If any of those libraries use FFI bindings that run in a bound thread, they'll fail in the threaded runtime. gtk2hs was modified to allow ghci to work, IIRC. - -- brandon s. allbery [linux,solaris,freebsd,perl] allb...@kf8nh.com system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk1FDIkACgkQIn7hlCsL25V6twCgn5JcK8Y0yerY5EkiyJyULOeM 6sYAoLkj8JS/CfquHfHCzl3DbGPKAhgo =Ybo6 -END PGP SIGNATURE- ___ 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 -Inline Attachment Follows- ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org
Re: [Haskell-cafe] Automatically move cursor focus in split window in haskell-mode in emacs on load (C-c C-l) command?
On Sun, Jan 30, 2011 at 11:30 AM, JETkoten jetko...@gmail.com wrote: The way it defaults to now is that the cursor stays in the topmost editing half of the split screen, and I inevitably begin typing and mess up my code and have to do some backspacing and then mouse over to the bottom half. :) I checked on #haskell and #emacs last night, and someone suggested either doing it with elisp or keyboard macros, but I'm not sure how to do the first, and I think the second is not what I'm looking for. I'd like for haskell-mode to otherwise remain the same, and to still use the same C-c C-l key sequence, but I'd just like it to always be set up to add the step in the load sequence of jumping the cursor focus down to the lower half of the split for me. From my .emacs; ;Default behaviour is to always jump to the GHCi window. ;Jump back automatically unless errors. (defadvice haskell-ghci-load-file (after name) (other-window 1)) (ad-activate 'haskell-ghci-load-file t) -- gwern http://www.gwern.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Clear screen in ghci in haskell-mode in emacs?
I'm looking for a way to clear the screen in ghci within emacs. I saw a feature request from a couple of years back for :clear, but it was deleted saying something along the lines of Ctrl-L works fine for me. This is true in my system terminal, however, in emacs, Ctrl-L is already bound to something else. Is there a way to clear the ghci screen that doesn't involve Ctrl-L? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Clear screen in ghci in haskell-mode in emacs?
On Sun, 2011-01-30 at 12:04 -0500, JETkoten wrote: I'm looking for a way to clear the screen in ghci within emacs. I saw a feature request from a couple of years back for :clear, but it was deleted saying something along the lines of Ctrl-L works fine for me. This is true in my system terminal, however, in emacs, Ctrl-L is already bound to something else. Is there a way to clear the ghci screen that doesn't involve Ctrl-L? On UNIX, :!clear -- I believe the Windows equivalent would be :!cls but I haven't tried. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Automatically move cursor focus in split window in haskell-mode in emacs on load (C-c C-l) command?
On 1/30/11 11:37 AM, Gwern Branwen wrote: On Sun, Jan 30, 2011 at 11:30 AM, JETkotenjetko...@gmail.com wrote: The way it defaults to now is that the cursor stays in the topmost editing half of the split screen, and I inevitably begin typing and mess up my code and have to do some backspacing and then mouse over to the bottom half. :) I checked on #haskell and #emacs last night, and someone suggested either doing it with elisp or keyboard macros, but I'm not sure how to do the first, and I think the second is not what I'm looking for. I'd like for haskell-mode to otherwise remain the same, and to still use the same C-c C-l key sequence, but I'd just like it to always be set up to add the step in the load sequence of jumping the cursor focus down to the lower half of the split for me. From my .emacs; ;Default behaviour is to always jump to the GHCi window. ;Jump back automatically unless errors. (defadvice haskell-ghci-load-file (after name) (other-window 1)) (ad-activate 'haskell-ghci-load-file t) Thanks! However, this doesn't do anything at all after adding it to my .emacs. Or else maybe it's a problem with the formatting? It looks like parts of the code got line wrapped in replying to my first email. I tried various combinations of moving the various lines around and nothing works. Is the indentation significant in elisp? Anyone know how to get this working? (Gwern, sorry for the double post, I forgot to press Reply All the first time and only mailed my response to you) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal ignores ld-options? - 2011 remix
On Sun, 2011-01-30 at 05:20 -0500, Ryan Newton wrote: I am trying to link a .a file built by a separate makefile into my library. GHC has no problem with it, but I need to convince cabal to do it for the package to be hackage-friendly. There's a thread about this back in 2007: http://www.haskell.org/pipermail/cabal-devel/2007-April/000507.html Is there a method for this now, or is the state of affairs the same as before? Having a Haskell package link against an external C library is straightforward, you just list it in the extra-libraries field. The external library must already be installed on the system however. Bundling a copy of the external library with a cabal package is not quite so easy. You will have to write code in the Setup.hs to call the separate makefile during the build (and perhaps extra steps at configure time too). Your best bet is probably to use the simple build system's hooks API. You can list the library in the extra-libraries field in the .cabal file but you will also need to modify the check for external libraries that are done in the postConf hook (since the separate .a library will not be available at configure time): modify the package description that gets passed to the postConf hook to exclude the library. Duncan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Clear screen in ghci in haskell-mode in emacs?
On Sun, 2011-01-30 at 12:04 -0500, JETkoten wrote: I'm looking for a way to clear the screen in ghci within emacs. In Emacs: M-x erase-buffer ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Code from Haskell School of Expression hanging.
Maybe you could try The HGL package http://hackage.haskell.org/package/HGL and then replace import SOE by import Graphics.SOE. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Code from Haskell School of Expression hanging.
What you see below is what I get. No window opens. System Monitor shows CPU usage negligible. Michael [michael@localhost ~]$ cd ./SOE/SOE/src [michael@localhost src]$ ghci GHCi, version 6.12.3: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package ffi-1.0 ... linking ... done. Prelude :l Snowflake.lhs Ok, modules loaded: Snowflake, SOE. Prelude Snowflake main Loading package old-locale-1.0.0.2 ... linking ... done. Loading package old-time-1.0.0.5 ... linking ... done. Loading package OpenGLRaw-1.1.0.1 ... linking ... done. Loading package GLURaw-1.1.0.0 ... linking ... done. Loading package ObjectName-1.0.0.0 ... linking ... done. Loading package StateVar-1.0.0.0 ... linking ... done. Loading package Tensor-1.0.0.1 ... linking ... done. Loading package OpenGL-2.4.0.1 ... linking ... done. Loading package GLFW-0.4.2 ... linking ... done. Michael --- On Sun, 1/30/11, Paul L nine...@gmail.com wrote: From: Paul L nine...@gmail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: michael rice nowg...@yahoo.com Cc: Daniel Fischer daniel.is.fisc...@googlemail.com, haskell-cafe@haskell.org Date: Sunday, January 30, 2011, 1:03 PM I'm the maintainer of the SOE code. This is rather puzzling, since apparently GLFW works on your setup. I don't think there is much big difference in SOE than the sample GLFW program from the Haskell Wiki. So when you run the SOE program, did you see the window but just all blank? Or you never see the window popping up? Regards,Paul Liu On Sat, Jan 29, 2011 at 7:34 PM, michael rice nowg...@yahoo.com wrote: The sample program (the active version) here runs fine, so the OpenGL GLFW must have been installed properly. Must be the SOE stuff causing the problem. http://www.haskell.org/haskellwiki/GLFW Michael --- On Sat, 1/29/11, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: From: Daniel Fischer daniel.is.fisc...@googlemail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: michael rice nowg...@yahoo.com Date: Saturday, January 29, 2011, 9:37 PM On Sunday 30 January 2011 03:27:55, michael rice wrote: I'm using the OpenGL stuff (GLFW). Same set of problems? No idea, I haven't used a graphics library for a long time. ___ 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] Code from Haskell School of Expression hanging.
Ok, in the GLFW sample program from Haskell Wiki, can you change the GLFW.openWindow line to the following, and try again? GLFW.openWindow (GL.Size 400 400) [GLFW.DisplayStencilBits 8, GLFW.DisplayAlphaBits 8] GLFW.Window Does it still run? Regards, Paul Liu On Sun, Jan 30, 2011 at 10:50 AM, michael rice nowg...@yahoo.com wrote: What you see below is what I get. No window opens. System Monitor shows CPU usage negligible. Michael [michael@localhost ~]$ cd ./SOE/SOE/src [michael@localhost src]$ ghci GHCi, version 6.12.3: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package ffi-1.0 ... linking ... done. Prelude :l Snowflake.lhs Ok, modules loaded: Snowflake, SOE. Prelude Snowflake main Loading package old-locale-1.0.0.2 ... linking ... done. Loading package old-time-1.0.0.5 ... linking ... done. Loading package OpenGLRaw-1.1.0.1 ... linking ... done. Loading package GLURaw-1.1.0.0 ... linking ... done. Loading package ObjectName-1.0.0.0 ... linking ... done. Loading package StateVar-1.0.0.0 ... linking ... done. Loading package Tensor-1.0.0.1 ... linking ... done. Loading package OpenGL-2.4.0.1 ... linking ... done. Loading package GLFW-0.4.2 ... linking ... done. Michael --- On Sun, 1/30/11, Paul L nine...@gmail.com wrote: From: Paul L nine...@gmail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: michael rice nowg...@yahoo.com Cc: Daniel Fischer daniel.is.fisc...@googlemail.com, haskell-cafe@haskell.org Date: Sunday, January 30, 2011, 1:03 PM I'm the maintainer of the SOE code. This is rather puzzling, since apparently GLFW works on your setup. I don't think there is much big difference in SOE than the sample GLFW program from the Haskell Wiki. So when you run the SOE program, did you see the window but just all blank? Or you never see the window popping up? Regards, Paul Liu On Sat, Jan 29, 2011 at 7:34 PM, michael rice nowg...@yahoo.com wrote: The sample program (the active version) here runs fine, so the OpenGL GLFW must have been installed properly. Must be the SOE stuff causing the problem. http://www.haskell.org/haskellwiki/GLFW Michael --- On Sat, 1/29/11, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: From: Daniel Fischer daniel.is.fisc...@googlemail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: michael rice nowg...@yahoo.com Date: Saturday, January 29, 2011, 9:37 PM On Sunday 30 January 2011 03:27:55, michael rice wrote: I'm using the OpenGL stuff (GLFW). Same set of problems? No idea, I haven't used a graphics library for a long time. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Regards, Paul Liu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Instantiation problem
Patrick Browne schrieb: On 29/01/2011 20:56, Henning Thielemann wrote: Is there a reason why you use an individual type for every unit? The existing implementations of typed physical units only encode the physical dimension in types and leave the unit factors to the value level. I found this to be the most natural way. I am studying type classes using examples from the literature [1]. There is no particular intension to implement anything. I am confused about the unit function in the code below. My understanding is: The signature of the unit function is defined in the MetricDescription class. Any valid instantce of MetricDescription will respect the functional dependency (FD): The FD | description - unit is exactly the signature of the unit function. My confusions I do not understand the definitions of unit in the instances. I do not know how the constant 1 can be equated with a *type*, Where did 1 come from? I do not see a constant 1 that is equated with a type. I do not know how the constant 1 can be equated with *two distinct* definitions of the function uint and still produce the following correct results Where is the constant 1 equated with two distinct definitions of 'unit'? Ok, modules loaded: A. *A unit (LengthInMetres 7) Metre *A unit (LengthInCentimetres 7) Centimetre *A 'unit' is a method of the class MetricDescription. The particular implementation of 'unit' is chosen by the compiler according to the type of the actual parameter and result of 'unit'. module A where -- Each member of the Unit class has one operator convertFactorToBaseUnit -- that takes a measurement unit (say metre) and returns a conversion factor for that unit of measurement class Unit unit where convertFactorToBaseUnit :: unit - Double class (Unit unit) = MetricDescription description unit | description - unit where unit :: description - unit valueInUnit :: description - Double valueInBaseUnit :: description - Double Since valueInUnit and valueInBaseUnit do not need the 'unit' type, I would put them in a separate class. valueInBaseUnit d = (convertFactorToBaseUnit(unit d)) * (valueInUnit d) data Dog = Dog deriving Show data Metre = Metre deriving Show data Centimetre = Centimetre deriving Show -- An instance for metres, where the convert factor is 1.0 instance Unit Metre where convertFactorToBaseUnit Metre = 1.0 -- An instance for centimetres, where the convert factor is 0.1 instance Unit Centimetre where convertFactorToBaseUnit Centimetre = 0.1 I assumed that 0.01m = 1cm data LengthInMetres = LengthInMetres Double deriving Show data LengthInCentimetres = LengthInCentimetres Double deriving Show instance MetricDescription LengthInMetres Metre where valueInUnit (LengthInMetres d) = d unit l = Metre If you enable compiler warnings, then the compiler will warn you, that 'l' is not used. You can also write unit _ = Metre instance MetricDescription LengthInCentimetres Centimetre where valueInUnit (LengthInCentimetres d) = d unit l = Centimetre ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Code from Haskell School of Expression hanging.
The expression (the swapped line) on line 12 is all on one line in my code. Michael == [michael@localhost ~]$ ghc --make rat2.hs [1 of 1] Compiling Main ( rat2.hs, rat2.o ) rat2.hs:12:37: Couldn't match expected type `(Int - DisplayBits) - t - DisplayBits' against inferred type `DisplayBits' In the expression: DisplayStencilBits 8 DisplayAlphaBits 8 In the second argument of `openWindow', namely `[DisplayStencilBits 8 DisplayAlphaBits 8]' In a stmt of a 'do' expression: openWindow (Size 400 400) [DisplayStencilBits 8 DisplayAlphaBits 8] Window [michael@localhost ~]$ --- On Sun, 1/30/11, Paul L nine...@gmail.com wrote: From: Paul L nine...@gmail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: michael rice nowg...@yahoo.com Cc: haskell-cafe@haskell.org Date: Sunday, January 30, 2011, 1:57 PM Ok, in the GLFW sample program from Haskell Wiki, can you change the GLFW.openWindow line to the following, and try again? GLFW.openWindow (GL.Size 400 400) [GLFW.DisplayStencilBits 8, GLFW.DisplayAlphaBits 8] GLFW.Window Does it still run? Regards, Paul Liu On Sun, Jan 30, 2011 at 10:50 AM, michael rice nowg...@yahoo.com wrote: What you see below is what I get. No window opens. System Monitor shows CPU usage negligible. Michael [michael@localhost ~]$ cd ./SOE/SOE/src [michael@localhost src]$ ghci GHCi, version 6.12.3: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package ffi-1.0 ... linking ... done. Prelude :l Snowflake.lhs Ok, modules loaded: Snowflake, SOE. Prelude Snowflake main Loading package old-locale-1.0.0.2 ... linking ... done. Loading package old-time-1.0.0.5 ... linking ... done. Loading package OpenGLRaw-1.1.0.1 ... linking ... done. Loading package GLURaw-1.1.0.0 ... linking ... done. Loading package ObjectName-1.0.0.0 ... linking ... done. Loading package StateVar-1.0.0.0 ... linking ... done. Loading package Tensor-1.0.0.1 ... linking ... done. Loading package OpenGL-2.4.0.1 ... linking ... done. Loading package GLFW-0.4.2 ... linking ... done. Michael --- On Sun, 1/30/11, Paul L nine...@gmail.com wrote: From: Paul L nine...@gmail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: michael rice nowg...@yahoo.com Cc: Daniel Fischer daniel.is.fisc...@googlemail.com, haskell-cafe@haskell.org Date: Sunday, January 30, 2011, 1:03 PM I'm the maintainer of the SOE code. This is rather puzzling, since apparently GLFW works on your setup. I don't think there is much big difference in SOE than the sample GLFW program from the Haskell Wiki. So when you run the SOE program, did you see the window but just all blank? Or you never see the window popping up? Regards, Paul Liu On Sat, Jan 29, 2011 at 7:34 PM, michael rice nowg...@yahoo.com wrote: The sample program (the active version) here runs fine, so the OpenGL GLFW must have been installed properly. Must be the SOE stuff causing the problem. http://www.haskell.org/haskellwiki/GLFW Michael --- On Sat, 1/29/11, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: From: Daniel Fischer daniel.is.fisc...@googlemail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: michael rice nowg...@yahoo.com Date: Saturday, January 29, 2011, 9:37 PM On Sunday 30 January 2011 03:27:55, michael rice wrote: I'm using the OpenGL stuff (GLFW). Same set of problems? No idea, I haven't used a graphics library for a long time. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Regards, Paul Liu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Code from Haskell School of Expression hanging.
You missed the comma after the first 8. On Sun, Jan 30, 2011 at 12:15 PM, michael rice nowg...@yahoo.com wrote: The expression (the swapped line) on line 12 is all on one line in my code. Michael == [michael@localhost ~]$ ghc --make rat2.hs [1 of 1] Compiling Main ( rat2.hs, rat2.o ) rat2.hs:12:37: Couldn't match expected type `(Int - DisplayBits) - t - DisplayBits' against inferred type `DisplayBits' In the expression: DisplayStencilBits 8 DisplayAlphaBits 8 In the second argument of `openWindow', namely `[DisplayStencilBits 8 DisplayAlphaBits 8]' In a stmt of a 'do' expression: openWindow (Size 400 400) [DisplayStencilBits 8 DisplayAlphaBits 8] Window [michael@localhost ~]$ --- On *Sun, 1/30/11, Paul L nine...@gmail.com* wrote: From: Paul L nine...@gmail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: michael rice nowg...@yahoo.com Cc: haskell-cafe@haskell.org Date: Sunday, January 30, 2011, 1:57 PM Ok, in the GLFW sample program from Haskell Wiki, can you change the GLFW.openWindow line to the following, and try again? GLFW.openWindow (GL.Size 400 400) [GLFW.DisplayStencilBits 8, GLFW.DisplayAlphaBits 8] GLFW.Window Does it still run? Regards, Paul Liu On Sun, Jan 30, 2011 at 10:50 AM, michael rice nowg...@yahoo.comhttp://mc/compose?to=nowg...@yahoo.com wrote: What you see below is what I get. No window opens. System Monitor shows CPU usage negligible. Michael [michael@localhost ~]$ cd ./SOE/SOE/src [michael@localhost src]$ ghci GHCi, version 6.12.3: http://www.haskell.org/ghc/ http://www.haskell.org/ghc/%C2%A0:? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package ffi-1.0 ... linking ... done. Prelude :l Snowflake.lhs Ok, modules loaded: Snowflake, SOE. Prelude Snowflake main Loading package old-locale-1.0.0.2 ... linking ... done. Loading package old-time-1.0.0.5 ... linking ... done. Loading package OpenGLRaw-1.1.0.1 ... linking ... done. Loading package GLURaw-1.1.0.0 ... linking ... done. Loading package ObjectName-1.0.0.0 ... linking ... done. Loading package StateVar-1.0.0.0 ... linking ... done. Loading package Tensor-1.0.0.1 ... linking ... done. Loading package OpenGL-2.4.0.1 ... linking ... done. Loading package GLFW-0.4.2 ... linking ... done. Michael --- On Sun, 1/30/11, Paul L nine...@gmail.comhttp://mc/compose?to=nine...@gmail.com wrote: From: Paul L nine...@gmail.com http://mc/compose?to=nine...@gmail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: michael rice nowg...@yahoo.comhttp://mc/compose?to=nowg...@yahoo.com Cc: Daniel Fischer daniel.is.fisc...@googlemail.comhttp://mc/compose?to=daniel.is.fisc...@googlemail.com, haskell-cafe@haskell.org http://mc/compose?to=haskell-cafe@haskell.org Date: Sunday, January 30, 2011, 1:03 PM I'm the maintainer of the SOE code. This is rather puzzling, since apparently GLFW works on your setup. I don't think there is much big difference in SOE than the sample GLFW program from the Haskell Wiki. So when you run the SOE program, did you see the window but just all blank? Or you never see the window popping up? Regards, Paul Liu On Sat, Jan 29, 2011 at 7:34 PM, michael rice nowg...@yahoo.comhttp://mc/compose?to=nowg...@yahoo.com wrote: The sample program (the active version) here runs fine, so the OpenGL GLFW must have been installed properly. Must be the SOE stuff causing the problem. http://www.haskell.org/haskellwiki/GLFW Michael --- On Sat, 1/29/11, Daniel Fischer daniel.is.fisc...@googlemail.comhttp://mc/compose?to=daniel.is.fisc...@googlemail.com wrote: From: Daniel Fischer daniel.is.fisc...@googlemail.comhttp://mc/compose?to=daniel.is.fisc...@googlemail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: michael rice nowg...@yahoo.comhttp://mc/compose?to=nowg...@yahoo.com Date: Saturday, January 29, 2011, 9:37 PM On Sunday 30 January 2011 03:27:55, michael rice wrote: I'm using the OpenGL stuff (GLFW). Same set of problems? No idea, I haven't used a graphics library for a long time. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mc/compose?to=Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Regards, Paul Liu -- Regards, Paul Liu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Code from Haskell School of Expression hanging.
Yeah, I got a parse error when it was on two lines and I must have backed over the comma when I put it all on one line. Sorry. Yes, it compiles and runs, just like it did before. Michael --- On Sun, 1/30/11, Paul L nine...@gmail.com wrote: From: Paul L nine...@gmail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: michael rice nowg...@yahoo.com Cc: haskell-cafe@haskell.org Date: Sunday, January 30, 2011, 3:53 PM You missed the comma after the first 8. On Sun, Jan 30, 2011 at 12:15 PM, michael rice nowg...@yahoo.com wrote: The expression (the swapped line) on line 12 is all on one line in my code. Michael == [michael@localhost ~]$ ghc --make rat2.hs [1 of 1] Compiling Main ( rat2.hs, rat2.o ) rat2.hs:12:37: Couldn't match expected type `(Int - DisplayBits) - t - DisplayBits' against inferred type `DisplayBits' In the expression: DisplayStencilBits 8 DisplayAlphaBits 8 In the second argument of `openWindow', namely `[DisplayStencilBits 8 DisplayAlphaBits 8]' In a stmt of a 'do' expression: openWindow (Size 400 400) [DisplayStencilBits 8 DisplayAlphaBits 8] Window [michael@localhost ~]$ --- On Sun, 1/30/11, Paul L nine...@gmail.com wrote: From: Paul L nine...@gmail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: michael rice nowg...@yahoo.com Cc: haskell-cafe@haskell.org Date: Sunday, January 30, 2011, 1:57 PM Ok, in the GLFW sample program from Haskell Wiki, can you change the GLFW.openWindow line to the following, and try again? GLFW.openWindow (GL.Size 400 400) [GLFW.DisplayStencilBits 8, GLFW.DisplayAlphaBits 8] GLFW.Window Does it still run? Regards, Paul Liu On Sun, Jan 30, 2011 at 10:50 AM, michael rice nowg...@yahoo.com wrote: What you see below is what I get. No window opens. System Monitor shows CPU usage negligible. Michael [michael@localhost ~]$ cd ./SOE/SOE/src [michael@localhost src]$ ghci GHCi, version 6.12.3: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package ffi-1.0 ... linking ... done. Prelude :l Snowflake.lhs Ok, modules loaded: Snowflake, SOE. Prelude Snowflake main Loading package old-locale-1.0.0.2 ... linking ... done. Loading package old-time-1.0.0.5 ... linking ... done. Loading package OpenGLRaw-1.1.0.1 ... linking ... done. Loading package GLURaw-1.1.0.0 ... linking ... done. Loading package ObjectName-1.0.0.0 ... linking ... done. Loading package StateVar-1.0.0.0 ... linking ... done. Loading package Tensor-1.0.0.1 ... linking ... done. Loading package OpenGL-2.4.0.1 ... linking ... done. Loading package GLFW-0.4.2 ... linking ... done. Michael --- On Sun, 1/30/11, Paul L nine...@gmail.com wrote: From: Paul L nine...@gmail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: michael rice nowg...@yahoo.com Cc: Daniel Fischer daniel.is.fisc...@googlemail.com, haskell-cafe@haskell.org Date: Sunday, January 30, 2011, 1:03 PM I'm the maintainer of the SOE code. This is rather puzzling, since apparently GLFW works on your setup. I don't think there is much big difference in SOE than the sample GLFW program from the Haskell Wiki. So when you run the SOE program, did you see the window but just all blank? Or you never see the window popping up? Regards, Paul Liu On Sat, Jan 29, 2011 at 7:34 PM, michael rice nowg...@yahoo.com wrote: The sample program (the active version) here runs fine, so the OpenGL GLFW must have been installed properly. Must be the SOE stuff causing the problem. http://www.haskell.org/haskellwiki/GLFW Michael --- On Sat, 1/29/11, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: From: Daniel Fischer daniel.is.fisc...@googlemail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: michael rice nowg...@yahoo.com Date: Saturday, January 29, 2011, 9:37 PM On Sunday 30 January 2011 03:27:55, michael rice wrote: I'm using the OpenGL stuff (GLFW). Same set of problems? No idea, I haven't used a graphics library for a long time. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Regards, Paul Liu -- Regards, Paul Liu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Instantiation problem
On 30/01/2011 19:43, Henning Thielemann wrote: I do not see a constant 1 that is equated with a type. This is due to my misunderstanding of Haskell. After your comments my understanding of the unit function is as follows: 1) In the instance below the argument for unit must have type LengthInMetres instance MetricDescription LengthInMetres Metre where valueInUnit (LengthInMetres d) = d unit l = Metre 2) The constant 1 on the LHS can be replaced _ because it is the fact that unit is defined in this instance the determines the return value. 3) The RHS is not a type but a constructor. 4) The compiler ensures the correct unit function is called for either MetricDescription instances. Thanks for your help, Pat This message has been scanned for content and viruses by the DIT Information Services E-Mail Scanning Service, and is believed to be clean. http://www.dit.ie ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Code from Haskell School of Expression hanging.
Can you try simpler SOE programs, for example, ghci SimpleGraphics, and type main0 at the prompt. Does it show anything? Regards, Paul Liu On Sun, Jan 30, 2011 at 12:59 PM, michael rice nowg...@yahoo.com wrote: Yeah, I got a parse error when it was on two lines and I must have backed over the comma when I put it all on one line. Sorry. Yes, it compiles and runs, just like it did before. Michael --- On Sun, 1/30/11, Paul L nine...@gmail.com wrote: From: Paul L nine...@gmail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: michael rice nowg...@yahoo.com Cc: haskell-cafe@haskell.org Date: Sunday, January 30, 2011, 3:53 PM You missed the comma after the first 8. On Sun, Jan 30, 2011 at 12:15 PM, michael rice nowg...@yahoo.com wrote: The expression (the swapped line) on line 12 is all on one line in my code. Michael == [michael@localhost ~]$ ghc --make rat2.hs [1 of 1] Compiling Main ( rat2.hs, rat2.o ) rat2.hs:12:37: Couldn't match expected type `(Int - DisplayBits) - t - DisplayBits' against inferred type `DisplayBits' In the expression: DisplayStencilBits 8 DisplayAlphaBits 8 In the second argument of `openWindow', namely `[DisplayStencilBits 8 DisplayAlphaBits 8]' In a stmt of a 'do' expression: openWindow (Size 400 400) [DisplayStencilBits 8 DisplayAlphaBits 8] Window [michael@localhost ~]$ --- On Sun, 1/30/11, Paul L nine...@gmail.com wrote: From: Paul L nine...@gmail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: michael rice nowg...@yahoo.com Cc: haskell-cafe@haskell.org Date: Sunday, January 30, 2011, 1:57 PM Ok, in the GLFW sample program from Haskell Wiki, can you change the GLFW.openWindow line to the following, and try again? GLFW.openWindow (GL.Size 400 400) [GLFW.DisplayStencilBits 8, GLFW.DisplayAlphaBits 8] GLFW.Window Does it still run? Regards, Paul Liu On Sun, Jan 30, 2011 at 10:50 AM, michael rice nowg...@yahoo.com wrote: What you see below is what I get. No window opens. System Monitor shows CPU usage negligible. Michael [michael@localhost ~]$ cd ./SOE/SOE/src [michael@localhost src]$ ghci GHCi, version 6.12.3: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package ffi-1.0 ... linking ... done. Prelude :l Snowflake.lhs Ok, modules loaded: Snowflake, SOE. Prelude Snowflake main Loading package old-locale-1.0.0.2 ... linking ... done. Loading package old-time-1.0.0.5 ... linking ... done. Loading package OpenGLRaw-1.1.0.1 ... linking ... done. Loading package GLURaw-1.1.0.0 ... linking ... done. Loading package ObjectName-1.0.0.0 ... linking ... done. Loading package StateVar-1.0.0.0 ... linking ... done. Loading package Tensor-1.0.0.1 ... linking ... done. Loading package OpenGL-2.4.0.1 ... linking ... done. Loading package GLFW-0.4.2 ... linking ... done. Michael --- On Sun, 1/30/11, Paul L nine...@gmail.com wrote: From: Paul L nine...@gmail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: michael rice nowg...@yahoo.com Cc: Daniel Fischer daniel.is.fisc...@googlemail.com, haskell-cafe@haskell.org Date: Sunday, January 30, 2011, 1:03 PM I'm the maintainer of the SOE code. This is rather puzzling, since apparently GLFW works on your setup. I don't think there is much big difference in SOE than the sample GLFW program from the Haskell Wiki. So when you run the SOE program, did you see the window but just all blank? Or you never see the window popping up? Regards, Paul Liu On Sat, Jan 29, 2011 at 7:34 PM, michael rice nowg...@yahoo.com wrote: The sample program (the active version) here runs fine, so the OpenGL GLFW must have been installed properly. Must be the SOE stuff causing the problem. http://www.haskell.org/haskellwiki/GLFW Michael --- On Sat, 1/29/11, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: From: Daniel Fischer daniel.is.fisc...@googlemail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: michael rice nowg...@yahoo.com Date: Saturday, January 29, 2011, 9:37 PM On Sunday 30 January 2011 03:27:55, michael rice wrote: I'm using the OpenGL stuff (GLFW). Same set of problems? No idea, I haven't used a graphics library for a long time. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Regards, Paul Liu -- Regards, Paul Liu -- Regards, Paul Liu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org
Re: [Haskell-cafe] [Haskell] ANNOUNCE: jhc 0.7.7 is out.
On Sun, Jan 30, 2011 at 4:44 AM, Roman Cheplyaka r...@ro-che.info wrote: A few questions about the inclusion of parsec: 1. It is parsec-2, not parsec-3, right? Yes, it is parsec-2. 2.1.0.1 to be exact. 2. Does this change consist of merely inclusion parsec as a standard library, or are there any compiler improvements in this release that made it possible to build parsec? There have been a lot of bug fixes and improvements in this version, I can't remember if any were particularly enabling for parsec or not. I wouldn't be surprised if it didn't work well before this or the last release. John ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Code from Haskell School of Expression hanging.
I tried that yesterday, but here it is again. Michael [michael@localhost ~]$ cd ./SOE/SOE/src [michael@localhost src]$ ghci GHCi, version 6.12.3: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package ffi-1.0 ... linking ... done. Prelude :l SimpleGraphics.lhs [2 of 2] Compiling SimpleGraphics ( SimpleGraphics.lhs, interpreted ) Ok, modules loaded: SimpleGraphics, SOE. *SimpleGraphics main0 Loading package old-locale-1.0.0.2 ... linking ... done. Loading package old-time-1.0.0.5 ... linking ... done. Loading package OpenGLRaw-1.1.0.1 ... linking ... done. Loading package GLURaw-1.1.0.0 ... linking ... done. Loading package ObjectName-1.0.0.0 ... linking ... done. Loading package StateVar-1.0.0.0 ... linking ... done. Loading package Tensor-1.0.0.1 ... linking ... done. Loading package OpenGL-2.4.0.1 ... linking ... done. Loading package GLFW-0.4.2 ... linking ... done. --- On Sun, 1/30/11, Paul L nine...@gmail.com wrote: From: Paul L nine...@gmail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: michael rice nowg...@yahoo.com Cc: haskell-cafe@haskell.org Date: Sunday, January 30, 2011, 5:43 PM Can you try simpler SOE programs, for example, ghci SimpleGraphics, and type main0 at the prompt. Does it show anything? Regards, Paul Liu On Sun, Jan 30, 2011 at 12:59 PM, michael rice nowg...@yahoo.com wrote: Yeah, I got a parse error when it was on two lines and I must have backed over the comma when I put it all on one line. Sorry. Yes, it compiles and runs, just like it did before. Michael --- On Sun, 1/30/11, Paul L nine...@gmail.com wrote: From: Paul L nine...@gmail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: michael rice nowg...@yahoo.com Cc: haskell-cafe@haskell.org Date: Sunday, January 30, 2011, 3:53 PM You missed the comma after the first 8. On Sun, Jan 30, 2011 at 12:15 PM, michael rice nowg...@yahoo.com wrote: The expression (the swapped line) on line 12 is all on one line in my code. Michael == [michael@localhost ~]$ ghc --make rat2.hs [1 of 1] Compiling Main ( rat2.hs, rat2.o ) rat2.hs:12:37: Couldn't match expected type `(Int - DisplayBits) - t - DisplayBits' against inferred type `DisplayBits' In the expression: DisplayStencilBits 8 DisplayAlphaBits 8 In the second argument of `openWindow', namely `[DisplayStencilBits 8 DisplayAlphaBits 8]' In a stmt of a 'do' expression: openWindow (Size 400 400) [DisplayStencilBits 8 DisplayAlphaBits 8] Window [michael@localhost ~]$ --- On Sun, 1/30/11, Paul L nine...@gmail.com wrote: From: Paul L nine...@gmail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: michael rice nowg...@yahoo.com Cc: haskell-cafe@haskell.org Date: Sunday, January 30, 2011, 1:57 PM Ok, in the GLFW sample program from Haskell Wiki, can you change the GLFW.openWindow line to the following, and try again? GLFW.openWindow (GL.Size 400 400) [GLFW.DisplayStencilBits 8, GLFW.DisplayAlphaBits 8] GLFW.Window Does it still run? Regards, Paul Liu On Sun, Jan 30, 2011 at 10:50 AM, michael rice nowg...@yahoo.com wrote: What you see below is what I get. No window opens. System Monitor shows CPU usage negligible. Michael [michael@localhost ~]$ cd ./SOE/SOE/src [michael@localhost src]$ ghci GHCi, version 6.12.3: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package ffi-1.0 ... linking ... done. Prelude :l Snowflake.lhs Ok, modules loaded: Snowflake, SOE. Prelude Snowflake main Loading package old-locale-1.0.0.2 ... linking ... done. Loading package old-time-1.0.0.5 ... linking ... done. Loading package OpenGLRaw-1.1.0.1 ... linking ... done. Loading package GLURaw-1.1.0.0 ... linking ... done. Loading package ObjectName-1.0.0.0 ... linking ... done. Loading package StateVar-1.0.0.0 ... linking ... done. Loading package Tensor-1.0.0.1 ... linking ... done. Loading package OpenGL-2.4.0.1 ... linking ... done. Loading package GLFW-0.4.2 ... linking ... done. Michael --- On Sun, 1/30/11, Paul L nine...@gmail.com wrote: From: Paul L nine...@gmail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: michael rice nowg...@yahoo.com Cc: Daniel Fischer daniel.is.fisc...@googlemail.com, haskell-cafe@haskell.org Date: Sunday, January 30, 2011, 1:03 PM I'm the maintainer of the SOE code. This is rather puzzling, since apparently GLFW works on your setup. I don't think there is much big difference in SOE than the sample
Re: [Haskell-cafe] Instantiation problem
Patrick Browne schrieb: On 30/01/2011 19:43, Henning Thielemann wrote: I do not see a constant 1 that is equated with a type. This is due to my misunderstanding of Haskell. After your comments my understanding of the unit function is as follows: 1) In the instance below the argument for unit must have type LengthInMetres instance MetricDescription LengthInMetres Metre where valueInUnit (LengthInMetres d) = d unit l = Metre 2) The constant 1 on the LHS can be replaced _ because it is the fact that unit is defined in this instance the determines the return value. Btw. the parameter of 'unit' is a lower-case L not a One. 3) The RHS is not a type but a constructor. right ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Code from Haskell School of Expression hanging.
And here's the same with GHC. It never gets to linking and creating an executable the way the GLFW sample program does. Michael === [michael@localhost ~]$ cd ./SOE/SOE/src [michael@localhost src]$ ghc --make SimpleGraphics.lhs [2 of 2] Compiling SimpleGraphics ( SimpleGraphics.lhs, SimpleGraphics.o ) [michael@localhost src]$ --- On Sun, 1/30/11, Paul L nine...@gmail.com wrote: From: Paul L nine...@gmail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: michael rice nowg...@yahoo.com Cc: haskell-cafe@haskell.org Date: Sunday, January 30, 2011, 5:43 PM Can you try simpler SOE programs, for example, ghci SimpleGraphics, and type main0 at the prompt. Does it show anything? Regards, Paul Liu On Sun, Jan 30, 2011 at 12:59 PM, michael rice nowg...@yahoo.com wrote: Yeah, I got a parse error when it was on two lines and I must have backed over the comma when I put it all on one line. Sorry. Yes, it compiles and runs, just like it did before. Michael --- On Sun, 1/30/11, Paul L nine...@gmail.com wrote: From: Paul L nine...@gmail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: michael rice nowg...@yahoo.com Cc: haskell-cafe@haskell.org Date: Sunday, January 30, 2011, 3:53 PM You missed the comma after the first 8. On Sun, Jan 30, 2011 at 12:15 PM, michael rice nowg...@yahoo.com wrote: The expression (the swapped line) on line 12 is all on one line in my code. Michael == [michael@localhost ~]$ ghc --make rat2.hs [1 of 1] Compiling Main ( rat2.hs, rat2.o ) rat2.hs:12:37: Couldn't match expected type `(Int - DisplayBits) - t - DisplayBits' against inferred type `DisplayBits' In the expression: DisplayStencilBits 8 DisplayAlphaBits 8 In the second argument of `openWindow', namely `[DisplayStencilBits 8 DisplayAlphaBits 8]' In a stmt of a 'do' expression: openWindow (Size 400 400) [DisplayStencilBits 8 DisplayAlphaBits 8] Window [michael@localhost ~]$ --- On Sun, 1/30/11, Paul L nine...@gmail.com wrote: From: Paul L nine...@gmail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: michael rice nowg...@yahoo.com Cc: haskell-cafe@haskell.org Date: Sunday, January 30, 2011, 1:57 PM Ok, in the GLFW sample program from Haskell Wiki, can you change the GLFW.openWindow line to the following, and try again? GLFW.openWindow (GL.Size 400 400) [GLFW.DisplayStencilBits 8, GLFW.DisplayAlphaBits 8] GLFW.Window Does it still run? Regards, Paul Liu On Sun, Jan 30, 2011 at 10:50 AM, michael rice nowg...@yahoo.com wrote: What you see below is what I get. No window opens. System Monitor shows CPU usage negligible. Michael [michael@localhost ~]$ cd ./SOE/SOE/src [michael@localhost src]$ ghci GHCi, version 6.12.3: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package ffi-1.0 ... linking ... done. Prelude :l Snowflake.lhs Ok, modules loaded: Snowflake, SOE. Prelude Snowflake main Loading package old-locale-1.0.0.2 ... linking ... done. Loading package old-time-1.0.0.5 ... linking ... done. Loading package OpenGLRaw-1.1.0.1 ... linking ... done. Loading package GLURaw-1.1.0.0 ... linking ... done. Loading package ObjectName-1.0.0.0 ... linking ... done. Loading package StateVar-1.0.0.0 ... linking ... done. Loading package Tensor-1.0.0.1 ... linking ... done. Loading package OpenGL-2.4.0.1 ... linking ... done. Loading package GLFW-0.4.2 ... linking ... done. Michael --- On Sun, 1/30/11, Paul L nine...@gmail.com wrote: From: Paul L nine...@gmail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: michael rice nowg...@yahoo.com Cc: Daniel Fischer daniel.is.fisc...@googlemail.com, haskell-cafe@haskell.org Date: Sunday, January 30, 2011, 1:03 PM I'm the maintainer of the SOE code. This is rather puzzling, since apparently GLFW works on your setup. I don't think there is much big difference in SOE than the sample GLFW program from the Haskell Wiki. So when you run the SOE program, did you see the window but just all blank? Or you never see the window popping up? Regards, Paul Liu On Sat, Jan 29, 2011 at 7:34 PM, michael rice nowg...@yahoo.com wrote: The sample program (the active version) here runs fine, so the OpenGL GLFW must have been installed properly. Must be the SOE stuff causing the problem. http://www.haskell.org/haskellwiki/GLFW Michael --- On Sat, 1/29/11, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: From: Daniel Fischer daniel.is.fisc...@googlemail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: michael rice
Re: [Haskell-cafe] A few days to go before the old server goes down
On 27 January 2011 22:42, Henk-Jan van Tuyl hjgt...@chello.nl wrote: L.S., Only four days until the old Haskell.org server disappears; I found the following missing: http://www.haskell.org/yale/ http://darcs.haskell.org/hfuse/ http://haskell.org/gtk2hs/ http://haskell.org/FranTk http://www.haskell.org/yampa/ http://www.haskell.org/visualhaskell/ http://haskell.org/~kolmodin http://haskell.org/graphics/ http://www.haskell.org/libraries/ http://haskell.org/hdirect/ http://haskell.org/haskore/ http://darcs.haskell.org/wxhaskell/ http://www.haskell.org/all_about_monads http://www.haskell.org/edsl/ http://www.haskell.org/jcp/ http://darcs.haskell.org/yaht http://cvs.haskell.org/darcs/ http://haskell.org/ObjectIO http://www.haskell.org/sitewiki/ http://darcs.haskell.org/~lemmih/ It would also be a shame if useful information would be lost, so copy the pages before it is too late! (The Wayback Machine has no recent copies, or even none at all for some pages.) If they have moved, it would be useful to know whereto, as several HaskellWiki pages have to be updated. Regards, Henk-Jan van Tuyl There also seems to be missing darcs repositories on :- code.haskell.org these do not seem to be accessible on :- code.oldhaskell.cs.yale.edu Is it possible to delay the switch off and to get the missing sub domains on oldhaskell.cs.yale.edu reinstated ? Aaron ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Code from Haskell School of Expression hanging.
SimpleGraphics has a bunch of main programs: main0, main1, main2, main3, and main3book. I sequentially changed each to main and ran all five successfully. Then I did the same for Snowflake.lhs (see code below) which already had a single main function. Michael == [michael@localhost src]$ ghc --make Snowflake -main-is Snowflake Linking Snowflake ... /usr/lib/ghc-6.12.3/libHSrtsmain.a(Main.o): In function `main': (.text+0x10): undefined reference to `ZCMain_main_closure' /usr/lib/ghc-6.12.3/libHSrtsmain.a(Main.o): In function `main': (.text+0x18): undefined reference to `__stginit_ZCMain' collect2: ld returned 1 exit status [michael@localhost src]$ == This code was automatically extracted from a .lhs file that uses the following convention: -- lines beginning with are executable -- lines beginning with are in the text, but not necessarily executable -- lines beginning with | are also in the text, but are often just expressions or code fragments. module Snowflake where import SOE m = 81 :: Int -- multiple of 3 for triangle size x = 250 :: Int -- x and y coordinates of y = 250 :: Int -- center of snowflake colors = [ Magenta, Blue, Green, Red, Yellow ] snowflake :: Window - IO () snowflake w = do drawTri w x y m 0 False -- draw first triangle w/flat top flake w x y m 0 True -- begin recursion to complete job flake :: Window - Int - Int - Int - Int - Bool - IO () flake w x y m c o = do drawTri w x y m c o -- draw second triangle let c1 = (c+1)`mod`5 -- get next color if (m=3) then return () -- if too small, we're done else do flake w (x-2*m) (y-m) (m`div`3) c1 True -- NW flake w (x+2*m) (y-m) (m`div`3) c1 True -- NE flake w x (y+2*m) (m`div`3) c1 True -- S flake w (x-2*m) (y+m) (m`div`3) c1 False -- SW flake w (x+2*m) (y+m) (m`div`3) c1 False -- SE flake w x (y-2*m) (m`div`3) c1 False -- N drawTri :: Window - Int - Int - Int - Int - Bool - IO () drawTri w x y m c o = let d = (3*m) `div` 2 ps = if o then [(x,y-3*m), (x-3*m,y+d), (x+3*m,y+d)] -- side at bottom else [ (x,y+3*m), (x-3*m,y-d), (x+3*m,y-d)] -- side at top in drawInWindow w (withColor (colors !! c) (polygon ps)) main = runGraphics ( do w - openWindow Snowflake Fractal (500,500) drawInWindow w (withColor White (polygon [(0,0),(499,0),(499,499),(0,499)])) snowflake w spaceClose w ) spaceClose :: Window - IO () spaceClose w = do k - getKey w if k==' ' || k == '\x0' then closeWindow w else spaceClose w --- On Sun, 1/30/11, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: From: Daniel Fischer daniel.is.fisc...@googlemail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: haskell-cafe@haskell.org, michael rice nowg...@yahoo.com Date: Sunday, January 30, 2011, 6:48 PM On Monday 31 January 2011 00:27:41, michael rice wrote: And here's the same with GHC. It never gets to linking and creating an executable the way the GLFW sample program does. Michael === [michael@localhost ~]$ cd ./SOE/SOE/src [michael@localhost src]$ ghc --make SimpleGraphics.lhs [2 of 2] Compiling SimpleGraphics ( SimpleGraphics.lhs, SimpleGraphics.o ) [michael@localhost src]$ The module name is not Main, so to get an executable, you have to tell ghc what the Main module is. Assuming SimpleGraphics.lhs contains a main function, $ ghc --make SimpleGraphics -main-is SimpleGraphics should do it. Cheers, Daniel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Code from Haskell School of Expression hanging.
Maybe you want to remove Snowflake.o (or even *.o) and then try compiling it again. Regards, Paul Liu On Sun, Jan 30, 2011 at 4:11 PM, michael rice nowg...@yahoo.com wrote: SimpleGraphics has a bunch of main programs: main0, main1, main2, main3, and main3book. I sequentially changed each to main and ran all five successfully. Then I did the same for Snowflake.lhs (see code below) which already had a single main function. Michael == [michael@localhost src]$ ghc --make Snowflake -main-is Snowflake Linking Snowflake ... /usr/lib/ghc-6.12.3/libHSrtsmain.a(Main.o): In function `main': (.text+0x10): undefined reference to `ZCMain_main_closure' /usr/lib/ghc-6.12.3/libHSrtsmain.a(Main.o): In function `main': (.text+0x18): undefined reference to `__stginit_ZCMain' collect2: ld returned 1 exit status [michael@localhost src]$ == This code was automatically extracted from a .lhs file that uses the following convention: -- lines beginning with are executable -- lines beginning with are in the text, but not necessarily executable -- lines beginning with | are also in the text, but are often just expressions or code fragments. module Snowflake where import SOE m = 81 :: Int -- multiple of 3 for triangle size x = 250 :: Int -- x and y coordinates of y = 250 :: Int -- center of snowflake colors = [ Magenta, Blue, Green, Red, Yellow ] snowflake :: Window - IO () snowflake w = do drawTri w x y m 0 False -- draw first triangle w/flat top flake w x y m 0 True -- begin recursion to complete job flake :: Window - Int - Int - Int - Int - Bool - IO () flake w x y m c o = do drawTri w x y m c o -- draw second triangle let c1 = (c+1)`mod`5 -- get next color if (m=3) then return () -- if too small, we're done else do flake w (x-2*m) (y-m) (m`div`3) c1 True -- NW flake w (x+2*m) (y-m) (m`div`3) c1 True -- NE flake w x(y+2*m) (m`div`3) c1 True -- S flake w (x-2*m) (y+m) (m`div`3) c1 False -- SW flake w (x+2*m) (y+m) (m`div`3) c1 False -- SE flake w x(y-2*m) (m`div`3) c1 False -- N drawTri :: Window - Int - Int - Int - Int - Bool - IO () drawTri w x y m c o = let d = (3*m) `div` 2 ps = if o then [(x,y-3*m), (x-3*m,y+d), (x+3*m,y+d)] -- side at bottom else [ (x,y+3*m), (x-3*m,y-d), (x+3*m,y-d)] -- side at top in drawInWindow w (withColor (colors !! c) (polygon ps)) main = runGraphics ( do w - openWindow Snowflake Fractal (500,500) drawInWindow w (withColor White (polygon [(0,0),(499,0),(499,499),(0,499)])) snowflake w spaceClose w ) spaceClose :: Window - IO () spaceClose w = do k - getKey w if k==' ' || k == '\x0' then closeWindow w else spaceClose w --- On *Sun, 1/30/11, Daniel Fischer daniel.is.fisc...@googlemail.com*wrote: From: Daniel Fischer daniel.is.fisc...@googlemail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: haskell-cafe@haskell.org, michael rice nowg...@yahoo.com Date: Sunday, January 30, 2011, 6:48 PM On Monday 31 January 2011 00:27:41, michael rice wrote: And here's the same with GHC. It never gets to linking and creating an executable the way the GLFW sample program does. Michael === [michael@localhost ~]$ cd ./SOE/SOE/src [michael@localhost src]$ ghc --make SimpleGraphics.lhs [2 of 2] Compiling SimpleGraphics ( SimpleGraphics.lhs, SimpleGraphics.o ) [michael@localhost src]$ The module name is not Main, so to get an executable, you have to tell ghc what the Main module is. Assuming SimpleGraphics.lhs contains a main function, $ ghc --make SimpleGraphics -main-is SimpleGraphics should do it. Cheers, Daniel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Regards, Paul Liu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Code from Haskell School of Expression hanging.
On Monday 31 January 2011 01:11:59, michael rice wrote: SimpleGraphics has a bunch of main programs: main0, main1, main2, main3, and main3book. I sequentially changed each to main and ran all five successfully. For future use, you can do that without changing the file in between, you can pass a module name or a function name to -main-is, in this case a qualified function name: $ ghc -fforce-recomp --make SimpleGraphics -main-is SimpleGraphics.main0 -o simple0 -- that's one line, mail client wraps probably arrow up, change main0 to main1 and the executable name, enter; repeat until done Then I did the same for Snowflake.lhs (see code below) which already had a single main function. Michael == [michael@localhost src]$ ghc --make Snowflake -main-is Snowflake Linking Snowflake ... /usr/lib/ghc-6.12.3/libHSrtsmain.a(Main.o): In function `main': (.text+0x10): undefined reference to `ZCMain_main_closure' /usr/lib/ghc-6.12.3/libHSrtsmain.a(Main.o): In function `main': (.text+0x18): undefined reference to `__stginit_ZCMain' collect2: ld returned 1 exit status [michael@localhost src]$ == The module has not been compiled again, ghc only tries to link, but because it wasn't told that there's going to be an executable when compiling, it didn't create all necessary pieces. Make sure it's recompiled, pass -fforce-recomp on the command line, $ ghc -fforce-recomp --make Snowflake -main-is Snowflake or ( $ touch Snowflake.hs (perhaps, if you're on Windows, there is no touch command) or delete Snowflake.o and/or Snowflake.hi ), then compile with --make -main-is Snowflake ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Code from Haskell School of Expression hanging.
That worked, though not sure why I had to delete the .o file. On to ghci? Michael --- On Sun, 1/30/11, Paul L nine...@gmail.com wrote: From: Paul L nine...@gmail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: michael rice nowg...@yahoo.com Cc: haskell-cafe@haskell.org, Daniel Fischer daniel.is.fisc...@googlemail.com Date: Sunday, January 30, 2011, 7:31 PM Maybe you want to remove Snowflake.o (or even *.o) and then try compiling it again. Regards,Paul Liu On Sun, Jan 30, 2011 at 4:11 PM, michael rice nowg...@yahoo.com wrote: SimpleGraphics has a bunch of main programs: main0, main1, main2, main3, and main3book. I sequentially changed each to main and ran all five successfully. Then I did the same for Snowflake.lhs (see code below) which already had a single main function. Michael == [michael@localhost src]$ ghc --make Snowflake -main-is Snowflake Linking Snowflake ... /usr/lib/ghc-6.12.3/libHSrtsmain.a(Main.o): In function `main': (.text+0x10): undefined reference to `ZCMain_main_closure' /usr/lib/ghc-6.12.3/libHSrtsmain.a(Main.o): In function `main': (.text+0x18): undefined reference to `__stginit_ZCMain' collect2: ld returned 1 exit status [michael@localhost src]$ == This code was automatically extracted from a .lhs file that uses the following convention: -- lines beginning with are executable -- lines beginning with are in the text, but not necessarily executable -- lines beginning with | are also in the text, but are often just expressions or code fragments. module Snowflake where import SOE m = 81 :: Int -- multiple of 3 for triangle size x = 250 :: Int -- x and y coordinates of y = 250 :: Int -- center of snowflake colors = [ Magenta, Blue, Green, Red, Yellow ] snowflake :: Window - IO () snowflake w = do drawTri w x y m 0 False -- draw first triangle w/flat top flake w x y m 0 True -- begin recursion to complete job flake :: Window - Int - Int - Int - Int - Bool - IO () flake w x y m c o = do drawTri w x y m c o -- draw second triangle let c1 = (c+1)`mod`5 -- get next color if (m=3) then return () -- if too small, we're done else do flake w (x-2*m) (y-m) (m`div`3) c1 True -- NW flake w (x+2*m) (y-m) (m`div`3) c1 True -- NE flake w x (y+2*m) (m`div`3) c1 True -- S flake w (x-2*m) (y+m) (m`div`3) c1 False -- SW flake w (x+2*m) (y+m) (m`div`3) c1 False -- SE flake w x (y-2*m) (m`div`3) c1 False -- N drawTri :: Window - Int - Int - Int - Int - Bool - IO () drawTri w x y m c o = let d = (3*m) `div` 2 ps = if o then [(x,y-3*m), (x-3*m,y+d), (x+3*m,y+d)] -- side at bottom else [ (x,y+3*m), (x-3*m,y-d), (x+3*m,y-d)] -- side at top in drawInWindow w (withColor (colors !! c) (polygon ps)) main = runGraphics ( do w - openWindow Snowflake Fractal (500,500) drawInWindow w (withColor White (polygon [(0,0),(499,0),(499,499),(0,499)])) snowflake w spaceClose w ) spaceClose :: Window - IO () spaceClose w = do k - getKey w if k==' ' || k == '\x0' then closeWindow w else spaceClose w --- On Sun, 1/30/11, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: From: Daniel Fischer daniel.is.fisc...@googlemail.com Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging. To: haskell-cafe@haskell.org, michael rice nowg...@yahoo.com Date: Sunday, January 30, 2011, 6:48 PM On Monday 31 January 2011 00:27:41, michael rice wrote: And here's the same with GHC. It never gets to linking and creating an executable the way the GLFW sample program does. Michael === [michael@localhost ~]$ cd ./SOE/SOE/src [michael@localhost src]$ ghc --make SimpleGraphics.lhs [2 of 2] Compiling SimpleGraphics ( SimpleGraphics.lhs, SimpleGraphics.o ) [michael@localhost src]$ The module name is not Main, so to get an executable, you have to tell ghc what the Main module is. Assuming SimpleGraphics.lhs contains a main function, $ ghc --make SimpleGraphics -main-is SimpleGraphics should do it. Cheers, Daniel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Regards, Paul Liu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Automatically move cursor focus in split window in haskell-mode in emacs on load (C-c C-l) command?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 1/30/11 12:13 , JETkoten wrote: ;Default behaviour is to always jump to the GHCi window. ;Jump back automatically unless errors. (defadvice haskell-ghci-load-file (after name) (other-window 1)) (ad-activate 'haskell-ghci-load-file t) I tried various combinations of moving the various lines around and nothing works. Is the indentation significant in elisp? Aside from the comments, wich go to end of line but got broken in this case, no; all that matters is the parens. I suspect it may depend strongly on what version of emacs you're running though. - -- brandon s. allbery [linux,solaris,freebsd,perl] allb...@kf8nh.com system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk1GDB8ACgkQIn7hlCsL25XwUwCfTYktCZ2WuayLprACS79LS8gG td4AnR5WygspwmARIUUeNRm9E++cHOMa =1r0X -END PGP SIGNATURE- ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal ignores ld-options? - 2011 remix
Thanks Duncan, Alas, I don't think it's something I want to install globally on the users machine. It's actually not much code, but I can't get cabal to build it directly because it chokes on the .s assembly files (which are intel syntax not ATT). Right now I'm depending on yasm. The makefile I run just executes the commands listed at the end of this email. After much random monkeying thusfar, I'd be happy with anything that works ;-). Is extra-lib-dirs for an executable supposed to change the search path at runtime? Via extra-libraries I can successfully introduce the dependency on libFOO.so (as reported by ldd). But the search path appears to not be modified (without manually tweaking LD_LIBRARY_PATH -- I'm on ubuntu). This approach is what I was trying to do in commit 0abc7d0a456ee0d818b2https://github.com/rrnewton/intel-aes/commit/0abc7d0a456ee0d818b2313184f0d253aae10e47here: git clone git://github.com/rrnewton/intel-aes.git git checkout 0abc7d0a456ee0d818b2313184f0d253aae10e47 (Note that the makefile in cbits still needs to be run manually in that version.) extra-libraries is only for dynamic libs of the form libXX.so|dylib|dll right? Even if they were globally installed it doesn't help with .a libs, does it? The users guide says A list of extra libraries to link with. -- at the cost of verbosity a bit of elaboration would be much appreciated ;-). In any case, I want to try playing with the hooks that you mentioned. But I have at least one newbish question first. I'm running cabal install inside my package's directory and that doesn't seem to run Setup.hs. Is that not the way to simulate the eventual effect of a user cabal installing from hackage? Cheers, -Ryan P.S. Build commands: gcc -fPIC -O3 -g -Iinclude/ -c src/intel_aes.c -o obj/x64/intel_aes.o yasm -D__linux__ -g dwarf2 -f elf64 asm/x64/iaesx64.s -o obj/x64/iaesx64.o yasm -D__linux__ -g dwarf2 -f elf64 asm/x64/do_rdtsc.s -o obj/x64/do_rdtsc.o ar -r lib/x64/libintel_aes.a obj/x64/intel_aes.o obj/x64/iaesx64.o obj/x64/do_rdtsc.o gcc -shared -dynamic -o lib/x64/libintel_aes.so obj/x64/intel_aes.o obj/x64/iaesx64.o obj/x64/do_rdtsc.o On Sun, Jan 30, 2011 at 12:22 PM, Duncan Coutts duncan.cou...@googlemail.com wrote: On Sun, 2011-01-30 at 05:20 -0500, Ryan Newton wrote: I am trying to link a .a file built by a separate makefile into my library. GHC has no problem with it, but I need to convince cabal to do it for the package to be hackage-friendly. There's a thread about this back in 2007: http://www.haskell.org/pipermail/cabal-devel/2007-April/000507.html Is there a method for this now, or is the state of affairs the same as before? Having a Haskell package link against an external C library is straightforward, you just list it in the extra-libraries field. The external library must already be installed on the system however. Bundling a copy of the external library with a cabal package is not quite so easy. You will have to write code in the Setup.hs to call the separate makefile during the build (and perhaps extra steps at configure time too). Your best bet is probably to use the simple build system's hooks API. You can list the library in the extra-libraries field in the .cabal file but you will also need to modify the check for external libraries that are done in the postConf hook (since the separate .a library will not be available at configure time): modify the package description that gets passed to the postConf hook to exclude the library. Duncan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] A few days to go before the old server goes down
On Sun, Jan 30, 2011 at 5:38 PM, Aaron Gray aaronngray.li...@gmail.com wrote: On 27 January 2011 22:42, Henk-Jan van Tuyl hjgt...@chello.nl wrote: L.S., Only four days until the old Haskell.org server disappears; I found the following missing: http://www.haskell.org/yale/ http://darcs.haskell.org/hfuse/ http://haskell.org/gtk2hs/ http://haskell.org/FranTk http://www.haskell.org/yampa/ http://www.haskell.org/visualhaskell/ http://haskell.org/~kolmodin http://haskell.org/graphics/ http://www.haskell.org/libraries/ http://haskell.org/hdirect/ http://haskell.org/haskore/ http://darcs.haskell.org/wxhaskell/ http://www.haskell.org/all_about_monads http://www.haskell.org/edsl/ http://www.haskell.org/jcp/ http://darcs.haskell.org/yaht http://cvs.haskell.org/darcs/ http://haskell.org/ObjectIO http://www.haskell.org/sitewiki/ http://darcs.haskell.org/~lemmih/ It would also be a shame if useful information would be lost, so copy the pages before it is too late! (The Wayback Machine has no recent copies, or even none at all for some pages.) If they have moved, it would be useful to know whereto, as several HaskellWiki pages have to be updated. Regards, Henk-Jan van Tuyl There also seems to be missing darcs repositories on :- code.haskell.org these do not seem to be accessible on :- code.oldhaskell.cs.yale.edu Is it possible to delay the switch off and to get the missing sub domains on oldhaskell.cs.yale.edu reinstated ? The code.haskell.org server is temporarily down, and should not have been affected by the most recent server move (from what I understand - I'm not involved in these things). Maybe I am mis-interpreting your question, though. Aaron ___ 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] A few days to go before the old server goes down
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 1/31/11 00:04 , Antoine Latter wrote: On Sun, Jan 30, 2011 at 5:38 PM, Aaron Gray aaronngray.li...@gmail.com wrote: On 27 January 2011 22:42, Henk-Jan van Tuyl hjgt...@chello.nl wrote: Only four days until the old Haskell.org server disappears; I found the following missing: For what it's worth, the Internet Wayback Machine (http://web.archive.org) seems to have much if not all of the old haskell.org, so it will continue to be available even after the real server vanishes. - -- brandon s. allbery [linux,solaris,freebsd,perl] allb...@kf8nh.com system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk1GRmEACgkQIn7hlCsL25WMkACeMPs/UOD2FZdA5zxs+a5pd7Mu IccAmwYwX1BzfJxqPD8jWZypR3a7R6Ld =g9fD -END PGP SIGNATURE- ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Splittable random numbers
Hi Cafe, I've included Gladman's efficient, portable C implementation of AES generating random numbers now, and the hardware-accelerated version is working too. I'm currently seeing higher throughput for even the software based version than the builtin stdGen: First, timing with System.Random interface: 13,051,964 random ints generated [System.Random stdGen] ~ 252 cycles/int 15,635 random ints generated [PureHaskell/reference] ~ 210,763 cycles/int 31,159 random ints generated [PureHaskell] ~ 105,757 cycles/int 2,180,488 random ints generated [Gladman inefficient] ~ 1,511 cycles/int 15,015,095 random ints generated [Gladman] ~ 219 cycles/int That seems like a good argument for cryptographic RNGs to me! I'm having a lot of trouble getting cabal to build/install it successfully. You can see what I've got there now. I'd be interested to know if anyone else can build it successfully. It should work -- but only by building the assembly code into a .so and assuming the build directory is /opt/intel-aes ;-). I don't have real numbers for the hardware version yet because the Westmere machine I'm logged into is redhat 5.4 and is giving me GLIBC_2.7 not found errors. You can run it for correctness purposes using an emulation tool called sde (software development emulator)http://software.intel.com/en-us/articles/intel-software-development-emulator/that's based on dynamic binary translation. -Ryan P.S. Checkout command: git clone git://github.com/rrnewton/intel-aes.git On Sat, Jan 29, 2011 at 8:52 AM, Ryan Newton rrnew...@gmail.com wrote: perhaps performance? Is this approach less robust with a faster, non-cryptographic RNG? Yes, I don't understand that either. Is there a reason that using a weaker PRNG in this case is WORSE than using it in the non-splitting case? Is that why there is more of an impetus to use the cryptographic approach in this case? Anyway, taking for granted that the Burton approach is a useful thing to have implemented, I started developing a package for this stuff -- AES based RNG including both a haskell implementation and wrapping an AESNI-based C one . I haven't posted it to Hackage yet, but you can find the git repository here: https://github.com/rrnewton/intel-aes If you build with cabal and run the benchmark-intel-aes-rng executable, it will give you a breakdown like this: How many random numbers can we generate in a second on one thread? Cost of rdtsc (ffi call):83 Approx getCPUTime calls per second: 205,640 Approx clock frequency: 3,306,891,339 First, timing with System.Random interface: 193,178,901 random ints generated [constant zero gen] 14,530,358 random ints generated [System.Random stdGen] 16,346 random ints generated [BurtonGenSlow/reference] 32,965 random ints generated [BurtonGenSlow] Comparison to C's rand(): 118,766,285 random ints generated [rand/store in C loop] 114,668,028 random ints generated [rand / Haskell loop] 114,675,116 random ints generated [rand/store Haskell] At the moment this is Haskell-only, I haven't included the wrapped Intel assembly code library yet. As you can see, the pure-Haskell AES based RNG (BurtonGenSlow) is pretty slow. Would anyone else be interested in running those RNG testing tools (diehard, big crush) on this to make sure it is working correctly? Also I'd be happy if anyone with a performance-oriented-eye would like to take a look at what's going on. Both for the sake of the serial performance (above) and because the parallel performance is currently *mysterious*(see below). I figure one of the main reasons for splittable RNG is deterministic parallel computations. Thus it's important that all threads be able to run the RNG efficiently. Right now, if you look at SimpleRNGBench.hs I'm just running the same RNG on numCapabilities threads. Yet with that simple test I'm running into problems, summarized thus: * I get substantial (3X) variance in program performance on consecutive runs. * I see a minor hit in performance adding -threaded, but going from -N1 to -N4 (even with a single-thread of work) yields a big hit in performance and increase in variance. * -N4 with four actual threads of work is actually pretty good for the pure haskell version. All four threads on my nehalem 3.33ghz can maintain 93% of their throughput in the serial case. BUT the variance problem persists. * I run a busy-wait loop that measures cpu frequency... and this seems to get messed up in threaded mode (even with -qm -qa). I don't know why. * I cannot killThread a haskell thread (forkIO or forkOS) that is currently running a divergent FFI call (safe or unsafe). (See time_c.) You can find the details in the DEVLOG here: https://github.com/rrnewton/intel-aes/blob/master/CHANGELOG
Re: [Haskell-cafe] Gedit Haskell mode plugin indentation
Update. Current version: v0.7 Changelog: Added comma-first list identation. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe