Re: [Haskell-cafe] Word128, Word256
To have it defined is one thing. To actually implement i128 and i256 is quite another thing. Are you willing to actually do all of the work necessary to implement the unboxed i128 code? Dream away! 2009/10/22 Maurício CA mauricio.antu...@gmail.com Hi, Do you think we could have the range of sizes for Int* and Word* expanded to allow also 128 and 256 bits sizes? My reason is that I have a long standing issue trying to bind to C numerical libraries using complex numbers, as those are usually structs passed by value. See this from GNU GSL: typedef struct { double dat[2]; } gsl_complex; I imagine I could do: type GslComplex = Word128 -- size would depend on architecture and then write foreign declarations to have: get_real :: GslComplex - CDouble get_imag :: GslComplex - CDouble gsl_complex_sin :: GslComplex - GslComplex gsl_complex_cos :: GslComplex - GslComplex Do you think this is a reasonable request? Thanks for your attention, Maurício ___ 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] ANN: GlomeVec, IcoGrid
I just uploaded two packages to hackage. The first package [1] is the vector library used by my haskell ray-tracer, Glome, which has been neglected of late. It's one of the first things I ever wrote in Haskell, so some of the code looks a little strange to me now, but it works pretty well for a wide variety of computational geometry tasks. I also included a perlin noise implementation. I released GlomeVec so that I would have a reasonable vector library to work off of for my other project, which is the IcoGrid library [2]. IcoGrid (Icosahedron Grid) is a library for dealing with grids of hexagons and pentagons wrapped around a sphere. Individual grid cells are identified by an integer, and the library can find all the neighbors of a given cell, it can find all the places where three cells intersect at a point, and it can also tell you where in 3-D space the center of the cell is. (The cells are positioned on the surface of a sphere with unit 1.) The one very useful function I haven't implemented yet is, given an arbitrary point, find the cell that the point belongs in. I posted a screenshot on the Haskell wiki [3] showing an OpenGL application I wrote that uses IcoGrid. My initial goal was to write some sort of simple environmental simulator that can eventually be made into a game. The grid turned out to be a pretty big project by itself, so I turned it into a stand-alone library. Both libraries have haddock docs, but they aren't showing up on hackage. Is there a trick to tell hackage it needs to generate docs, or do I just need to wait for a cron job to run? -jim [1] http://hackage.haskell.org/package/GlomeVec [2] http://hackage.haskell.org/package/IcoGrid [3] http://www.haskell.org/haskellwiki/IcoGrid ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is there a way to embed a Haskell interpreter/compiler in a browser. I think this would be a safer language than JavaScript.
There used to be http://www.haskell.org/haskellwiki/Yhc/Javascript, which is a great plan, but got abandoned (I think). I still hope something like that will return some day (and not just for javascript, I would like to compile haskell to java bytecode or .net). For something that's usable now, have a look at HJScript and HJavaScript. Those are low-level libraries allowing you to generate javascript safely in haskell. Low level because they are the bare minimum that javascript has to offer, but you can probably easily build more higher-level constructs on top of it in haskell. If you need something more stable/complete for now, I advise you to use GWT (Google Web Toolkit). It compiles java source code into javascript, taking care of most browser differences and language oddities, and it has a very nice library to use (also if you don't use java on the server side. It can create fully independent client-side code). I know, it's not haskell, but compared to javascript, java is very safestable. Mathijs On Mon, Oct 26, 2009 at 4:04 AM, Casey Hawthorne cas...@istar.ca wrote: Is there a way to embed a Haskell interpreter/compiler in a browser. I think this would be a safer language than JavaScript. -- Regards, Casey ___ 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] tips on installing System.Console.Readline
Before I ask my main question, incidentally has anyone noticed that the GHCI prompt, on Windows XP, now has auto-completion! (since 6.10) Awesome! I'm trying to install System.Console.Readline on Windows XP. I need to have GNU readline installed first, which I did (by multiple methods). But running 'cabal install readline' it reports that readline is not found. Obviously I need to set a path or environment variable... can anyone help? Thanks, Mike ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hoogle is great but ...
On Sun, Oct 25, 2009 at 2:09 PM, Curt Sampson c...@starling-software.com wrote: But zaxis, here's another thing to look at. There's usually a view source link beside most of the functions that come up in the Haddock documentation to which Hoogle links. It's worth clicking. You would be surprised (certainly I was!) at how often looking at the definition of a function suddenly makes it quite clear what it does, when the description didn't quite do it for you. (This is one of the joys of Haskell.) I tried that with parsec 3, my brain exploded :) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: xmonad 0.9 is now available!
xmonad is great WM i have ever seen. I have used it for a long time. However, i donot know whether or not it is a *good* combination to use xmonad and lxpanel together insead of dzen . Don Stewart-2 wrote: http://xmonad.org The xmonad dev team is pleased to announce xmonad 0.9! We think this is a great release. The headlines: * Actions.SpawnOn: Windows go to the workspace they were launched on, even if you're no longer viewing that workspace. Especially handy for slow-launching applications like Firefox * Actions.GridSelect: graphically go to, select, do things with windows, workspaces, prompts ... * Many new window layouts: http://is.gd/4BzAI * Many new scriptable actions: http://is.gd/4BzCN * Focus changes across screens with mouse movement, no longer requiring a click, even for empty workspaces. * Improved xmobar/dzen statusbar functions, easier to use, more compositional * New --restart command line flag to restart a running xmonad process. * Supports for multi-module local configuration files * Support for user-defined X event handling * xmonad comes with 180 extensions for enhancing functionality * Over 3000 commits have been made to the project. Extensive change logs: http://haskell.org/haskellwiki/Xmonad/Notable_changes_since_0.8 About: xmonad is a leading tiling window manager, known for its lightness, reliability, extensibility and efficiency. It supports true multiheaded tiling, and rich, rapid customisation. It is also highly portable, running on regular desktops, laptops, netbooks, phones, game consoles, the OLPC, and more. Features: * Very stable, fast, small and simple. * Automatic window tiling and management * First class keyboard support: a mouse is unnecessary * Full support for tiling windows on multi-head displays * Full support for floating, tabbing and decorated windows * Full support for Gnome and KDE utilities * XRandR support to rotate, add or remove monitors * Per-workspace layout algorithms * Per-screens custom status bars * Compositing support * Powerful, stable customisation and reconfiguration * Large extension library * Excellent, extensive documentation * Large, active development team, support and community Get it! Information, screenshots, documentation, tutorials and community resources are available from the xmonad home page: http://xmonad.org The 0.9 release, and its dependencies, are available from hackage.haskell.org: http://hackage.haskell.org/package/xmonad xmonad packages are available in pretty much every package system, including. Debian, Gentoo, Arch, Ubuntu, OpenBSD, NetBSD, FreeBSD, Gobo, NixOS, Source Mage, Slackware and 0.9 packages will appear in coming days (some are already available). On the fly updating to xmonad 0.9 is supported, without losing your session! You can even use cabal-install: $ cabal update $ cabal install xmonad-0.9 $ cabal install xmonad-contrib-0.9 $ xmonad --recompile mod-q Extensions: xmonad comes with a huge library of extensions (now around 15 times the size of xmonad itself), contributed by viewers like you. Extensions allow for all sorts of functionality and enhancements to the window manager, via Haskell in your config file. For more information on using and writing extensions see the webpage. The library of extensions is available from hackage: http://hackage.haskell.org/cgi-bin/xmonad-contrib Full documentation for using and writing your own extensions: http://xmonad.org/documentation.html This release brought to you by the xmonad dev team: Spencer Janssen Don Stewart Adam VogtBrent Yorgey Daniel WagnerDevin Mullins Daniel Schoepe Braden Shepherdson Nicolas PouillardRoman Cheplyaka Gwern BranwenLukas Mai Featuring code contributions from over 80 developers: Aaron DenneyJason Creighton Alec Berryman Alex Tarkovsky Alexandre BuisseAndrea Rossato Austin SeippBas van Dijk Ben VouiBrandon Allbery Chris Mears Christian Thiemann Clemens Fruhwirth Daniel Neri Anders Engstrom Dave Harrison David Glasser David Lazar Dmitry KurochkinDominik Bruhn Dougal Stanton Eric Mertens Ferenc Wagner Jan Vornberger Hans Philipp Annen Ivan Tarasov Ivan VeselovJamie Webb Jeremy Apthorp Malebria Joachim BreitnerJoachim Fasting Joe Thornber
Re: [Haskell-cafe] ANNOUNCE: xmonad 0.9 is now available!
2009/10/26 zaxis z_a...@163.com: xmonad is great WM i have ever seen. I have used it for a long time. However, i donot know whether or not it is a *good* combination to use xmonad and lxpanel together insead of dzen . Take a look at XMonad.Prompt from xmonad-contrib, it's sick. -- Deniz Dogan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How come pattern match does not recognize this code style?
On Mon, Oct 26, 2009 at 6:08 AM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Ah, I see. The reason I have to use my style is the same as others: the list is too long You don't have to put everything on the same line, you just have to indent the rest of the pattern a bit more than the first line : case bala of [ bala , bala , bala ] - bala bala bala _ - bala -- Jedaï ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: ghci can't find Paths_ module created by cabal
On Wed, 2009-10-21 at 22:31 -0500, Thomas Hartman wrote: from my bash hints file: thart...@ubuntu:~/haskellInstalls/gititthartman_ghci_with_data_files Loading a package with data files in ghci See http://neilmitchell.blogspot.com/2008/02/adding-data-files-using-cabal.html Snip: The above method works well after a program has been installed, but is harder to work with while developing a program. To alleviate these problems, we can add our own Paths module to the program, for example: module Paths_hoogle where getDataFileName :: FilePath - IO FilePath getDataFileName = return another approach is to: export hoogle_datadir=$PWD because the standard Paths_hoogle module uses these environment variable overrides. Some day, someone is going to implement a ghci mode for cabal, to do the pre-processing and invoke ghci with all the right flags and env vars. See ticket #382. Duncan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Word128, Word256
To have it defined is one thing. To actually implement i128 and i256 is quite another thing. Are you willing to actually do all of the work necessary to implement the unboxed i128 code? Dream away! John Meacham also told me that even if I get there, it wouldn't do what I want (use it to support complex numbers). Can you tell me what are the issues involved? From my naive view, something like CDComplex (mapping to C double _Complex) wouldn't be different than what's done for other basic types. Why am I wrong? Thanks, Maurício ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hoogle is great but ...
On 10/26/09, David Virebayre dav.vire+hask...@gmail.com wrote: On Sun, Oct 25, 2009 at 2:09 PM, Curt Sampson c...@starling-software.com wrote: But zaxis, here's another thing to look at. There's usually a view source link beside most of the functions that come up in the Haddock documentation to which Hoogle links. It's worth clicking. You would be surprised (certainly I was!) at how often looking at the definition of a function suddenly makes it quite clear what it does, when the description didn't quite do it for you. (This is one of the joys of Haskell.) I tried that with parsec 3, my brain exploded :) ___ or the printf implementation. I tried to figure it out, then the Cenobites came and got me. Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Word128, Word256
Can you tell me what are the issues involved? From my naive view, something like CDComplex (mapping to C double _Complex) wouldn't be different than what's done for other basic types. Why am I wrong? I think the compiler has to generate assembly code for all basic types. I can also imagine that types like a Word128 or Word256 are not natively supported in most common architectures. But I am no expert in this area. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] example of PortMidi use
hey mike- i think the trouble with your program is that it sends all the events as fast as possible and then terminates -- it is insensitive to their timestamps. probably portmidi's buffer receives them all, starts the first one, and then is destroyed before ever emitting the corresponding off message, leaving the first note hung. i've just been learning haskell and have been using portmidi as a vehicle. here's a demo i've been working on, it seems to work well. it uses Data.Heap (http://hackage.haskell.org/package/heap) as a priority queue to manage the timestamp scheduling and allow you to schedule events nonmonotonically (portmidi expects you to handle this). it also shows how to use the random generator i noticed you asked about. http://code.google.com/p/h1ccup/source/browse/trunk/theory/haskell/src/PMTest.hs i would really appreciate any style/design critiques that anyone could offer! some specific q's: 1) the 'addNote' function has a local predicate 'match', which winds up being called on every member in the queue twice -- but memoizing it would be hard because it is used by the heap's higher order functions ('filter' and 'partition'). how should i handle this? can i expect/rely on any auto-memoizing? 2) because a noteOff event in midi turns off a note no matter how many previous noteOns occurred, 'addNote' needs to be careful to not schedule a noteOff during a previously scheduled note, and remove any previously scheduled noteOff that would prematurely cut off the new note. the alg is a little tricky and it would be nice to prove its correctness -- and there are enough degrees of freedom that QuickCheck would not explore the relevant corner cases. how would one approach this from a curry-howard perspective? 3) i would like the most natural possible musical EDSL, but currently have to write things like 'Dotted $ Triplet $ NoteDur Eighth' rather than 'Dotted Triplet Eighth'. it would be worse if i added a layer of symbols to prevent arbitrary nesting and ordering of 'Dotted' and 'Triplet'. can this be addressed? 4) threadDelay seems to have a resolution of 10ms. isn't that awfully high? (i'm on OSX 10.5.8, ghc 6.10.3). could this possibly because i forkIO the producer, but not the consumer (only the consumer threadDelays)? 5) ski on #haskell wrote 'asksTo' for me (see http://tunes.org/~nef//logs/haskell/09.08.06) -- but it is not as polymorphic as we'd like -- it only works for ReaderT's instead of all MonadReader's. 'asksTo' is for accessing more than one MVar simultaneously inside a ReaderT, one needs to avoid nesting liftIO's (see http://hpaste.org/fastcgi/hpaste.fcgi/view?id=7915). why not allow nested liftIO's, and if there is a good reason, is there a more general solution than asksTo? 6) i would (neurotically) like to work under 'default ()', but this causes zillions of problems that i can't figure out. is there a good strategy for getting all your numbers to work polymorphically? 7) i want to write as paradigmatically as possible, so style advice is very helpful! i've tried to follow the guidelines from the wiki. i didn't see any opportunities to define a new monad, but maybe there are some? the 'addNote' and 'drain' functions, which do the queueing and dequeuing, seem uglier than necessary -- any way to decompose them better? -e On Wed, 14 Oct 2009, Michael Mossey wrote: Can someone give me an example of Sound.PortMidi use? I'm having trouble. This program has bugs---makes sound only intermittently, and seems to have set up some kind of loop that is sending midi messages continuously even after terminating the program: import Sound.PortMidi import Foreign.C msgs = [ (0::CULong,PMMsg 0x9c 0x40 0x40) , (500, PMMsg 0x8c 0x40 0x40) , (1000, PMMsg 0x9c 0x41 0x40) , (1500, PMMsg 0x8c 0x41 0x40) ] main = do let deviceId = 12 initialize = print getDeviceInfo deviceId = print startTime - time let evts = map (\(t,msg) - PMEvent msg (t+startTime)) msgs result - openOutput deviceId 10 case result of Right err - putStrLn (After open: ++ show err) Left stream - do result - writeEvents stream evts putStrLn (After write: ++ show result) close stream return () terminate = print ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Fortran mixed mode arithmetic expressions - Haskell
On Oct 26, 2009, at 01:00 , michael rice wrote: I looked for an exponential operator and grabbed the first one I found. In the Prelude (**) is under the heading Methods, while (^^) is under the heading Numeric Functions. Reasoning? It's correct if perhaps not ideal for someone who doesn't think in terms of Haskell. (**) is a member of a typeclass, whereas (^^) is an independent function; you are expected to check that the typeclass is appropriate for what you're doing. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu electrical and computer engineering, carnegie mellon universityKF8NH PGP.sig 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: attempt-0.0.0
On Sun, Oct 25, 2009 at 4:51 PM, Michael Snoyman mich...@snoyman.com wrote: Comments are most welcome. I would like this to be a suitable replacement for the ubiquitous Maybe, (Either String) and ad-hoc Result data types so often used to report a failure. I'd be very happy to improve the package for the general community. I haven't actually tried writing code with this, just read the api docs. The api makes a lot of sense to me. I'm a Python/Ruby guy. I see Haskell as short like Python, almost fast like C. Your attempt monad thing _makes_ _sense_ to me. One little nit I guess. Python had string as exception for awhile, now they discourage that. There seems to be a historical pattern where the right way to throw exceptions changes from throwing strings to throwing real exception objects. Would it be possible to skip the string one here? Are extensible exceptions too cumbersome for some cases? -- Darrin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Fortran mixed mode arithmetic expressions - Haskell
Hi Brandon, Being new to Haskell, I take it (^) and (^^) would be the preferred exponential operator. When (how,where,why) would one use (**)? Michael --- On Mon, 10/26/09, Brandon S. Allbery KF8NH allb...@ece.cmu.edu wrote: From: Brandon S. Allbery KF8NH allb...@ece.cmu.edu Subject: Re: [Haskell-cafe] Fortran mixed mode arithmetic expressions - Haskell To: michael rice nowg...@yahoo.com Cc: Brandon S. Allbery KF8NH allb...@ece.cmu.edu, haskell-cafe@haskell.org, Daniel Fischer daniel.is.fisc...@web.de Date: Monday, October 26, 2009, 12:16 PM On Oct 26, 2009, at 01:00 , michael rice wrote:I looked for an exponential operator and grabbed the first one I found. In the Prelude (**) is under the heading Methods, while (^^) is under the heading Numeric Functions. Reasoning? It's correct if perhaps not ideal for someone who doesn't think in terms of Haskell. (**) is a member of a typeclass, whereas (^^) is an independent function; you are expected to check that the typeclass is appropriate for what you're doing. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.comsystem administrator [openafs,heimdal,too many hats] allb...@ece.cmu.eduelectrical and computer engineering, carnegie mellon university KF8NH ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Fortran mixed mode arithmetic expressions - Haskell
Hello michael, Monday, October 26, 2009, 7:24:46 PM, you wrote: afair, ** and ^ are different - one is for integers, another for floating-point numbers Hi Brandon, Being new to Haskell, I take it (^) and (^^) would be the preferred exponential operator. When (how,where,why) would one use (**)? Michael --- On Mon, 10/26/09, Brandon S. Allbery KF8NH allb...@ece.cmu.edu wrote: From: Brandon S. Allbery KF8NH allb...@ece.cmu.edu Subject: Re: [Haskell-cafe] Fortran mixed mode arithmetic expressions - Haskell To: michael rice nowg...@yahoo.com Cc: Brandon S. Allbery KF8NH allb...@ece.cmu.edu, haskell-cafe@haskell.org, Daniel Fischer daniel.is.fisc...@web.de Date: Monday, October 26, 2009, 12:16 PM On Oct 26, 2009, at 01:00 , michael rice wrote: I looked for an exponential operator and grabbed the first one I found. In the Prelude (**) is under the heading Methods, while (^^) is under the heading Numeric Functions. Reasoning? It's correct if perhaps not ideal for someone who doesn't think in terms of Haskell. (**) is a member of a typeclass, whereas (^^) is an independent function; you are expected to check that the typeclass is appropriate for what you're doing. -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Fortran mixed mode arithmetic expressions - Haskell
Am Monday 26 October 2009 17:24:46 schrieben Sie: Being new to Haskell, I take it (^) and (^^) would be the preferred exponential operator. When (how,where,why) would one use (**)? The beasts have different types and are for different things: Prelude :i (^) (^) :: (Num a, Integral b) = a - b - a -- Defined in GHC.Real infixr 8 ^ This one raises any number to a nonnegative integral power. A typical implementation would be power by repeated squaring. Prelude :i (^^) (^^) :: (Fractional a, Integral b) = a - b - a -- Defined in GHC.Real infixr 8 ^^ This one allows also negative powers, so the type of base must allow inversion, hence it must belong to Fractional. The exponent must still be an integer, you can't use this for n-th roots or similar. A typical implementation would be power by repeated squaring, followed by (1/) if the exponent is negative. Prelude :i (**) class (Fractional a) = Floating a where ... (**) :: a - a - a ... -- Defined in GHC.Float infixr 8 ** This one raises a floating point number to an arbitrary power, so you can use it for n-th roots. A typical implementation would be b ** e = exp (e*log b). ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: HoleyMonoid-0.1
Hello! I'm happy to announce the first release of HoleyMonoid, a datatype that helps you build monoids with holes in them. The holes are filled in later using normal function application. For example: let holey = now x = . later show . now , y = . later show run holey 3 5 x = 3, y = 5 The library is available on Hackage: http://hackage.haskell.org/package/HoleyMonoid Thanks to David Menendez for the name and Sjoerd Visscher for help with rewriting and simplifying. :-) Martijn. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: attempt-0.0.0
On Mon, Oct 26, 2009 at 6:19 PM, Darrin Thompson darri...@gmail.com wrote: On Sun, Oct 25, 2009 at 4:51 PM, Michael Snoyman mich...@snoyman.com wrote: Comments are most welcome. I would like this to be a suitable replacement for the ubiquitous Maybe, (Either String) and ad-hoc Result data types so often used to report a failure. I'd be very happy to improve the package for the general community. I haven't actually tried writing code with this, just read the api docs. The api makes a lot of sense to me. I'm a Python/Ruby guy. I see Haskell as short like Python, almost fast like C. Your attempt monad thing _makes_ _sense_ to me. One little nit I guess. Python had string as exception for awhile, now they discourage that. There seems to be a historical pattern where the right way to throw exceptions changes from throwing strings to throwing real exception objects. Would it be possible to skip the string one here? Are extensible exceptions too cumbersome for some cases? I'm not sure what you mean. The main method used here *is* real exceptions. If you're referring to the failureString method, I think it's valid for simple use cases. The fact is, it's a little cumbersome (to use your terminology) to actually declare an instance of Exception. For example, if I want an exception for too many hotdogs (?!) I'd have to write: {-# LANGUAGE DeriveDataTypeable #-} -- needs to be at the top of the file import Data.Generics -- needs to be in the import list import Control.Exception -- same data TooManyHotDogs = TooManyHotDogs Int deriving (Show, Typeable) instance Exception TooManyHotDogs Maybe a good approach would be to make it easier to makes Exception types (template Haskell comes to mind). If anyone has any ideas on this front, I'd be happy to hear it. Michael ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] any haskellers in chicago? Impromptu lakeview meetup tomorrow (tuesday) evening.
I'm visiting chicago, and found one other haskeller interested in a haskell meetup tomorrow 7:30 pm lakeview cafe intelligentsia. email thomashartman1 at gmail if you'd like to hook up! this is a relaxed occasion with no fixed agenda other than birds of a feather flocking home. thomas. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hoogle is great but ...
I likewise agree this isn't a job for Hoogle, but on a related note see my previous post in here about needing better documentation (specifically a proper manual for most hackage pages, not just a bare bones API doc): http://www.haskell.org/pipermail/haskell-cafe/2009-October/067969.html -R. Kyle Murphy -- Curiosity was framed, Ignorance killed the cat. On Mon, Oct 26, 2009 at 10:11, David Leimbach leim...@gmail.com wrote: On 10/26/09, David Virebayre dav.vire+hask...@gmail.comdav.vire%2bhask...@gmail.com wrote: On Sun, Oct 25, 2009 at 2:09 PM, Curt Sampson c...@starling-software.com wrote: But zaxis, here's another thing to look at. There's usually a view source link beside most of the functions that come up in the Haddock documentation to which Hoogle links. It's worth clicking. You would be surprised (certainly I was!) at how often looking at the definition of a function suddenly makes it quite clear what it does, when the description didn't quite do it for you. (This is one of the joys of Haskell.) I tried that with parsec 3, my brain exploded :) ___ or the printf implementation. I tried to figure it out, then the Cenobites came and got me. 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 mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Fortran mixed mode arithmetic expressions - Haskell
Got it. No doubt some of this figures into why I was beaten bloody by ghci last night. Is there a number tree somewhere that shows the heirarchy? Michael --- On Mon, 10/26/09, Daniel Fischer daniel.is.fisc...@web.de wrote: From: Daniel Fischer daniel.is.fisc...@web.de Subject: Re: [Haskell-cafe] Fortran mixed mode arithmetic expressions - Haskell To: michael rice nowg...@yahoo.com, haskell-cafe@haskell.org Date: Monday, October 26, 2009, 1:09 PM Am Monday 26 October 2009 17:24:46 schrieben Sie: Being new to Haskell, I take it (^) and (^^) would be the preferred exponential operator. When (how,where,why) would one use (**)? The beasts have different types and are for different things: Prelude :i (^) (^) :: (Num a, Integral b) = a - b - a -- Defined in GHC.Real infixr 8 ^ This one raises any number to a nonnegative integral power. A typical implementation would be power by repeated squaring. Prelude :i (^^) (^^) :: (Fractional a, Integral b) = a - b - a -- Defined in GHC.Real infixr 8 ^^ This one allows also negative powers, so the type of base must allow inversion, hence it must belong to Fractional. The exponent must still be an integer, you can't use this for n-th roots or similar. A typical implementation would be power by repeated squaring, followed by (1/) if the exponent is negative. Prelude :i (**) class (Fractional a) = Floating a where ... (**) :: a - a - a ... -- Defined in GHC.Float infixr 8 ** This one raises a floating point number to an arbitrary power, so you can use it for n-th roots. A typical implementation would be b ** e = exp (e*log b). ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Fortran mixed mode arithmetic expressions - Haskell
http://www.haskell.org/onlinereport/basic.html 6.3 Standard Haskell Classes -Ross On Oct 26, 2009, at 3:13 PM, michael rice wrote: Got it. No doubt some of this figures into why I was beaten bloody by ghci last night. Is there a number tree somewhere that shows the heirarchy? Michael --- On Mon, 10/26/09, Daniel Fischer daniel.is.fisc...@web.de wrote: From: Daniel Fischer daniel.is.fisc...@web.de Subject: Re: [Haskell-cafe] Fortran mixed mode arithmetic expressions - Haskell To: michael rice nowg...@yahoo.com, haskell-cafe@haskell.org Date: Monday, October 26, 2009, 1:09 PM Am Monday 26 October 2009 17:24:46 schrieben Sie: Being new to Haskell, I take it (^) and (^^) would be the preferred exponential operator. When (how,where,why) would one use (**)? The beasts have different types and are for different things: Prelude :i (^) (^) :: (Num a, Integral b) = a - b - a -- Defined in GHC.Real infixr 8 ^ This one raises any number to a nonnegative integral power. A typical implementation would be power by repeated squaring. Prelude :i (^^) (^^) :: (Fractional a, Integral b) = a - b - a -- Defined in GHC.Real infixr 8 ^^ This one allows also negative powers, so the type of base must allow inversion, hence it must belong to Fractional. The exponent must still be an integer, you can't use this for n-th roots or similar. A typical implementation would be power by repeated squaring, followed by (1/) if the exponent is negative. Prelude :i (**) class (Fractional a) = Floating a where ... (**) :: a - a - a ... -- Defined in GHC.Float infixr 8 ** This one raises a floating point number to an arbitrary power, so you can use it for n-th roots. A typical implementation would be b ** e = exp (e*log b). ___ 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] Fortran mixed mode arithmetic expressions - Haskell
On Mon, Oct 26, 2009 at 20:13, michael rice wrote: Got it. No doubt some of this figures into why I was beaten bloody by ghci last night. Is there a number tree somewhere that shows the heirarchy? http://www-bucephalus-org.blogspot.com/2009/09/haskell-number-system-in-one-picture.html Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hoogle is great but ...
On Mon, Oct 26, 2009 at 9:11 AM, David Leimbach leim...@gmail.com wrote: or the printf implementation. I tried to figure it out, then the Cenobites came and got me. QOTW, if I may say so. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hoogle is great but ...
On Mon, Oct 26, 2009 at 1:27 PM, Tom Tobin korp...@korpios.com wrote: On Mon, Oct 26, 2009 at 9:11 AM, David Leimbach leim...@gmail.com wrote: or the printf implementation. I tried to figure it out, then the Cenobites came and got me. QOTW, if I may say so. Only if you like the Hellraiser movies, or Clive Barker's The Hellbound Heart. :-) ___ 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] ANN: GPipe-TextureLoad 1.0.0 and GPipe 1.0.3
I've uploaded a new version of GPipe as well as a utility package for loading textures. GPipe 1.0.3: * Fixes a major bug in the shader generation GPipe-TextureLoad 1.0.0: * Helps loading GPipe textures from file. It is based on the stb-image package, and supports subsets of the JPG, PNG, TGA, BMP and PSD formats. _ Hitta kärleken nu i vår! http://dejting.se.msn.com/channel/index.aspx?trackingid=1002952___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is there a way to embed a Haskell interpreter/compiler in a browser. I think this would be a safer language than JavaScript.
I think it also depends on what exactly you're trying to do. If you're trying to do client side scripting using Haskell (much the way JS is used currently), that is including a Haskell script from some page that's intended to be executed on the client, you can't really do that. As Mathijs pointed out there are some projects that can let you use Haskell to generate JavaScript which provides a reasonable measure of safety (in much the same way that the final binary generated from Haskell is still safe even though machine code itself isn't), although isn't exactly the same thing. If all you want to do is execute some Haskell code inside of the browser process you could always us FFI to use the C plugin hooks to create a Haskell based plugin. Doing that and using something like hint you could even embed a Haskell interpreter inside of the browser, but of course you couldn't rely on something like that being available on any browser except your own. -R. Kyle Murphy -- Curiosity was framed, Ignorance killed the cat. On Mon, Oct 26, 2009 at 03:22, Mathijs Kwik bluescreen...@gmail.com wrote: There used to be http://www.haskell.org/haskellwiki/Yhc/Javascript, which is a great plan, but got abandoned (I think). I still hope something like that will return some day (and not just for javascript, I would like to compile haskell to java bytecode or .net). For something that's usable now, have a look at HJScript and HJavaScript. Those are low-level libraries allowing you to generate javascript safely in haskell. Low level because they are the bare minimum that javascript has to offer, but you can probably easily build more higher-level constructs on top of it in haskell. If you need something more stable/complete for now, I advise you to use GWT (Google Web Toolkit). It compiles java source code into javascript, taking care of most browser differences and language oddities, and it has a very nice library to use (also if you don't use java on the server side. It can create fully independent client-side code). I know, it's not haskell, but compared to javascript, java is very safestable. Mathijs On Mon, Oct 26, 2009 at 4:04 AM, Casey Hawthorne cas...@istar.ca wrote: Is there a way to embed a Haskell interpreter/compiler in a browser. I think this would be a safer language than JavaScript. -- Regards, Casey ___ 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 mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] A 3 line program -- Reid, Don, Daniel
On Oct 25, 2009, at 5:01 PM, Curt Sampson wrote: Actually, you would be having the exact same issues with Java; in UTF-8 mode it would also choke on Latin-1. Yes, but from the 'javac' man-page: -encoding encoding Setsthesourcefileencodingname, suchas EUCJIS/SJIS/ISO8859-1/UTF8. If -encoding is not specified, the platform default converter is used. The corresponding part of the GHC documentation says GHC assumes that source files are ASCII or UTF-8 only, other encodings are not recognised. However, invalid UTF-8 sequences will be ignored in comments, so it is possible to use other encodings such as Latin-1, as long as the non-comment source code is ASCII only. There's no obvious reason why GHC couldn't support any source encoding that the host's iconv() supports. Blaming Haskell for this problem is quite unfair. It is perfectly fair. The problem is not that the original user isn't telling GHC what the encoding is, but that GHC cannot be told. A javac-like -encoding switch on the command line would meet the original need. (If all of this UTF-8 stuff seems annoying to you, consider that in ISO-8859-1 it's not possible to express the simplest Japanese word. And why, exactly, should someone who has no Japanese words to express even care? You have explained why UTF-8 is a good *default*; that does not make choosing it as the *only* option a good idea. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] A 3 line program -- Reid, Don, Daniel
On Oct 26, 2009, at 20:12 , Richard O'Keefe wrote: On Oct 25, 2009, at 5:01 PM, Curt Sampson wrote: The corresponding part of the GHC documentation says GHC assumes that source files are ASCII or UTF-8 only, other encodings are not recognised. However, invalid UTF-8 sequences will be ignored in comments, so it is possible to use other encodings such as Latin-1, as long as the non-comment source code is ASCII only. There's no obvious reason why GHC couldn't support any source encoding that the host's iconv() supports. That would be the Haskell98 Report: Haskell uses the Unicode [11] character set. However, source programs are currently biased toward the ASCII character set used in earlier versions of Haskell . This syntax depends on properties of the Unicode characters as defined by the Unicode consortium. Haskell compilers are expected to make use of new versions of Unicode as they are made available. So yes, it's reasonable to blame the language (spec). -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu electrical and computer engineering, carnegie mellon universityKF8NH PGP.sig 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] tips on installing System.Console.Readline
On Mon, Oct 26, 2009 at 12:52 AM, Michael Mossey m...@alumni.caltech.edu wrote: Before I ask my main question, incidentally has anyone noticed that the GHCI prompt, on Windows XP, now has auto-completion! (since 6.10) Awesome! I'm trying to install System.Console.Readline on Windows XP. I need to have GNU readline installed first, which I did (by multiple methods). But running 'cabal install readline' it reports that readline is not found. Obviously I need to set a path or environment variable... can anyone help? Thanks, Mike ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe Try the --extra-include-dirs and --extra-lib-dirs options to Cabal. If there's a configure script, you might also need to modify the options to that. Alex ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Nice addition to Foreign: castAny
This could be beside castPtr, castCharToCChar etc. castAny :: (Storable a, Storable b) = a - b castAny = unsafePerformIO . genericCast where genericCast :: (Storable a, Storable b) = a - IO b genericCast v = return undefined = \r - allocaBytes (max (sizeOf v) (sizeOf r)) $ \p - poke p v if False then return r else peek (castPtr p) GHCi: let a = -1000 :: Int16 castAny a :: Word16 -- 64536 castAny a :: Ptr () 0xb4c2fc18 castAny (castAny a :: Ptr ()) :: Int16 -1000 let b = pi :: CLDouble b 3.141592653589793 castAny b :: CInt 1413754136 castAny b :: Ptr () 0x54442d18 castAny b :: CFloat 3.3702806e12 castAny b :: Int8 24 At minimum, this is safer than 'unsafeCoerce'. What do you think? Best, Maurício ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: GPS package on Hackage
FYI I've fixed up the GPS package [1] (not previously announced) so it now has a correct distance calculation, new addVector function, and a separate module for the KML export functionality. This is just something I pretty up if/when I need it; let me know if you find it useful and I'll be more likely to maintain it. Features: For Coordinates (single points) Distance, heading and vector calculations Typeclass interface that allows other coordinate schemes (ex: MGRS) to be developed Path distance computation Minimum distance between distinct paths (trivial, computationally expensive) For locations (a point at a given time) and trails (lists of locations) Speed calculation Path smoothing Rest location filtering Basic KML exporting is also available in Data.GPS.KML TODO * Some day I'll have a GPS logger and make a parser for the NEMA format. * Fix or eliminate KML exporting. This should be a different package and is currently an ugly hack. * Add a path intersection algorithm * Make Data.GPS.MGRS Thomas [1] http://hackage.haskell.org/package/gps ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe