Re: [Haskell-cafe] funct.prog. vs logic prog., practical Haskell
On Sun, Aug 2, 2009 at 12:25, Petr Pudlakd...@pudlak.name wrote: Hi all, I'd like to convince people at our university to pay more attention to functional languages, especially Haskell. Their arguments were that (1) Functional programming is more academic than practical. Which, even if it were true, is an argument *for* instead of *against* teaching it at a university; that is what the word academic means, after all... Thomas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Simple quirk in behavior of `mod`
There are two ways of looking at the mod operator (on integers): 1. As a map from the integers Z to Z/pZ. Then n mod p is defined as: n mod p = { k | k in Z, k = n + ip for some i in Z } Instead of the set, we ususally write its smallest nonnegative element. And yes, in that sense, Z/0Z gives: n mod 0 = { k | k in Z, k = n } = { k } =~ k 2. As the remainder under division by p. Since n mod 0 would be the remainder under division by 0, this correctly gives a division by zero error. I used to think that the definitions were equivalent... apparently not. Thomas On Wed, Jul 22, 2009 at 10:05, Chris Kuklewiczhask...@list.mightyreason.com wrote: Nathan Bloomfield wrote: Hello haskell-cafe; I'm fiddling with this http://cdsmith.wordpress.com/2009/07/20/calculating-multiplicative-inverses-in-modular-arithmetic/ blog post about inverting elements of Z/(p), trying to write the inversion function in pointfree style. This led me to try executing statements like n `mod` 0 which in the ring theoretic sense should be n, at least for integers*. (MathWorld agrees. http://mathworld.wolfram.com/Congruence.html) I agree that (n `mod` 0) ought to be n. Specifically divMod n 0 = (0,n) and quotRem n 0 = (0,n) In (divMod n m) the sign of the remainder is always the same as the sign of m, unless n or m is zero. In (quotRem n m) the sign of the quotient is the product of the signs of n and m, unless n or m is zero. -- Chris ___ 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] What's the status with unicode characters on haddock ?
I ran a little experiment of my own, using a GHC HEAD build of a week or so ago. Here's a hex dump of my test source, so that we can see that it's really UTF-8. $ od -xc Test.hs 000 6f6d 7564 656c 4d20 6961 206e 6877 7265 m o d u l e M a i n w h e r 020 0a65 2d0a 202d 207c 7250 6e69 7374 7420 e \n \n - - | P r i n t s t 040 6568 7420 7865 2074 4822 6c65 6f6c 7720 h e t e x t H e l l o w 060 726f 646c 2e22 2d0a 202d 6548 6572 7327 o r l d . \n - - H e r e ' s 100 6120 6520 7275 206f 6973 6e67 202c 82e2 a e u r o s i g n , 342 202 120 20ac 5528 322b 4130 2943 202c 6e61 2064 254 ( U + 2 0 A C ) , a n d 140 6e61 6520 656c 656d 746e 6f2d 2066 6973 a n e l e m e n t - o f s i 160 6e67 203a 88e2 208a 5528 322b 3032 2941 g n : 342 210 212 ( U + 2 2 0 A ) 200 0a2e 616d 6e69 3a20 203a 4f49 2820 0a29 . \n m a i n : : I O ( ) \n 220 616d 6e69 3d20 7020 7475 7453 4c72 206e m a i n = p u t S t r L n 240 4822 6c65 6f6c 7720 726f 646c 0a22 H e l l o w o r l d \n 256 Then I invoked $ haddock -h Test.hs The generated Main.html contains this tag: META HTTP-EQUIV=Content-Type CONTENT=text/html; charset=UTF-8 Firefox picks this up, because in the View menu, Character Encoding is set to UTF-8. Yet, I see the little blocks instead of the characters from my source file! Why? $ od -xc Main.html ... 0003220 6120 6520 7275 206f 6973 6e67 202c 2004 a e u r o s i g n , 004 ... 0003260 6520 656c 656d 746e 6f2d 2066 6973 6e67 e l e m e n t - o f s i g n 0003300 203a 2004 5528 322b 3032 2941 0a2e 2f3c : 004 ( U + 2 2 0 A ) . \n / It seems that Haddock replaced both characters with a 0x04 (ASCII end-of-transmission) byte! Apparently you've hit a bug in Haddock. Since Haskell source files are UTF-8 by definition, and the HTML file it produces is also UTF-8, this is clearly incorrect behaviour. Thomas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Leaner Haskell.org frontpage
Are there any kind of hard statistics and analytics that we can base this discussion upon? There is always room for improvement, but stumbling around in the dark making blind guesses may not be the best way to go. Although I personally feel that Lenny's proposed page is an improvement, statistics could tell us what actual people actually use the site for. I don't see any tracking code in the page source. Maybe the site admins could install Google Analytics? It's free, easy to install and use, and very informative. (Or some other usage tracker; I merely suggested GA because I use it and know that it works well.) Thomas On Thu, Jul 9, 2009 at 17:53, hask...@kudling.de wrote: I never said we should only expose 7 links. Take for example the task Find out more about this Haskell i heared about. You would need to scan the right half of the front page and you need to scan the left part of the page. There you need to scan About, it could be explained under Why use Haskell? or Language definition or Haskell in 5 steps or Learning Haskell or Wiki articles or Blog articles and news. Where should i look? I have to scan a lot of text, i have to keep a lot of options in mind and for my taste the load is too much. Be my limit 7 or 20 links. hask...@kudling.de wrote: Most people feel overwhelmed when confronted with more than 7+-2 items: http://www.smashingmagazine.com/2007/10/09/30-usability-issues-to-be-aware-of/ This refers to the number of items/things people can remember in their short-time memory. This has nothing to do with the maximum number of menu items you should use. There is of course a limit, but there is no reason to limit it to 7+-2. Cheers, -- Jochem Berndsen | joc...@functor.nl GPG: 0xE6FABFAB ___ 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] Leaner Haskell.org frontpage
By the way, the most valuable pixels, right at the top of the page, are wasted on wiki stuff. Compare http://www.haskell.org/ with, for example, http://www.ruby-lang.org/ http://python.org/ If, like the consensus seems to be, the page should be made more friendly to beginners (who are unlikely to want to contribute to the wiki right away), then this should be moved elsewhere, or at the very least made smaller and less obtrusive. Thomas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] simple state monad exercises? (besides labeling trees)
I used the State monad to implement a Brainfuck [1] interpreter a few months ago. It stored the program counter, pointer and the memory of the machine. There might have been a different (better?) way, but as I was trying to learn more about monads, it was an obvious choice. Thomas [1] http://www.muppetlabs.com/~breadbox/bf/ On Mon, Jul 6, 2009 at 18:54, Thomas Hartmantphya...@gmail.com wrote: Can someone give some simple common scenarios where the state monad is useful, besides labeling trees? References to puzzles like those in project Euler or similar would be nice. Thanks! ___ 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] ghc static linking on Windows
You cannot link statically to a .dll file. Either link statically with the so-called import library (.lib) (there are tools to generate one from a .dll, I believe), or link statically with a static build of SQLite, which is also a .lib file. Hope that helps, Thomas On Wed, Jul 1, 2009 at 19:18, GüŸnther Schmidtgue.schm...@web.de wrote: Hi, I tried to compile an app that uses sqlite3.dll with the -optl-static flag and the error message is: C:\ghc\ghc-6.10.3\gcc-lib\ld.exe: cannot find -lsqlite3 collect2: ld returned 1 exit status ___ 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] Half-integer
On Sun, Jun 28, 2009 at 15:24, Andrew Coppinandrewcop...@btinternet.com wrote: I just wrote a small module for dealing with half-integers. (That is, any number I/2 where I is an integer. Note that the set of integers is a subset of this; Wikipedia seems to reserve half-integer for such numbers that are *not* integers.) module HalfInteger where data HalfInteger i instance (Eq i) = Eq (HalfInteger i) instance (Ord i) = Ord (HalfInteger i) instance (Integral i) = Show (HalfInteger i) instance (Integral i) = Num (HalfInteger i) half :: (Num i) = HalfInteger i fromNum :: (Integral i, RealFrac x) = x - HalfInteger i toNum :: (Integral i, Fractional x) = HalfInteger i - x isInteger :: (Integral i) = HalfInteger i - Bool Note carefully that the set of half-integers is *not* closed under multiplication! This means that for certain arguments, there are two reasonable products that could be returned. (E.g., 1/2 * 1/2 = 1/4, so 0 or 1/2 would be a reasonable rounding.) I haven't put a lot of effort into the rounding details of (*) or fromNum; which answer you get is kind of arbitrary. (However, addition and subtraction are exact, and for multiplications where an exact result is possible, you will get that result.) The Show instance outputs strings such as fromInteger 5 fromInteger 5 + half fromInteger (-5) - half depending on the isInteger predicate. Now, the question is... Is this useful enough to be worth putting on Hackage? Out of curiosity, what are *you* using it for? Thomas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What is an expected type ...
On Sun, Jun 28, 2009 at 17:14, michael ricenowg...@yahoo.com wrote: as opposed to an inferred type? There was a thread on haskell-cafe about this a few weeks ago. Here it is in the archives: http://www.haskell.org/pipermail/haskell-cafe/2009-May/062012.html Maybe some post in there might help. Maybe they will all confuse you... :) Thomas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] slow code
How much output does this generate? Does it matter if you send the output to /dev/null? This looks as if the bottleneck might well be in I/O operations, not in the code itself. To find this out, you could rewrite the code in C and see if that makes a difference? Thomas On Sun, Jun 14, 2009 at 20:44, brianbri...@aracnet.com wrote: Haskell Gurus, I have tried to use profiling to tell me what's going on here, but it hasn't helped much, probably because I'm not interpreting the results correctly. Empirically I have determined that the show's are pretty slow, so an alternative to them would be helpful. I replaced the show's with , and compiled with -O2 and not much improvement. I need to write _a lot_ of code in this style. A few words about how best to do this would be helpful. Laziness, infinite lists, uvector ?? Help... Thanks, Brian import Complex import System.IO genData :: Double - Int - (Double - Complex Double) - ([Double], [Complex Double]) genData tstop n f = let deltat = tstop / (fromIntegral n) t = [ fromIntegral(i) * deltat | i - [0..n-1]] in (t, map f t) main = do let (t, y) = genData 100.0E-6 (2 ^ 15) (\x - x :+ 0.0) h - openFile data.txt WriteMode mapM_ (\(x, y) - do hPutStr h (show t) hPutStr h hPutStrLn h (show (realPart y))) (zip t y) hClose h ___ 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: Fwd: [Haskell-cafe] curious about sum
On Sun, Jun 14, 2009 at 21:23, Jochem Berndsenjoc...@functor.nl wrote: Alberto G. Corona wrote: Once more I forgot to send my messages to the haskell cafe list. All the rest of the list which I惴 suscribed to, send the mail replies to the list automatically, but this doesn��. Please, can this be changed?. This comes up every so often, but I would be against this. Your e-mail client should support mailing lists. This list does not fill out the Reply-To header. Many other lists do. I am all for adding it, if there's no specific reason not to. Thomas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Logo fun
On Mon, Jun 15, 2009 at 10:24, Ketil Maldeke...@malde.org wrote: Luke Palmer lrpal...@gmail.com writes: Nice work, I love this one. :-) Yes, very nice. I do find the lambda and too fat, but I presume that's the way the Haskell logo looks. Also, I think the right edges of the thick part of the batteries should be aligned, so that the little knob on the + extends further than the flat end of the -. For purely aestethic reasons, I agree, and that's how I originally did it. But then I realized that this does not make sense. Open any battery compartment and you'll see that the end of the knob on the + side is aligned with the flat end of the – side. Moreover, in this way the original width of the logo remains exactly the same. I'm not sure if that really matters, though. Thomas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Logo fun
On Fri, Jun 12, 2009 at 11:25, Thomas Davietom.da...@gmail.com wrote: With various people's ideas taken into account, I've created a new version of my attempt: http://www.cs.kent.ac.uk/people/rpg/tatd2/logo-1.png http://www.cs.kent.ac.uk/people/rpg/tatd2/logo-1.svg I think the yellow/black is easily enough to highlight it as a battery, and saves adding gradients etc, that can become awkward if the logo is ever used in printing. Bob I like this last version a lot, except that the minus sign should be the same width and height as the horizontal bar of the plus sign. How about this? http://thomas.home.fmf.nl/haskell-platform-logo-bob-mod.svg It's an Inkscape svg file, easily editable. Thomas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Wiki user accounts
This runs on MediaWiki, right? How about adding a CAPTCHA for account registrations? http://www.mediawiki.org/wiki/Extension:ConfirmEdit And, more generally: http://www.mediawiki.org/wiki/Manual:Combating_spam Cheers, Thomas On Fri, Jun 12, 2009 at 18:46, Gwern Branwengwe...@gmail.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA512 On Fri, Jun 12, 2009 at 11:58 AM, Philippa Cowderoy wrote: I'm hearing reports of people having difficulty obtaining accounts on the Haskell wiki, without which it is impossible to make edits. Currently, account creation is disabled as an anti-spam measure, and the idea is for people to mail the admin and request an account. If this is to work, accounts need to be granted reasonably quickly - so far, I'm aware of a case where after 4 days there has been no response. This is particularly problematic for Anglohaskell, as signups and the like are via the wiki page - as a temporary workaround, I'll (and anyone else willing to lend a hand who already has an account) have to make edits on others' behalf, which is a serious inconvenience for both myself and attendees, as well as something of a barrier to entry. What's going on, and how can we speed things up? Presumably Ashley is busy. http://haskell.org/haskellwiki/?title=Special%3AListusersgroup=sysop There are only 3 bureaucrats/admins; one is a dummy account, one is Ashley, and one is John Peterson (who hasn't edited for a year). One solution would be to have Ashley re-enable user registrations. This has been suggested before, but no one knows how bad the spam would be. Another solution would be to sysop a few users to admin/bureaucrat, so that even if a few are inactive or away, the rest can handle requests. If I might suggest some users we might give the bit to: myself, dons, Magnus Therning, Neil Mitchell, and byorgey. All have been editing the wiki for some time, some have administrator experience on Wikipedia, and all have commit bits for various Haskell repos (and so presumably can be trusted). (Of course, this list isn't intended to be exhaustive; they're just who comes to mind looking over Recent Changes.) - -- gwern -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) iEYEAREKAAYFAkoyhm8ACgkQvpDo5Pfl1oLTzACfff/rM02Fy/b/VbCwIqgaWO/B 39QAnAkZGKyOTg2zVpDw7NcwNkaED7Ln =KXdO -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] Logo fun
I would like to have a go at it. Could you maybe upload the vector version somewhere? Thanks, Thomas On Thu, Jun 11, 2009 at 13:22, Eugene Kirpichovekirpic...@gmail.com wrote: The idea is pretty cool, but at first sight the batteries look like a graphical glitch. Probably some antialiasing or smoothening is needed.. 2009/6/11 Deniz Dogan deniz.a.m.do...@gmail.com: 2009/6/11 Thomas Davie tom.da...@gmail.com: We had a lot of fun deciding Haskell's new logo, and while I don't agree with the final result, it would be nice if we could now start consistently using it. With that in mind, I realised that the Haskell Platform's logo is totally different, and did a quick mock up of a version reflecting the current Haskell logo. It needs someone with the original vector graphics to have a play and improve it a little bit, but hopefully you'll se a concept you like. Here's the logo, continuing on the batteries included theme: http://www.cs.kent.ac.uk/people/rpg/tatd2/HaskellBatteries.png I'd appreciate comments, suggestions, and possibly either access to the vector version of our current logo, or someone producing a nice version of this. Bob I love this suggestion! Maybe we should make the batteries look more battery-ish though. I think that especially the minus sign is a bit unclear, so maybe we could make the signs heavier? -- Deniz Dogan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Eugene Kirpichov Web IR developer, market.yandex.ru ___ 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] Applying Data.Map
On Tue, Jun 9, 2009 at 15:23, michael ricenowg...@yahoo.com wrote: import Data.Map (Map) (fromList,!) ??? import qualified Data.Map as Map (fromList,!) ??? Because ! is an operator, you need to enclose it in parentheses. Also, the (Map) in the import is already the list of things you are importing; you can just add to that. So do the following: Import these without qualification: import Data.Map (Map, fromList, (!)) Import everything else (actually including Map, fromList and (!)) with qualification Map: import qualified Data.Map as Map Cheers, Thomas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Building network package on Windows
On Mon, Jun 8, 2009 at 02:04, Iavor Diatchkiiavor.diatc...@gmail.com wrote: Hello, Here is an update, in case anyone else runs into the same problem. My understanding, is that the problem was caused by a mistake in the configure script for the network package, which after (correctly) detecting that IPv6 functionality was not available on my platform, it (incorrectly) tried to gain this functionality by redefining the version of my platform. Concretely, apparently I have Windows Vista Basic Home Edition, which seems to identify itself as version 0x400, while the missing functions are only available on versions of windows = 0x501. 0x400 is, if I'm not mistaken, Windows 95. Vista is 0x600 [1]. I don't think they *identify* themselves as such; rather, the program itself specifies what Windows versions it wants to be able to run on. In particular, the macros _WIN32_WINNT and WINVER should be defined as the *minimum* platform version on which the compiled binary is to work. Therefore, if functionality from XP (0x501) is needed, it is perfectly okay to redefine these macros to 0x501. This will flip some switches in included header files that enable declarations for the desired functionality. Of course, the binary will then only run on platforms that actually have this functionality. Hope that clears things up a bit. Thomas [1] http://msdn.microsoft.com/en-us/library/aa383745.aspx ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Slow documentation generation on Hackage
On Mon, Jun 8, 2009 at 11:05, Niemeijer, R.A.r.a.niemei...@tue.nl wrote: which, face it, is going to be all of them; I doubt Haskell is popular enough yet to be the target of DoS attacks Second that. I think this is a good case in which some security should be traded in for usability. And even if a DoS attack occurs, it just causes some downtime... not unlike the certain hours of downtime that the documentation currently has. If there's actually an exploitable leak in Haddock that allows the server to be compromised (not just DoSed), then the current Haddock generation is just as vulnerable. But of course I'm not the maintainers of Hackage... it's up to them to decide. Thomas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hsmagick crash
On Mon, Jun 8, 2009 at 13:11, Ron de Bruijnr...@gamr7.com wrote: Mark Wassell schreef: Have you tried http://hackage.haskell.org/cgi-bin/hackage-scripts/package/pngload ? Hi Mark, I just did: import Codec.Image.PNG png_file_to_2d_array file = do either_error_string_or_png - loadPNGFile file either (\s - error $ (png_file_to_2d_array) ++ s) (\png - putStrLn (show (dimensions png)) ) either_error_string_or_png and then calling it gives: *** Exception: (png_file_to_2d_array) failed to parse chunk IHDR, (line 1, column 1): unexpected 0x0 expecting valid colorType: supported Ct2,Ct6 Testing this code with the PNG file from [1] gives me (png_file_to_2d_array) PNG_transparency_demonstration_2.png (line 1, column 1): unexpected 0x2d I guess that proves that it's not just you, but not much else. Thomas [1] http://upload.wikimedia.org/wikipedia/commons/9/9a/PNG_transparency_demonstration_2.png ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] using phantom types to validate html
I have been thinking about this same problem a while ago, and found that HaXml [1] can generate Haskell types from a DTD schema. However, the code that you need to build HTML from that is quite verbose. Being no expert in Haskell, I talked to Twan van Laarhoven, who came up with something [2] that looks quite similar to your solution. It allows you to write stuff like this: test = html $ body [p [x,em y], ul [li 1, li 2]] Your use of phantom types looks a lot like his. The main difference with your solution is that Twan's generates strings right away, instead of using an intermediate data structure. Whether or not this is desirable depends on the application, I guess. A slight disadvantage is that the monomorphism restriction doesn't allow you to use the same value as children of two nodes of different types. In practice, this will probably not occur often. The linked file provides a workaround, but NoMonomorphismRestriction will of course also work. Generating such code for the full HTML spec, or any XML for that matter, while also including more advanced validation rules like only 1 head section would be an interesting exercise. If you manage to pull this off, I'm definitely interested. Hope this helps, Thomas [1] http://www.cs.york.ac.uk/fp/HaXml/ [2] http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2581#a2582 On Sat, Jun 6, 2009 at 20:41, Mathijs Kwikbluescreen...@gmail.com wrote: Hi all, Please have a look at http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2575#a2575 I wanted to use the typesystem to mandate businesslogic (in this case w3c validation rules). Thanks to some helpful people in #haskell I learned a bit about phantom types. Please let me know if I implemented them correctly. Also this little experiment raises some questions: The code becomes very verbose if there are more elements added or more rules to check. Since repetitive code can be a source of error, and hellish to maintain, I would like to know if there's some way to get this generated, or maybe there's some meta-programming stuff I don't know about. Another thing I can't figure out yet is how to do more advanced validation rules like an html element cannot have 2 head sections, or (made up) a span element isn't allowed to be a child(any level deep) of a p element. I think this would ask for an exponentially growing number of strange types and classes. Am I right? Just to be clear: this is just some practice to use the typesystem. I'm well aware that just using runtime validation checks will be a lot easier and clearer in most cases. Thanks, Mathijs ___ 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] Static link to packages on Hackage?
http://hackage.haskell.org/packages/archive/HSH/latest/doc/html/HSH.html does take me to a page that says HSH-2.0.0: Library to mix shell scripting with Haskell programs in the blue bar at the top. Maybe some kind of cache? Did you try flushing your browser cache and refreshing? Am I missing something? Thomas On Thu, Jun 4, 2009 at 15:20, John Goerzenjgoer...@complete.org wrote: Hi, I'd like to be able to put a static link to the Haddock docs for the current version of various packages on my homepage. Right now, I can't find any such URL; they all look like: http://hackage.haskell.org/packages/archive/HSH/2.0.0/doc/html/HSH.html I'd like if there could be something like: http://hackage.haskell.org/packages/archive/HSH/latest/doc/html/HSH.html Incidentally, you can click on this latest URL but it doesn't go to the correct version. I can't just link to the package page either, because sometimes it won't have docs (such as shortly after I've uploaded a new version). Ideas? ___ 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 small puzzle: inTwain as function of foldr
Possible, yes. Efficient, not really. inTwain = foldr (\x (ls, rs) - if length ls == length rs then (x:ls, rs) else (x:(init ls), (last ls):rs)) ([], []) I have a hunch that everything that reduces a list to a fixed-size data structure can be expressed as a fold, simply by carrying around as much intermediate state as necessary. But I'm too lazy and inexperienced to prove this. Thomas On Thu, Jun 4, 2009 at 16:22, Martijn van Steenbergenmart...@van.steenbergen.nl wrote: Bonjour café, A small puzzle: Consider the function inTwain that splits a list of even length evenly into two sublists: inTwain Hello world! (Hello ,world!) Is it possible to implement inTwain such that the recursion is done by one of the standard list folds? Is there a general way to tell if a problem can be expressed as a fold? Thank you, Martijn. ___ 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] attaching a ghci session to another process
What comes to my mind is that you could launch your program from inside GHCi, instead of the other way round. Just write an IO () function that spawns a new thread for the window, graphics, input handling and all that. Call this function from GHCi and your window will appear. Then write some other function that communicates with that thread through one of Haskell's thread communication mechanisms. I am no expert on all this, so I hope this makes some kind of sense, but maybe there is a better solution around. Thomas On Thu, May 28, 2009 at 22:27, Kevin Smith k2msm...@gmail.com wrote: I am starting to get more involved with haskell programming and I'd like to create a program where I can use the interactive loop in ghci to run a haskell functions that create graphics in a separate openGL window. This would be a separate interactive window from the terminal i am running ghci in and have it's own event-loop/thread of execution. For a very simple example, I would have a haskel function called w = window , which when executed would create an openGL window (inside a seprate window manager shell) and return an identifier to it. A call to another fuinction might be obj = cube [..] w whch would draw an cube in the window. etc. The openGL would have it's own event loop running to handle mouse/keyboard and refresh events which means that I would be able to manipuolate the camera with the mouse (pan, zoom, rotate etc.). This would be separate fromt he ghci input loop running in the original terminal window. The graphics part of this is easy for me, I have this implemented in other langauges, but what i would like to do is create a functional programming environment for prototyping in 3D, so I would like to have a haskell session which I can attach to this 3D environment. Any comments/feedback on the architecture/design of such a program would be appreciated. thanks ___ 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] the problem of design by negation
On Thu, May 21, 2009 at 00:54, Michael Mossey m...@alumni.caltech.edu wrote: I call it design by negation. When asked to justify his design, the lead software architect explains everything that *wouldn't* work. We couldn't have a unique key for every entry because blah blah blah. We couldn't use a garbage collector because blah blah. We couldn't write a sugar layer because then you have to document it separately blah blah. So the chosen design seems to be the only thing left after eliminating everything you can't do. I want to aspire to positive design. I want to list the goals, and think of design as making clever choices that meet all the goals. I think there is often a good default solution which is so obvious that experienced software architects won't even bother to mention. This is the case for both examples that you mention (unique keys in a database, garbage collection). They then go on to give reasons why the default solution would not work in their case. Thomas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Removing mtl from the Haskell Platform
On Thu, May 14, 2009 at 10:14, Wolfgang Jeltsch g9ks1...@acme.softbase.org wrote: 4) The identifiers State and StateT are flawed. Something of value State s a doesn’t denote a state but a state transformer or however you want to name it. A state monad, i.e. a monad containing a state? If you use it in a sentence in that way, the name State makes sense. StateTransformer or something like that would lead to much confusion with the state transformer transformer that is currently called StateT. I don't really see a good alternative to the name State, and a good thing about it is that it is short. Oh, bikesheds ought to be brown, of course. Cheers, Thomas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] GSoC project for EclipseFP
Hi all, I'm happy to announce that my Google Summer of Code project proposal, titled Extend EclipseFP functionality for Haskell, has been accepted! This means that I will be working on EclipseFP during the upcoming months. For the uninitiated, EclipseFP is a plugin for the Eclipse IDE that makes Haskell support possible. Currently it is fairly limited, but I hope to bring it to a state in which I can start using it for some larger projects of my own. Live type checking and type inference, and all that jazz. This will be powered by the Scion library by Thomas Schilling (nominolo), who is also my GSoC mentor. More information is on my new blog: http://eclipsefp.wordpress.com/ Cheers, Thomas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] EclipseFP proposal for Google Summer of Code
To everyone involved in the Google Summer of Code program, I have submitted a GSoC proposal to work on EclipseFP, the Haskell plugin for Eclipse. The proposal is crossposted to both haskell.org and the Eclipse Foundation, each in their respective templates. This is also stated at the top of the proposal. I send this e-mail because of possible scheduling issues: I will be away starting on April 15. So, if you want to ask me things, have suggestions for improvement, or want to do an interview or something, this can only be done *before* that date. This is also stated in the proposal, but since I have no idea how the proposals are processed by the mentoring organizations, I figured that an explicit notification would be a good idea. For your convenience, here are links to the proposal. haskell.org version: http://socghop.appspot.com/student_proposal/show/google/gsoc2009/thomastc/t12376710 and also on http://docs.google.com/Doc?id=dfmvb7sr_13fzdg5qhr Eclipse Foundation version: http://socghop.appspot.com/student_proposal/show/google/gsoc2009/thomastc/t123867654843 and also on http://docs.google.com/Doc?id=dfmvb7sr_15gb9258fg If my schedule causes any problems, please let me know. Also, comments on the proposal in general would be much appreciated. Thanks, Thomas P.S. I hope it's okay that I post this to the haskell-cafe list as well; since haskell.org has no GSoC-specific mailing list, it seems to be the most appropriate place that I could find. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe