Re: [Haskell-cafe] How to disable document in .cabal file?

2013-01-15 Thread Albert Y. C. Lai
On 13-01-15 12:06 AM, Magicloud Magiclouds wrote: I have enabled document in .cabal/config, so I could get document every time I installed libraries or so. But when I compile my own applications, it also takes time on generating non-exist documents. How to disable it just for this project?

Re: [Haskell-cafe] How to disable document in .cabal file?

2013-01-15 Thread Albert Y. C. Lai
On 13-01-15 09:10 PM, Magicloud Magiclouds wrote: So the only way is to use param every time I build this certain project? Really hoping I could disable it in project.cabal The param is for "cabal install" only. So don't use "cabal install". cabal configure # may be skipped usually cabal

Re: [Haskell-cafe] 9.3 - (2 * 4.5) => 0.3000000000000007

2013-01-16 Thread Albert Y. C. Lai
On 13-01-16 10:04 AM, Luis Cabellos wrote: You should read http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.22.6768 If you want to be efficient with floats. Language independent. And also http://floating-point-gui.de/ ___ Haskell-Cafe mailing

Re: [Haskell-cafe] why no replace function in our regular expression libs ?

2013-01-25 Thread Albert Y. C. Lai
On 13-01-25 02:06 PM, Simon Michael wrote: People have put a lot of work into regular expression libraries on haskell. Yet it seems very few of them provide a replace/substitute function - just regex-compat and regepr as far as I know. Why is that ? [...] Secondly, as of today what do y'all do

[Haskell-cafe] TIPS: To Insure Package Sanity

2013-01-30 Thread Albert Y. C. Lai
If you possess multiple instances (may be different versions, may be same version different builds) of a package, life can be hard and confusing. The problems are explained in my http://www.vex.net/~trebla/haskell/sicp.xhtml and faced by many people regularly. (Just read this mailing list.) c

Re: [Haskell-cafe] Next Meetup

2013-02-04 Thread Albert Y. C. Lai
On 13-02-04 02:56 AM, Alfredo Di Napoli wrote: Reverse engineering (aka Google searching) for Hacklab seems to reveal that the location is Edimburgh: Correct? :D There are many Hacklabs worldwide. But this one is Toronto, Canada. I know because Christopher runs the Toronto Haskell Meetup and I

Re: [Haskell-cafe] How to input Unicode string in Haskell program?

2013-02-22 Thread Albert Y. C. Lai
On 13-02-21 04:58 AM, Semyon Kholodnov wrote: — Windows console is locked to one specific local code page, and no codepage contains Latin-1, Cyrillic and Kanji symbols at the same time. Windows console is not locked to an anti-international code page; it is only defaulted to. Use CHCP 65001

Re: [Haskell-cafe] question about: --hyperlink-source

2013-02-22 Thread Albert Y. C. Lai
On 13-02-21 05:18 AM, Doaitse Swierstra wrote: I ran into the problem that for the packages which I install using cabal install The generated html does not contain links to the sources. This issue was raised before in: http://stackoverflow.com/questions/1587635/haddock-for-cabal-installed-mod

Re: [Haskell-cafe] package dependencies should distinguish between API and implementation?

2013-02-26 Thread Albert Y. C. Lai
On 13-02-25 06:50 AM, Johannes Waldmann wrote: or in general, A (and B.1) are baked into ghc, but there is some B.2/B.3 out there which U wants to use. Or is this what already happens? (ghc would notice that B.1.foo is different from B.2.foo. cabal-install would warn, but proceed? Then the effec

Re: [Haskell-cafe] cabal install ghc-mod installs 3 years old version

2013-03-01 Thread Albert Y. C. Lai
On 13-03-01 05:10 AM, Malcolm Wallace wrote: Doesn't Cabal tend to install library packages under the .cabal folder? So blowing it away gets rid of the problematic ones. (And everything else.) You need to perform scientific experiments to refute that claim, then see my http://www.vex.net/~t

Re: [Haskell-cafe] "translating" recursively defined sequence

2013-03-05 Thread Albert Y. C. Lai
On 13-03-05 12:19 AM, Christopher Howard wrote: Hi. My Haskell is (sadly) getting a bit rusty. I was wondering what would be the most straightforward and easily followed "procedure" for translating a recursively defined sequence into a Haskell function. For example, this one from a homework assig

Re: [Haskell-cafe] To seq or not to seq, that is the question

2013-03-10 Thread Albert Y. C. Lai
On 13-03-08 11:53 PM, Edward Z. Yang wrote: Are these equivalent? If not, under what circumstances are they not equivalent? When should you use each? evaluate a >> return b a `seq` return b return (a `seq` b) Let a = div 0 0 (or whatever pure but problematic expression you like)

Re: [Haskell-cafe] Compiled program using OpenGL fails to trigger GPU switch on Mac, but works in GHCi

2013-03-18 Thread Albert Y. C. Lai
On 13-03-18 09:19 AM, Jesper Särnesjö wrote: Interestingly, running the program in GHCi with the -fno-ghci-sandbox flag, causes it to misbehave in the same way as when compiled: Then perhaps to mimic default ghci in hope of getting good results: - compile with -threaded (more candidly, link wi

Re: [Haskell-cafe] A Thought: Backus, FP, and Brute Force Learning

2013-03-20 Thread Albert Y. C. Lai
On 13-03-20 06:54 PM, OWP wrote: For me personally, one thing I enjoy about a typical procedural program is that it allows me to "Brute Force Learn". [...] 1. I believe that you can also stare at functional programs and figure out as much as what you can with procedural programs. It only req

Re: [Haskell-cafe] cabal install pandoc

2013-04-01 Thread Albert Y. C. Lai
On 13-04-01 06:26 AM, Roger Mason wrote: It turned out that there was a stale version of 'array' lurking in the ghc package db. In spite of reinstalling ghc it did not go away until I unregistered it. I think it was persisting because re-installing ghc simply unpacked over the old directory lea

Re: [Haskell-cafe] Haskell is a declarative language? Let's see how easy it is to declare types of things.

2013-04-03 Thread Albert Y. C. Lai
On 13-04-03 07:39 PM, Alexander Solla wrote: There's your problem. Mathematicians do this specifically because it is helpful. If anything, explicit quantifiers and their interpretations are more complicated. People seem to naturally get how scoping works in mathematics until they have to figur

Re: [Haskell-cafe] Haskell is a declarative language? Let's see how easy it is to declare types of things.

2013-04-04 Thread Albert Y. C. Lai
On 13-04-04 01:07 AM, wren ng thornton wrote: When the quantifiers are implicit, we can rely on the unique human ability to DWIM. This is a tremendous advantage when first teaching people about mathematical concerns from a logical perspective. However, once people move beyond the basics of quanti

Re: [Haskell-cafe] Haskell is a declarative language? Let's see how easy it is to declare types of things.

2013-04-06 Thread Albert Y. C. Lai
On 13-04-05 04:56 AM, Tom Ellis wrote: "any" is very ambiguous. Doesn't the problem go away if you replace it with "all"? Yes, that is even better. The world would be simple and elegant if it did things your way, and would still be not too shabby if it did things my way, no? «Learn You a H

Re: [Haskell-cafe] Building the Haskell Platform in Linux

2013-04-14 Thread Albert Y. C. Lai
On 13-04-13 12:19 AM, Daniel Díaz Casanueva wrote: Hi cafe! Probably you all know how to do this, but I myself found confused when building the Haskell Platform in Linux for my first time. I was using Linux for my first time too! The first problem I encountered was to decide what linux packages

Re: [Haskell-cafe] Building the Haskell Platform in Linux

2013-04-14 Thread Albert Y. C. Lai
On 13-04-14 08:12 PM, Daniel Díaz Casanueva wrote: By the way, a random question, what's the memory of the computer you used to build the Platform? I have always used my laptop with 3GB RAM. I have not measured how much is actually needed, or what happens if I provide less.

Re: [Haskell-cafe] customizing haskeline?

2013-04-16 Thread Albert Y. C. Lai
On 13-04-14 10:22 PM, Evan Laforge wrote: I tried to colorize a haskeline prompt by putting control characters in it, but line editing was hopelessly confused, presumably because haskeline doesn't understand control characters and thought the prompt was longer than it really was. http://trac.ha

[Haskell-cafe] conditional branching vs pattern matching: pwn3d by GHC

2013-04-22 Thread Albert Y. C. Lai
When I was writing http://www.vex.net/~trebla/haskell/crossroad.xhtml I wanted to write: branching on predicates and then using selectors is less efficient than pattern matching, since selectors repeat the tests already done by predicates. It is only ethical to verify this claim before writing

Re: [Haskell-cafe] runhaskell flags: What is going on?

2013-05-04 Thread Albert Y. C. Lai
On 13-05-03 10:35 AM, Niklas Hambüchen wrote: runhaskell -fno-warn-unused-matches Myfile.hs [no output whatsoever but exit code 127] runhaskell -fasdf Myfile.hs [no output whatsoever but exit code 127] $ runghc --help Usage: runghc [runghc flags] [GHC flags] module [program args] The rungh

Re: [Haskell-cafe] Cabal config file Guide

2013-05-26 Thread Albert Y. C. Lai
On 13-05-25 04:52 PM, Daniel Díaz Casanueva wrote: As you already know, cabal-install is configured in the file "config". It has a lot of fields, but I didn't find a single place where each field is explained with detail. There is none, but my new and timely http://www.vex.net/~trebla/haskell/

Re: [Haskell-cafe] ANN: custom-hackage

2013-06-16 Thread Albert Y. C. Lai
On 13-06-13 11:09 AM, Niklas Hambüchen wrote: https://github.com/nh2/custom-hackage An (almost trivial) script to generate 00-index.tar.gz which is necessary to run your own `remote-repo`. I write the following critique with much reluctance, since I will be saying a lot of "this cannot possib

Re: [Haskell-cafe] Upgrading GHC 7.6.3 global packages to latest versions

2013-07-02 Thread Albert Y. C. Lai
On 13-06-28 04:06 AM, Rouan van Dalen wrote: Now when I try to install the latest version of the [time] package, I have 2 time packages, 1 in the global package db (the older version), and 1 in the user package db (the newer version). Now I would like subsequent installed packages to always use

Re: [Haskell-cafe] Catch multiple exceptions using 'Control.Exception'

2013-07-07 Thread Albert Y. C. Lai
On 13-07-06 12:12 PM, Nikita Karetnikov wrote: Is there an open sum type or a closed existential type? OCaml has open sum types. I haven't really seen closed existential types. (I have seen some approximations, but each lacks one last bit.) ___ H

Re: [Haskell-cafe] Getting the 'ThreadId' of the calling thread

2013-08-01 Thread Albert Y. C. Lai
On 13-07-29 08:35 AM, Nikita Karetnikov wrote: I feel that a 'myThreadId' action, which is defined in this module [1], is useless, but I'm not sure. I think it will always return the "Map.find: element not in the map" exception because a 'threadMap' contains an empty 'ThreadMap'. Is it right, o

Re: [Haskell-cafe] Alternative name for return

2013-08-06 Thread Albert Y. C. Lai
On 13-08-06 01:14 AM, J. Stutterheim wrote: N.B. I am _not_ proposing that we actually change the name of `return`. I do currently have the opportunity to pick names for common functions in a non-Haskell related project, so I was wondering if there perhaps is a better name for `return`. I su

Re: [Haskell-cafe] Haskell Platform and Leksah on Windows

2013-08-07 Thread Albert Y. C. Lai
On 13-08-07 01:18 AM, Mihai Maruseac wrote: Anyway, he blogged about his problems at http://dorinlazar.ro/haskell-platform-windows-crippled/ and I'm sure that we can work on fixing some of them. To learn Haskell on Windows, and with Haskell Platform already installed, it is very easy and KISS

Re: [Haskell-cafe] Applicative is like an Arrow

2013-08-16 Thread Albert Y. C. Lai
On 13-08-16 03:29 PM, Dan Burton wrote: Idioms are oblivious, arrows are meticulous, monads are promiscuous http://homepages.inf.ed.ac.uk/wadler/papers/arrows-and-idioms/arrows-and-idioms.pdf I much recommend this paper. Underrated, underknown, pinpointing, unifying. __

Re: [Haskell-cafe] GHC and backwards compatibility

2013-08-19 Thread Albert Y. C. Lai
On 13-08-19 10:58 AM, Ketil Malde wrote: b) the output isn't very helpful in tracking down the cause of this problem, it claims that all these packages depend on array-0.4.0.1, which is a lie. Somewhere, somehow, somethings depends on this (or at least a newer version), but I have no clue how to

Re: [Haskell-cafe] sequence causing stack overflow on pretty small lists

2013-08-26 Thread Albert Y. C. Lai
On 13-08-26 04:46 AM, Niklas Hambüchen wrote: Effectively, sequence is a partial function. (Note: We are not trying to obtain a lazy list of random numbers, use any kind of streaming or the likes. We want the list in memory and use it.) We noticed that this problem did not happen if sequence we

Re: [Haskell-cafe] Can I use String without "" in ghci?

2013-09-01 Thread Albert Y. C. Lai
On 13-09-01 02:02 AM, yi lu wrote: I have noticed if *bar* is predefined or it is a number, it can be used as arguments. But can other strings be used this way? Like in bash, we can use *ping 127.0.0.1* where *127.0.0.1* is an argument. Does Bash have a rich type system, like Haskell? Does Has

Re: [Haskell-cafe] Can I use String without "" in ghci?

2013-09-01 Thread Albert Y. C. Lai
On 13-09-01 02:41 AM, Mateusz Kowalczyk wrote: It's a bit like asking whether you can do addition everywhere by just typing the numbers to each other (no cheating and defining number literals as functions ;) ). To your horror, common math language does some of that. When 3 and ½ are typed next

Re: [Haskell-cafe] Readable GHC 7.6.3 docs (Bootstrapped)

2013-09-11 Thread Albert Y. C. Lai
On 13-09-11 07:31 AM, Obscaenvs wrote: since the official version is a bit too TimesNewRoman-y for my ..."developed" taste. I question that. Is it the official CSS, or is it your own browser setting? I see no TimesNewRoman-y here. The official version in my Firefox (Ubuntu 13.04 Desktop): ht

Re: [Haskell-cafe] GLFW not working in Cabal 1.18

2013-09-12 Thread Albert Y. C. Lai
On 13-09-10 09:27 PM, Thiago Negri wrote: The package GLFW is not building in Cabal 1.18. Setup.hs [1] depends on `rawSystemStdInOut` [2] that changed signature between 1.16 and 1.18. Consider "cabal install --cabal-lib-version=1.16". Replace 1.16 by the correct number. Use "ghc-pkg list Caba

Re: [Haskell-cafe] Proposal: New syntax for Haskell

2013-09-16 Thread Albert Y. C. Lai
A specification language is desirable. (Test cases are special cases of specifications. Test-driven development is a revival of the waterfall process.) For specifying interactions (computer-computer or computer-human), I recommend "live sequence charts" of David Harel, or generally any one base

Re: [Haskell-cafe] Mystery of an Eq instance

2013-09-20 Thread Albert Y. C. Lai
On 13-09-20 07:47 AM, damodar kulkarni wrote: *Main> sqrt (10.0) ==3.1622776601683795 True [...] *Main> sqrt (10.0) ==3.16227766016837956435443343 True This is not even specific to Haskell. Every language that provides floating point and floating point equality does this. (To date, P(provi

Re: [Haskell-cafe] Problem with HXT `when`

2013-09-24 Thread Albert Y. C. Lai
On 13-09-21 05:13 AM, Vlatko Basic wrote: I'd like to extract A texts from row with header "Caption", and have come up with this runX $ doc >>> (deep (hasName "tr") -- filter only TRs >>> withTraceLevel 5 traceTree -- s

Re: [Haskell-cafe] Parsec: buildExpressionParser of a different type than parsed term

2007-04-09 Thread Albert Y. C. Lai
Joel Reymont wrote: I'm trying to parse NumExpr > NumExpr (example) which should return a logical expression while parsing numeric terms. I can't figure out how to make buildExpressionParser do this for me since it takes the type of the term parser given to it. If I supply a parser for numeric

Re: [Haskell-cafe] Parsec: buildExpressionParser of a different type than parsed term

2007-04-09 Thread Albert Y. C. Lai
Albert Y. C. Lai wrote: However, you can make two uses of buildExpressionParser, one for numeric expressions and the other for logical expressions. Mutual reference is no problem since, OK, I now see this is easier said than done in most common applications

Re: [Haskell-cafe] Parsec: Help needed with simple parser

2007-04-09 Thread Albert Y. C. Lai
Joel Reymont wrote: My expression is x + 1 where x can be either "Close", or "Close[N]" or "Close[N] of DataM where N and M are positive integers. What happens in my case is that 1 + x parses fine but x + 1 doesn't. In fact, I would be fine with parsing Close + such that it ignores the plus and

Re: [Haskell-cafe] Tutorial on Haskell

2007-04-16 Thread Albert Y. C. Lai
Neil Mitchell wrote: Things like laziness are cool, but are harder to convince a strict programmer that they are useful. Strict programmers like the "yield" command too. The same behaviour can be obtained by laziness, with easier reasoning. That said, strict programmers may or may not like e

Re: [Haskell-cafe] Re: Haskell version of Norvig's Python Spelling Corrector

2007-04-21 Thread Albert Y. C. Lai
I try using WordSet = [String] (plus corresponding change in code) and get great speedup, actually way more than 3x. There was also a memory growth phenomenon using Set String, and replacement by [String] stops that too, now it's constant space (constant = 20M). It is possible to attribute part

Re: [Haskell-cafe] newbie question on ordering

2007-04-22 Thread Albert Y. C. Lai
Nikolay Metchev wrote: data Face = Ace | Two | Three | Four | Five | Six | Seven | Eight | Nine | Ten | Jack | Queen | King deriving (Enum, Show, Eq) listComparator :: (Eq a) => [a] -> a -> a -> Ordering listComparator xs a b = compare x y where x

Re: [Haskell-cafe] Re: Haskell version of Norvig's Python Spelling Corrector

2007-04-23 Thread Albert Y. C. Lai
Albert Y. C. Lai wrote: I try using WordSet = [String] (plus corresponding change in code) and get great speedup, actually way more than 3x. There was also a memory growth phenomenon using Set String, and replacement by [String] stops that too, now it's constant space (constant = 20M).

Re: [Haskell-cafe] Is Excel a FP language?

2007-04-24 Thread Albert Y. C. Lai
Tony Morris wrote: My opposition proposed (after some "weeding out") that there is a distinction between Excel, the application, the GUI and Excel, the language (which we eventually agreed (I think) manifested itself as a .xls file). I say Excel is a functional language. If there needs to be th

Re: [Haskell-cafe] quiry

2007-05-16 Thread Albert Y. C. Lai
Pixel wrote: from http://pleac.sourceforge.net/pleac_haskell/numbers.html#AEN118 : -- "read" handles both octal and hexadecimal when prefixed with 0x or 0o -- here are versions adding the prefix and calling "read" hex s = read ("0x" ++ s) :: Integer oct s = read ("0o" ++ s) :: Integer -- hex "45

[Haskell-cafe] Imagining a G-machine

2007-05-16 Thread Albert Y. C. Lai
A native G-machine --- physical, or chemical, or biological, but not a repressed simulation over the imperative cpu-memory architecture --- is the dream of every lazy-functional programmer of great devotion. If only it became the dominant computing architecture! People would say, Haskell is hig

Re: [Haskell-cafe] global variables

2007-05-17 Thread Albert Y. C. Lai
There is no reality about global variables. Global variables are syntactic sugar for local variables. That is the reality we need to think through. This syntactic sugar streamlines many practical programs and is indeed valuable. ___ Haskell-Cafe maili

Re: [Haskell-cafe] Debunking tail recursion

2007-05-18 Thread Albert Y. C. Lai
Jules Bean wrote: A conversation on #haskell just showed that it's quite hard to explain (at least it is for me) to people attached to tail recursion why that is a red herring in Haskell. What is tail recursion? Suppose (1)x = f y x A participant of the said conversation classified this

Re: [Haskell-cafe] global variables

2007-05-20 Thread Albert Y. C. Lai
Adrian Hey wrote: Also, I don't know if the OP was a noob, but telling people (especially noobs) that if they can't figure out how to solve a problem without using a "global variable" then that must be down to inexperience and general cluelessness on their part just seems wrong to me. It simply i

Re: [Haskell-cafe] Editor

2007-05-21 Thread Albert Y. C. Lai
Michael T. Richter wrote: 1. A real GUI environment that takes into account some of the HID advances made in the past 30 years. (Emacs and Vim don't count, in other words.) I for my life think HID refers to human input devices: keyboard, mouse, joystick, gamepad, pedal, microph

Re: [Haskell-cafe] Re: Editor

2007-05-22 Thread Albert Y. C. Lai
This recent development of the thread leads me to these conclusions and conjectures. * If you want to demonstrate the mouse to be faster than the keyboard, you can contrive an experiment to do so. Example: Randomize occurences of X's in a text, ask to replace them by Y's, but make sure there i

Re: [Haskell-cafe] Currying: The Rationale

2007-05-23 Thread Albert Y. C. Lai
PR Stanley wrote: What is the rationale behind currying? Given map :: (a->b) -> [a]->[b] take :: Int -> [a] -> [a] I can write "map f . take 10" or "take 10 >>> map f". Given tmap :: (a->b, [a]) -> [b] ttake :: (Int, [a]) -> [a] I have to write "\x -> tmap(f, ttake(10, x))". I

Re: [Haskell-cafe] Stack overflow

2007-05-24 Thread Albert Y. C. Lai
Grzegorz wrote: hammingDistance [] _ = 0 hammingDistance _ [] = 0 hammingDistance (x:xs) (y:ys) | x==y = hammingDistance xs ys | otherwise = 1 + hammingDistance xs ys hammingDistance xs ys = h xs ys 0 where h [] _ n = n h _ [] n = n h (x:

Re: [Haskell-cafe] Why this exception occurs ?

2007-05-25 Thread Albert Y. C. Lai
Donald Bruce Stewart wrote: instance Num String anyone? Mwhaha addString xs ys = add 0 xs ys where m = fromEnum (maxBound :: Char) + 1 alu c x y = let s = c + fromEnum x + fromEnum y in if s >= m then (1, s-m) else (0, s) add c (x:xs) (y:ys) = case alu c x

Re: [Haskell-cafe] Cute code [was: The C Equiv of != in Haskell miscommunication thread]

2007-05-29 Thread Albert Y. C. Lai
Vincent Kraeutler wrote: Donald Bruce Stewart wrote: P.S. Have some cute code: Control.Monad.Fix.fix ((1:) . scanl (+) 1) either way, if one of the Masters Of The Shadow Y Style on this list feels like throwing in another koan or two, you'll have at least one thankful audience member ;-

Re: [Haskell-cafe] Control.Monad.State.Strict, mdo and let

2007-05-29 Thread Albert Y. C. Lai
Gracjan Polak wrote: Hi, I stumbled at some interaction of Control.Monad.State.Strict, mdo and let I do not understand. The following program: {-# OPTIONS_GHC -fglasgow-exts #-} module Main where import Control.Monad.State.Strict thenumber :: Float thenumber = flip execState 1.3 $ mdo c <

Re: [Haskell-cafe] The C Equiv of != in Haskell miscommunication thread

2007-05-30 Thread Albert Y. C. Lai
Roberto Zunino wrote: I actually misread the first one as Control.Monad.Fix.fix ((1:) . tail . scanl (+) 1) which is quite nice too, although map (2^) [0..] would be much simpler! ;-) We apply a lesson learned from my last derivation. The lesson was to look at s!!(n+1). s = 1 : tail (sca

Re: [Haskell-cafe] What puts False before True?

2007-06-01 Thread Albert Y. C. Lai
PR Stanley wrote: The question, however, still remains: why False = 0 and True 1? I appreciate that it's so in boolean algebra but why? Why not True = 0 and False = 1? A Boolean value denotees veracity whereas an ordered value concerns magnitude (priority), indeed, order!! Other members have

Re: [Haskell-cafe] newbie question on Parsers from "Programming In Haskell"

2007-06-04 Thread Albert Y. C. Lai
Dan Weston wrote: Is this true? I thought do (like all sugar) was desugared before semantic analysis. So long as you have the right >>=, return, and fail in scope, I would have thought the desugaring is oblivious to their definition (and particularly ignorant of instancing of the Monad typecla

Re: [Haskell-cafe] What puts False before True?

2007-06-04 Thread Albert Y. C. Lai
Scott Brickner wrote: It's actually not arbitrary. [...] A ≤ B iff A ⊆ B A ⊆ B iff (x ∊ A) ⇒ (x ∊ B) Alternatively and dually but equally naturally, A ≥ B iff A ⊆ B iff (x ∊ A) ⇒ (x ∊ B) and then we would have False > True. Many of you are platonists rather than formalists; you have a stro

Re: [Haskell-cafe] What puts False before True?

2007-06-05 Thread Albert Y. C. Lai
PR Stanley wrote: What do the ≤ symbols represent? I see you are still stuck in ISO-8859-1 and deprived of international characters and symbols. (And this reply in ISO-8859-1 too accordingly; normally I use UTF-8.) Unicode and UTF-8 FTW! :) ___

Re: [Haskell-cafe] FP v. OOP

2007-06-06 Thread Albert Y. C. Lai
Michael T. Richter wrote: I'm tempted to quote something about history, learning and repetition now, but won't bother because I suspect most of the people in this mailing list know the quote and have learned from history. Those who have learned from history are bound to helplessly watch it r

Re: [Haskell-cafe] Re: Keys and Maps [Was: Re: I just don't get it (data structures and OO)]

2007-06-07 Thread Albert Y. C. Lai
Justin Bailey wrote: On 6/7/07, Grzegorz <[EMAIL PROTECTED]> wrote: All this hard work for something that in a lesser language would be the unimpressive: universe["Milky Way"]["Sun"] ;-P Well, if you want to get picky there is the '!' operator defined in Data.Map: universe ! "Milky Way" !

Re: [Haskell-cafe] found monad in a comic

2007-06-14 Thread Albert Y. C. Lai
Andrew Coppin wrote: ...is everybody else looking at a different web page to me? *blinks* Everybody is interpreting it differently. (As usual.) I see an unsafePerformIO. :) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org

Re: [Haskell-cafe] Collections

2007-06-19 Thread Albert Y. C. Lai
Take a look at http://www.haskell.org/ghc/docs/latest/html/libraries/index.html There are more elsewhere. I am actually amazed that we have a comprehensive, widely-distributed package for graphs and graph algorithms. I can't say the same about other programming communities (they tend to re-imp

Re: [Haskell-cafe] Collections

2007-06-20 Thread Albert Y. C. Lai
Andrew Coppin wrote: But what kind of thing would you use a general graph for? (Rather than some more specific custom data type.) Representing networks. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/has

Re: [Haskell-cafe] Callback functions?

2007-07-02 Thread Albert Y. C. Lai
Hugh Perkins wrote: > What makes a callback different from any other kind of function? Well... what about inside monads? Does this break purity??? Does this require adding IO to the monad if the callback function does IO? As I'm writing this I kindof have this sense inside me that this is

Re: [Haskell-cafe] Profiling and Threading: never the twain shall meet

2007-07-05 Thread Albert Y. C. Lai
Dougal Stanton wrote: do (hin, hout, herr, ph) <- runInteractiveProcess cmd args Nothing Nothing forkIO $ hPutStr hin content >> hClose hin out <- hGetContents hout return (ph, out) which seems to require threading. If I compile without, it will hang indefinitely, I presume deadlocked.

[Haskell-cafe] A very edgy language (was: A very nontrivial parser)

2007-07-06 Thread Albert Y. C. Lai
Andrew Coppin wrote: Personally, I just try to avoid *all* language extensions - mainly because most of them are utterly incomprehensible. (But then, perhaps that's just because they all cover extremely rare edge cases?) Haskell is an extremely rare edge case to begin with. Non-strict (most i

Re: [Haskell-cafe] A very edgy language

2007-07-06 Thread Albert Y. C. Lai
Donald Bruce Stewart wrote: Give #haskell is a far larger community than: #lisp #erlang #scheme #ocaml As well as #java #javascript #ruby #lua #d #perl6 Maybe we need to reconsider where the (FP) mainstream is now? :-) I don't know. #math is larger th

Re: [Haskell-cafe] A very edgy language

2007-07-07 Thread Albert Y. C. Lai
Donald Bruce Stewart wrote: trebla: I don't know. #math is larger than #accounting. Is it because math is more mainstream than accounting? I bet it is because math is more math is more *interesting* than accounting? :-) With all due respect to accounting, which is a fine profession and a g

Re: [Haskell-cafe] A very edgy language

2007-07-07 Thread Albert Y. C. Lai
Thomas Conway wrote: [great comments on non-strict, static typing, purely functional] Don't worry, I was just writing a sarcasm to an apparent attitude of "X is rare edge iff I can't figure out X". I have always been believing in all the points you make. __

Re: [Haskell-cafe] Type system madness

2007-07-09 Thread Albert Y. C. Lai
Andrew Coppin wrote: I stand in awe of people who actually understand what "universal" and "existential" actually mean... To me, these are just very big words that sound impressive. I offer to relieve that with http://www.vex.net/~trebla/allsome.txt I think of formal logic as clarifying thoug

[Haskell-cafe] xkcd #287 "NP-Complete"

2007-07-09 Thread Albert Y. C. Lai
http://xkcd.com/c287.html import Data.Array import Control.Monad -- exactly n v -- items in v that sum to exactly n -- returns list of solutions, each solution list of items exactly :: (Real a) => a -> Array Int a -> [[a]] exactly 0 v = return [] exactly n v = do i <- indices v guard (v!i <=

Re: [Haskell-cafe] xkcd #287 "NP-Complete"

2007-07-10 Thread Albert Y. C. Lai
Marc A. Ziegert wrote: i see only two solutions. let menu = [215, 275, 335, 355, 420, 580] let run x menu = [[c]|c<-menu,c==x]++[c:cs|c<-menu,c [[215,215,215,215,215,215,215],[215,355,355,580]] You are right, I saw many solutions but they were all equivalent to just those two. I did not avoid

Re: [Haskell-cafe] Type system madness

2007-07-10 Thread Albert Y. C. Lai
Andrew Coppin wrote: Wait... I thought Unicode was still an experimental prototype? Since when does it work in the real world?? That myth is as old as "Haskell is an experimental prototype". "Old" as in "that's an old one". Windows has been well supporting Unicode since 2000. That is pretty

Re: [Haskell-cafe] Type system madness

2007-07-11 Thread Albert Y. C. Lai
Paul Moore wrote: On 10/07/07, Andrew Coppin <[EMAIL PROTECTED]> wrote: Interesting... I tried to put a pound sign on my web page, and it came out garbled, so I had to replace it with "£"... You may need to specify a "content encoding" in the HTML header. For that, you need to know the encodin

Re: [Haskell-cafe] Strange results when trying to create large Bool arrays.

2007-07-11 Thread Albert Y. C. Lai
Bryan O'Sullivan wrote: Int is a bit of an odd fish that way; it's a window onto the underlying machine's behaviour, not a tidy, well-behaved mathematical ring. I'm just being picky here: where the underlying machine's behaviour is 2's complement binary, it (Int, +, *) is actually a tidy, wel

Re: [Haskell-cafe] Type system madness

2007-07-11 Thread Albert Y. C. Lai
Andrew Coppin wrote: When I tell the editor to save UTF-8, it inserts some weird "BOM" character at the start of the file - and thus, any attempt at programatically processing that file instantly fails. :-( I know Windows Notepad puts a BOM at the beginning of UTF-8 files. http://www.vex.net/

Re: [Haskell-cafe] xkcd #287 "NP-Complete"

2007-07-11 Thread Albert Y. C. Lai
Henning Thielemann wrote: On Tue, 10 Jul 2007, Hugh Perkins wrote: By the way, if you enjoy these problems, there are tons of these at topcoder.com I cant help thinking it'd be neat to have topcoder-like competitions for Haskell, either by pursuading topcoder to integrate support for Haskell,

Re: [Haskell-cafe] Type system madness

2007-07-11 Thread Albert Y. C. Lai
Brandon S. Allbery KF8NH wrote: GNOME's gedit, for one, has a tendency to put byte order marks at the beginning of every line in UTF8 mode. Somehow I have never got a single BOM. My http://www.vex.net/~trebla/u.html was written out by GNOME gedit. Version 2.14.4.

Re: [Haskell-cafe] Very freaky

2007-07-12 Thread Albert Y. C. Lai
Cale Gibbard wrote: On 10/07/07, Andrew Coppin <[EMAIL PROTECTED]> wrote: Stefan O'Rear wrote: > Another good example: > > foo :: ∀ pred : Nat → Prop . (∀ n:Nat . pred n → pred (n + 1)) > → pred 0 → ∀ n : Nat . pred n > x_x > Which you can read as "For all statements about natural numbers

Re: [Haskell-cafe] better error expression in IO function

2007-07-13 Thread Albert Y. C. Lai
Derek Elkins wrote: On Wed, 2007-07-11 at 17:10 -0700, Jeremy Shaw wrote: At Thu, 12 Jul 2007 09:18:14 +1000, Thomas Conway wrote: On 7/12/07, Andrew Coppin <[EMAIL PROTECTED]> wrote: It's fairly common to use the Either type for this. By convention, "Right" means "correct", and by elimination

Re: [Haskell-cafe] IDE for Haskell (Was: function unique)

2007-07-13 Thread Albert Y. C. Lai
Henning Thielemann wrote: Since you can write Plugins for Eclipse in Haskell, things become interesting: http://leiffrenzel.de/eclipse/cohatoe/ Yippee! I have added an entry for it to http://www.haskell.org/haskellwiki/Applications_and_libraries/Editors ___

Re: [Haskell-cafe] Sets and Universe. Was : "Very freaky"

2007-07-13 Thread Albert Y. C. Lai
[EMAIL PROTECTED] wrote: Can we ask where there are two identical apples? Hey, I thought about that when I was a kid! I looked at pencils and thought "can two pencils be the same?" I concluded that they could not occupy the same location at the same time, so there is always some small differ

Re: [Haskell-cafe] problem with IO, strictness, and "let"

2007-07-13 Thread Albert Y. C. Lai
Brandon Michael Moore wrote: Calling hClose after hGetContents is the root of the problem, but this is a good example for understanding seq better too. To further this end, I'll "take issue" :) with the final version that has been tested to work, and show that it still won't work. First, the

Re: [Haskell-cafe] Why does Data.Map exist when...

2007-07-17 Thread Albert Y. C. Lai
Tony Morris wrote: ...it seems to be a special case of Set? Does Data.Map add anything more useful than Map' below? Besides technical differences, beware that mere convenience makes or breaks success of tools (languages, libraries). ___ Haskell-Cafe

Re: [Haskell-cafe] Is this haskelly enough? -- errm but every answer is wrong(?)

2007-07-19 Thread Albert Y. C. Lai
Anthony Clayden wrote: (Or at least the problem is under-specified.) 1. There may be several sub-sequences having the maximum sum. So the type for the solution should be :: Num a => [a] -> [[a]] 2. The inits . tails approach adds a fault: It introduces a sprinkling of empty sub-sequence

Re: [Haskell-cafe] Lazy in either argument?

2007-07-26 Thread Albert Y. C. Lai
Dan Weston wrote: 1) Commenting out the type annotation f :: Bool makes the program hang Turning on code optimizations (e.g., ghc -O) helps. I don't know why. 2) If I replace f = f by f = undefined, I get an annoying print of "LazyOr: Prelude.undefined" before it returns the correct value.

Re: [Haskell-cafe] curious hxt error

2007-07-31 Thread Albert Y. C. Lai
brad clawsie wrote: i am having a problem with hxt, i was wondering if anyone here has experience with it. in particular, i find that the xread function chokes on xml files with xml declarations, and i am not sure why. [...] This is intended. Generally, wherever the HXT manual says "content" (

Re: [Haskell-cafe] How odd...

2007-08-04 Thread Albert Y. C. Lai
Andrew Coppin wrote: > 0^2 0 > (0 :+ 0)^2 0 :+ 0 > 0**2 0 > (0 :+ 0)**2 NaN :+ NaN There is nothing wrong AFAIK. (How much do I know? BSc in math, went through classes on real analysis and complex analysis.) There is no reason to expect complex ** to agree with real **. Real x**y is

Re: [Haskell-cafe] Defining new operators

2007-08-10 Thread Albert Y. C. Lai
rodrigo.bonifacio wrote: owner :: Step -> Scenario owner (Step id scenario action state response) = scenario Is it possible to define the owner function in such way that I can write x.owner (returning the scenario related with the Step x)? The . is already taken. Choose some other symbol, sa

Re: [Haskell-cafe] Re: Bathroom reading

2007-08-17 Thread Albert Y. C. Lai
Dan Weston wrote: I hate to be a party pooper, but isn't this just: > f = foldr (\a z -> (a:snd z,fst z)) ([],[]) This takes less time to grok and takes no longer to run. For each type with exported constructors, one can always write deconstructors for it, if not already found in libraries.

Re: [Haskell-cafe] Re: Bi-directional Maps

2007-08-21 Thread Albert Y. C. Lai
apfelmus wrote: Hugh Perkins wrote: Arguably there are two possible implementations, one that enforces one-to-one mapping, and one which allows multiple values, in either direction. Terminology reminder :) - the latter is called "(binary) relation" http://en.wikipedia.org/wiki/Binary_relatio

Re: [Haskell-cafe] #haskell irc channel reaches 400 users

2007-08-21 Thread Albert Y. C. Lai
Andrew Coppin wrote: ...does this mean Haskell is officially harder to understand than Lisp, Java, Perl and O'Caml? :-} (OTOH, does this mean Haskell is easier to understand than PHP or C++?) Or, Haskell is the easiest to understand of them all. Reason: Extremely large channel means so hard

Re: [Haskell-cafe] GHC optimisations

2007-08-22 Thread Albert Y. C. Lai
Neil Mitchell wrote: Other rules that could be interesting are: > forall a b. fromInteger a + fromInteger b = fromInteger (a + b) > forall a b. fromInteger a * fromInteger b = fromInteger (a * b) This is wrong, since the class function can do what it wants. Imagine: instance Num String where

  1   2   3   4   >