[Haskell-cafe] After upgrade bytestring to 0.9.1.3, my program cannot run.

2008-10-06 Thread Magicloud
Just a simple text process program. When I runhaskell it. I got: GHCi runtime linker: fatal error: I found a duplicate definition for symbol fps_minimum whilst processing object file ~/.cabal/lib/bytestring-0.9.1.3/ghc-6.8.3/HSbytestring-0.9.1.3.o This could be caused by: * Loading two diff

[Haskell-cafe] There is something wrong in derive-0.1.2 package.

2008-10-13 Thread Magicloud
Hi, I wanted to install it with cabal. Well $ cabal install derive Resolving dependencies... cabal: Couldn't read cabal file "./derive/0.1.2/derive.cabal" As I traced a little, it seemed that line: 'build-depends: base == 4.*, syb' was wrong. ___

[Haskell-cafe] There is something wrong with hprotoc-0.3.1 package.

2008-10-13 Thread Magicloud
Hi, I wanted to install this package. Well, Building hprotoc-0.3.1... ... [3 of 7] Compiling Text.ProtocolBuffers.ProtoCompile.Parser ... Text/ProtocolBuffers/ProtoCompile/Parser.hs:48:0: Type synonym `GenParser' should have 2 arguments, but has been given 1 In the type synonym declarati

Re: [Haskell-cafe] There is something wrong in derive-0.1.2 package.

2008-10-13 Thread Magicloud
nces to `mtlzm1zi1zi0zi1_ControlziMonadziIdentity_zdf2_closure' follow collect2: ld returned 1 exit status cabal: Error: some packages failed to install: cabal-install-0.6.0 failed during the building phase. The exception was: exit: ExitFailure 1 -- Wang Shida (Magicloud) No matter how thi

Re: [Haskell-cafe] There is something wrong with hprotoc-0.3.1 package.

2008-10-13 Thread Magicloud
$ cabal --version cabal-install version 0.5.2 using version 1.4.0.2 of the Cabal library $ ghc --version The Glorious Glasgow Haskell Compilation System, version 6.8.3 Don Stewart wrote: magicloud.magiclouds: Hi, I wanted to install this package. Well, Building hprotoc-0.3.1... ... [3 of

Re: [Haskell-cafe] There is something wrong in derive-0.1.2 package.

2008-10-14 Thread Magicloud
After rebuilt HTTP-3001.1.3, I reinstalled, no luck, same error. I am rebuilding GHC-6.8.3, to see Duncan Coutts wrote: On Tue, 2008-10-14 at 13:51 +0800, Magicloud wrote: Sigh again, something that always makes me think that cabal is unusable ~/.cabal/lib/HTTP-3001.1.3

Re: [Haskell-cafe] There is something wrong in derive-0.1.2 package.

2008-10-14 Thread Magicloud
for. <> make[3]: *** [dist/build/Network/CGI/Protocol.p_o] Error 1 make[2]: *** [all] Error 1 make[2]: Leaving directory `/home/shidaw/src/ghc-6.8.3/libraries/cgi' make[1]: *** [make.library.cgi] Error 2 make[1]: Leaving directory `/home/shidaw/src/ghc-6.8.3/libraries' make: *** [stage1] Er

Re: [Haskell-cafe] There is something wrong in derive-0.1.2 package.

2008-10-14 Thread Magicloud
Finally, after I hacked some files, everything worksMan! Magicloud wrote: OK, I cannot rebuild ghc-6.8.3 on a ghc-6.8.3 existing enviornment, very good. Preprocessing library cgi-3001.1.6.0... Generating Makefile cgi-3001.1.6.0... make[2]: Entering directory `/home/shidaw/src/ghc-6.8.3

Re: [Haskell-cafe] I do not want to be a bitch, but ghc-6.8.3 and haskell binary policy are really horrible.

2008-10-14 Thread Magicloud
ld be helpful if you could describe exactly what you did so we can work on improving the issue in the long term (and help you fix it in the short term). 2008/10/14 Magicloud <[EMAIL PROTECTED]>: 1. I cannot install ghc-6.8.3 in my box until I found the old runable binary. 2. After

[Haskell-cafe] I do not want to be a bitch, but ghc-6.8.3 and haskell binary policy are really horrible.

2008-10-14 Thread Magicloud
1. I cannot install ghc-6.8.3 in my box until I found the old runable binary. 2. After I installed cabal, and upgraded, ghc-6.8.3 cannot rebuild itself. Because its libraries are conflict with the ones upgraded by cabal. 3. Sometimes, ghc just ignore some libs, because it does not meet its depen

Re: [Haskell-cafe] I do not want to be a bitch, but ghc-6.8.3 and haskell binary policy are really horrible.

2008-10-14 Thread Magicloud
Magicloud <[EMAIL PROTECTED]>: Sorry, let me say it this way: 1. Ghc cannot be bootstrap-installed. And the ghc-6.8.3 binary from official website also cannot run in my box, some kind of overflow error. So I have to look for help, a few hours later, I found 6.4.2 (I am not sure) which run

Re: [Haskell-cafe] I do not want to be a bitch, but ghc-6.8.3 and haskell binary policy are really horrible.

2008-10-14 Thread Magicloud
more of what you're trying to do? I'm having a hard time seeing what exactly you're doing, and why you can't use the package provided by your distribution. We'd love to help you, but you're not being very clear with what your problem is. /jve On Tue, Oct

[Haskell-cafe] How to specify multiple fonts for xmobar?

2008-10-14 Thread Magicloud
Hi, I am using xmonad + xmobar. And I am using sgi screen font. But sometimes I need to display CJK characters, which need another font. In gtk2 software, this is OK. I just specify the screen font for ascii. It can auto-choose a CJK font. Everything looks fine, maybe not pretty. Whi

[Haskell-cafe] About do notation.

2008-10-14 Thread Magicloud
Hi, As some articles say, do notation is expand to (>>) and (>>=) when being compiled. So I want to know the details. Like: main = do a <- getArgs b <- getLine myFunc1 (head a) b myFunc2 b (head a) I cannot figure out what is the (>>) and (>>=) way of this. Thanks. ___

[Haskell-cafe] How to use lib compat-base3 in ghc 6.10?

2008-10-29 Thread Magicloud
Hi, Xmonad needs Data.Generics from base3. And I found out that there is a "compat-base3" in ghc 6.10, which has Data.Generics. But `ghc -v` reports that base-3.0.3.0 is hidden. So I wonder how could I compile Xmonad with ghc 6.10? Thanks. ___

[Haskell-cafe] Problem while compiling ghc 6.8

2008-11-03 Thread Magicloud
Hi, I got my ghc 6.8 by `darcs get --partial http://darcs.haskell.org/ghc-6.8/ghc`, and after `darcs-all get`, `sh boot`, `configure`, without any problem, I started to make it. Well, when compiling libraries/stm, it reports "Control/Concurrent/STM/TVar.hs:22:8: Not in scope: `readTVarIO'

[Haskell-cafe] Hat cannot use with ghc 6.10?

2008-12-04 Thread Magicloud
Hi, I want to do some tracing, and I thought hat could help. Well hmake and hat both could not been made with ghc 6.10 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

答复: [Haskell-cafe] Re: How to do this in FP way?

2008-06-16 Thread Magicloud
Yes, that's it, State. Thanks. -邮件原件- 发件人: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 代表 Achim Schneider 发送时间: 2008年6月16日 12:01 收件人: haskell-cafe@haskell.org 主题: [Haskell-cafe] Re: How to do this in FP way? "Magicloud Magiclouds" <[EMAIL PROTECTED]> wrote: > st

答复: [Haskell-cafe] Re: How to do this in FP way?

2008-06-16 Thread Magicloud
] Re: How to do this in FP way? "Magicloud Magiclouds" <[EMAIL PROTECTED]> wrote: > static int old; > int diff (int now) { /* this would be called once a second */ > int ret = now - old; > old = now; > return ret; > } > You do it with variables, of course.

答复: [Haskell-cafe] Re: How to do this in FP way?

2008-06-16 Thread Magicloud
P way? "Magicloud Magiclouds" <[EMAIL PROTECTED]> wrote: > static int old; > int diff (int now) { /* this would be called once a second */ > int ret = now - old; > old = now; > return ret; > } > You do it with variables, of course. This is out of som

答复: [Haskell-cafe] How to do this in FP wa y?

2008-06-16 Thread Magicloud
s the difference, and go on. So, what is your idea? -邮件原件- 发件人: David Roundy [mailto:[EMAIL PROTECTED] 发送时间: 2008年6月17日 1:17 收件人: Magicloud Magiclouds 抄送: haskell-cafe@haskell.org 主题: Re: [Haskell-cafe] How to do this in FP way? 2008/6/15 Magicloud Magiclouds <[EMAIL PROTECTED]&g

[Haskell-cafe] How to deal with utf-8?

2009-02-12 Thread Magicloud
Hi, I am using Text.CSV to read and using gtk2hs to display csv files using utf-8 encode. Well, it displays broken strings, seems like it cannot deal with utf-8. What should I do? Thanks. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org h

[Haskell-cafe] How to do the "permutation and combination" thing?

2010-03-11 Thread Magicloud Magiclouds
Hi, For example, I have this: list1 = [a, b, c] list2 = [d, e, f] list3 = [g, h, i] Now I want: [ [(a, d, g), (b, e, h), (c, f, i)] , ... ] -- a list that contains all the combinations. How to do it pretty? Thanks. -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Ca

Re: [Haskell-cafe] How to do the "permutation and combination" thing?

2010-03-11 Thread Magicloud Magiclouds
All I could get is to use permutations and concatMap. But it looks really ugly. On Fri, Mar 12, 2010 at 2:09 PM, Casey Hawthorne wrote: > This sounds like homework. > > Think in abstract terms what you want to accomplish. > > Start with the simplest case first, usually the base case. > > > On Fri

Re: [Haskell-cafe] How to do the "permutation and combination" thing?

2010-03-15 Thread Magicloud Magiclouds
Sorry, I did not make it clear, since I did not know how to say this in technical terms. With comprehension, I could get all the possibilities that "draw one elem from each list and put them together". But consider this: for example, there are two types of pet, dog and cat. And there are two person

Re: [Haskell-cafe] How to do the "permutation and combination" thing?

2010-03-15 Thread Magicloud Magiclouds
I realized I fell into the trap of wrong way. Thank you. On Fri, Mar 12, 2010 at 4:16 PM, Ketil Malde wrote: > Casey Hawthorne writes: > >>>  For example, I have this: >>>list1 = [a, b, c] >>>list2 = [d, e, f] >>>list3 = [g, h, i] > >> Think in abstract terms what you want to accomplish. > > A b

Re: [Haskell-cafe] How to do the "permutation and combination" thing?

2010-03-15 Thread Magicloud Magiclouds
Oh, that is not a precondition. So the answer of yours are correct. I am working on permutations. I used it in a wrong way. On Mon, Mar 15, 2010 at 4:39 PM, Daniel Fischer wrote: > Am Montag 15 März 2010 08:37:20 schrieb Magicloud Magiclouds: >> Sorry, I did not make it clear, since

[Haskell-cafe] Problem about pattern matching.

2010-04-28 Thread Magicloud Magiclouds
Hi, I have code as below. How come "case" version works wrong and gives me "overlap" compiling warning? Thanks. if dayOfMonth == firstDayOfMonth then v day (x, y) else if dayOfMonth == lastDayOfMonth then not_ $ v day (x, y) else Mider day (x, y) case dayOfMonth of firs

Re: [Haskell-cafe] Problem about pattern matching.

2010-04-29 Thread Magicloud Magiclouds
;Mider" was done by "not_ ...". On Thu, Apr 29, 2010 at 1:51 AM, Henning Thielemann wrote: > minh thu schrieb: >> 2010/4/28 Magicloud Magiclouds : >>> Hi, I have code as below. How come "case" version works wrong and >>> gives me "overlap"

[Haskell-cafe] How to deal with huge text file?

2010-05-24 Thread Magicloud Magiclouds
Hi, I have a file including some operation logs, in the format of the following. And I have some code to analyze it. Well, it ate all my memories. --- log: Log for item A === 09:10 read accountA 09:20 read accountB Log for item B --- code: file <- U.readFile filename mapM_ (\t

Re: [Haskell-cafe] How to deal with huge text file?

2010-05-24 Thread Magicloud Magiclouds
U is for UTF8 module. And I will try the modules you mentioned. Although I thought Haskell IO is lazy enough On Tue, May 25, 2010 at 9:46 AM, Ivan Miljenovic wrote: > On 25 May 2010 11:41, Magicloud Magiclouds > wrote: >> Hi, >>  I have a file including some operation logs

Re: [Haskell-cafe] How to deal with huge text file?

2010-05-24 Thread Magicloud Magiclouds
2010 at 10:12 AM, Ivan Miljenovic wrote: > On 25 May 2010 12:02, Magicloud Magiclouds > wrote: >> U is for UTF8 module. And I will try the modules you mentioned. >> Although I thought Haskell IO is lazy enough > > If you're only streaming data, it probably would b

Re: [Haskell-cafe] How to deal with huge text file?

2010-05-24 Thread Magicloud Magiclouds
Yes, this code works with a little hack. Thank you. On Tue, May 25, 2010 at 11:06 AM, Daniel Fischer wrote: > On Tuesday 25 May 2010 04:26:07, Ivan Miljenovic wrote: >> On 25 May 2010 12:20, Magicloud Magiclouds >> >> wrote: >> > This is the function. The problem

[Haskell-cafe] Problem when installing gtk2hs.

2010-05-26 Thread Magicloud Magiclouds
Hi, I have met similar problem before, and I do not know what to do. # cabal install --reinstall gtk2hs-buildtools Resolving dependencies... Configuring gtk2hs-buildtools-0.9... cabal: alex is required but it could not be found. cabal: Error: some packages failed to install: gtk2hs-buildtools-0.9

[Haskell-cafe] Re: [Gtk2hs-users] Problem when installing gtk2hs.

2010-05-27 Thread Magicloud Magiclouds
I only have one alex installed under ~/.cabal/bin. It seems working with shell environment, but not cabal. On Thu, May 27, 2010 at 1:40 PM, Axel Simon wrote: > Hi Magicloud, > > On May 27, 2010, at 4:11, Magicloud Magiclouds wrote: > >> Hi, I have met similar problem before,

Re: [Haskell-cafe] Re: [Gtk2hs-users] Problem when installing gtk2hs.

2010-05-27 Thread Magicloud Magiclouds
That might be it. However, I linked ~/.cabal/bin/* to /usr/local/bin And it worked. On Thu, May 27, 2010 at 3:24 PM, Ivan Miljenovic wrote: > On 27 May 2010 16:46, Magicloud Magiclouds > wrote: >> I only have one alex installed under ~/.cabal/bin. >> It seems working with

[Haskell-cafe] Fwd: [Gtk2hs-users] Installation problem with cairo.

2010-06-08 Thread Magicloud Magiclouds
:15 PM Subject: Re: [Gtk2hs-users] Installation problem with cairo. To: Magicloud Magiclouds Cc: gtk2hs-users Hi again, it's very difficult for me to say what is happening. Could you ask on the cabal mailing list to see if anybody there has an idea. Cheers, Axel On 08.06.2010, at

[Haskell-cafe] How to convert DiffTime to a number?

2009-06-07 Thread Magicloud Magiclouds
Hi, Documents said that DiffTime could treat as "how many seconds". So how to convert it to a number of seconds? Thanks. -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: How to convert DiffTime to a number?

2009-06-07 Thread Magicloud Magiclouds
Ah, floor $ toRational dt. On Mon, Jun 8, 2009 at 1:09 PM, Magicloud Magiclouds wrote: > Hi, >  Documents said that DiffTime could treat as "how many seconds". So > how to convert it to a number of seconds? > > Thanks. > -- > 竹密岂妨流水过 >

[Haskell-cafe] How to know the build dependencies?

2009-06-13 Thread Magicloud Magiclouds
Hi, I am learning to use cabal for my code. Just when I start, I met a question, is there an easy way to find out what packages my code depends? Thanks. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/ha

[Haskell-cafe] [cabal] How to deal with build-depency that not under cabal's control?

2009-06-14 Thread Magicloud Magiclouds
Hi, I use gtk2hs in linux. Well, I have no idea how to install gtk2hs by cabal, but my program needs it, and I want my program cabalized. So how to do this? Thanks. -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.ha

[Haskell-cafe] Could someone give me a sample about haskelldb?

2009-06-18 Thread Magicloud Magiclouds
Hi, I am learning it following the very few documents on its site. Well, I failed, with the import modules, I still cannot compile it. The error is on "T.*". 6 import Database.HaskellDB.HDBC.SQLite3 7 import Database.HaskellDB 8 import Database.HaskellDB.DBSpec 9 import Database.HaskellDB.DB

[Haskell-cafe] Re: Could someone give me a sample about haskelldb?

2009-06-19 Thread Magicloud Magiclouds
I changed it, some other problem occured. 1. How to compare a BoolT column to a True? "t!c .<>. True" could not work. 2. What shoud I use after "!"? Like table!col, recordset!col, what is col? Thanks. On Fri, Jun 19, 2009 at 1:24 PM, Magicloud Magiclouds wrote: > Hi,

[Haskell-cafe] haskelldb + sqlite problem.

2009-06-21 Thread Magicloud Magiclouds
Hi, I am using haskelldb and haskelldb-hdbc-sqlite3. Well, I finally got the source compiled and ran, I got this error: App: user error (SQL error: SqlError {seState = "", seNativeError = 21, seErrorMsg = "prepare 74: SELECT subject,\n timestamp\nFROM notes as T1\nORDER BY timestamp DESC: l

[Haskell-cafe] Weird thing happened when I use gtk2hs with concurrent.

2009-06-24 Thread Magicloud Magiclouds
This is the weird code, please see line 61. 20 cpuNew :: IO CPU 21 cpuNew = do 22   self <- meterNew 23   usage <- newIORef $ CPUusage 0 0 0 0 0 0 0 0 24   self `on` realize $ do 25     forkIO $ redraw self usage 33     return () 34   return self 35   where 56     redraw self usage = do 57       n

[Haskell-cafe] How to read safely?

2009-06-24 Thread Magicloud Magiclouds
Hi, Read often throws runtime errors, which breaks the robust of the problem. How to deal with it? Without lost too much proformance (so reads is a no). At least, if its error could be catched, that'd be better. -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe ma

[Haskell-cafe] How to fork a process?

2009-06-25 Thread Magicloud Magiclouds
Hi, In many language, both thread and process are supported. But in haskell's document, the only thing I could find called fork is to make a thread. So how to fork the program itself, like fork () in C? Thanks. -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mai

[Haskell-cafe] How to convert CPid to Word32?

2009-06-28 Thread Magicloud Magiclouds
Hi, I am trying to use Data.Binary with ProcessID. Well, how to convert between CPid and Word32? Thanks. -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Wondering about c type in haskell.

2009-06-29 Thread Magicloud Magiclouds
Hi, There are times, when we need to make some system calls, or call C library. So we have to deal with C data types. For example, CPid, which is an integer, actually. So we can do "fromIntegral pid". Then why do not we define "type CPid = Integer", and convert Haskell Integer with C Int intern

Re: [Haskell-cafe] Re: Wondering about c type in haskell.

2009-06-29 Thread Magicloud Magiclouds
need to convert, convert, convert. And, let say using Integer for pid is insane. Then if I do not convert it into Integer, when serialised, I have to point out with Word32/Word64, which is definitely bad. On Tue, Jun 30, 2009 at 11:01 AM, Ahn, Ki Yung wrote: > Magicloud Magiclouds 쓴 글: >&

Re: [Haskell-cafe] Wondering about c type in haskell.

2009-06-29 Thread Magicloud Magiclouds
That is true. But I think we could avoid (or resolve) the problem of wrong type thing in other ways, or we just resolve one thing by typing much more code. On Tue, Jun 30, 2009 at 11:37 AM, Jason Dagit wrote: > > > On Mon, Jun 29, 2009 at 7:01 PM, Magicloud Magiclouds > wro

[Haskell-cafe] How to present the commonness of some objects?

2009-07-02 Thread Magicloud Magiclouds
Hi, I thought "class" was for this purpose. But it turns out not. Code as following could not compiled. 1 main = do 2 mapM_ (\(x, y, widget) -> do 3a <- widgetRun widget 4putStrLn $ show a 5 ) widgetList 6 7 widgetList :: (Widget w) => [(Integer, Integer, w)]

Re: [Haskell-cafe] How to present the commonness of some objects?

2009-07-02 Thread Magicloud Magiclouds
Widget Label where widgetRun = ... > > widgetList:: [(Integer, Integer, SomeWidget)] > widgetList = >    [ SomeWidget (Button $ putStrLn "ding!") >    , SomeWidget (Label $ putStrLn . ("entered: " ++)) ] > > Before, without existential quantification, you had to hav

[Haskell-cafe] Why this cannot be compiled?

2009-07-12 Thread Magicloud Magiclouds
Hi, The following code failed to compiled, with error: Attribute.hs:46:91: Couldn't match expected type `[t]' against inferred type `(a, String)' In the expression: (color_, rest_) In a case alternative: [(color_, rest_)] -> (color_, rest_) In the expression: ca

Re: [Haskell-cafe] Why this cannot be compiled?

2009-07-13 Thread Magicloud Magiclouds
Hum I must lost my mind Thank you. On Mon, Jul 13, 2009 at 3:33 PM, Ketil Malde wrote: > Magicloud Magiclouds writes: > >>  43 instance Read Attribute where >>  44   readsPrec _ str = [ (mkAttr attr_ color, rest) | (attr_, rest1) <

[Haskell-cafe] How to "Read" this?

2009-07-13 Thread Magicloud Magiclouds
Hi, I have a data structure, which shows like this: AttrBgColor {bgColor = Color 0 0 0} And the following is my Read code. But it failed parsing 31 instance Read Attribute where 32 readsPrec _ str = [ (mkAttr attr_ color, rest) | (attr_, rest1) <- lex str 33

[Haskell-cafe] Pattern matching does not work like this?

2009-07-15 Thread Magicloud Magiclouds
Hi, I do not notice this before. "fun ([0, 1] ++ xs) = .." in my code could not be compiled, parse error. -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Is there a sample code for hdbus?

2009-07-27 Thread Magicloud Magiclouds
Hi, Although I have used dbus with ruby a little, but still, I do not understand hdbus's APIs Is there any sample that I could learn? Thanks. -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailma

[Haskell-cafe] runProcess does not care about hSetBuffering?

2009-07-28 Thread Magicloud Magiclouds
Hi, Code like: (or_, ow_) <- createPipe or <- fdToHandle or_ ow <- fdToHandle ow_ hSetBuffering ow LineBuffering hSetBuffering or LineBuffering h <- runProcess cmd [] Nothing Nothing Nothing (Just ow) Nothing In the cmd process, the ow is not LineBuffering -- 竹密岂妨流水过 山高哪阻野云飞 __

[Haskell-cafe] Problem on existential type.

2009-09-03 Thread Magicloud Magiclouds
Hi, I am trying out existential type, some sample code works well. Well, my own code could not be compiled with message: Grid.hs:45:11: Kind error: `GridWidget' is applied to too many type arguments In the type `GridWidget widget' In the type `(GridWidget widget) -> (widget -> t) -> t

[Haskell-cafe] How to generate the .chi file for c2hs?

2009-09-07 Thread Magicloud Magiclouds
Hi, I want to make a binding of a gtk function, which returns a X11 type. gtk2hs is made by c2hs, which is OK to give me the .chi file. Well, X11 is not. So if I make my binding c2hs style, I have to make a .chi file for X11 myself. How to do it? -- 竹密岂妨流水过 山高哪阻野云飞 _

Re: [Haskell-cafe] Problem on existential type.

2009-09-07 Thread Magicloud Magiclouds
Thank you all guys. This explained so much. On Sun, Sep 6, 2009 at 2:53 AM, Ryan Ingram wrote: > On Thu, Sep 3, 2009 at 11:05 PM, Magicloud > Magiclouds wrote: >> data GridWidget = forall widget. (WidgetClass widget) => GridWidget widget >> >> liftGW :: (GridWidget wi

[Haskell-cafe] Re: How to generate the .chi file for c2hs?

2009-09-07 Thread Magicloud Magiclouds
Hum, seems like the c2hs in gtk2hs is a non-standard version, and the chi it gives could not be used by c2hs (nor can standard c2hs used in gtk2hs's compiling) On Mon, Sep 7, 2009 at 4:45 PM, Magicloud Magiclouds wrote: > Hi, >  I want to make a binding of a gtk function, which re

[Haskell-cafe] hackage.haskell.org cannot be accessed?

2010-08-11 Thread Magicloud Magiclouds
Hi, Today I found out that I cannot access hackage.haskell.org. I have tried vpn/proxy to see if my network has something wrong. No luck. -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/

[Haskell-cafe] How to decide if a number is an integer?

2009-09-28 Thread Magicloud Magiclouds
Hi, In other weak-type language, `round i == i` would work. But in haskell, what should I do? Thanks. -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: How to decide if a number is an integer?

2009-09-28 Thread Magicloud Magiclouds
Hi, Here is an example: let l = fun num in if isIntegral l then l else 0 How to do the isIntegral thing? On Tue, Sep 29, 2009 at 1:58 PM, Magicloud Magiclouds wrote: > Hi, >  In other weak-type language, `round i == i` would work. But in > haskell, what should I d

Re: [Haskell-cafe] How to decide if a number is an integer?

2009-09-28 Thread Magicloud Magiclouds
It never matches to (_, 0.0) I mean case properFraction l of (_, 0) -> l _ -> 0 -- always goes here. On Tue, Sep 29, 2009 at 2:18 PM, Jimmy Hartzell wrote: > Use properFraction: > http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v%3AproperFraction > >> Hi, >>   In other

Re: [Haskell-cafe] How to decide if a number is an integer?

2009-09-28 Thread Magicloud Magiclouds
True _ -> False ) $ take num [1..] :t l is (Floating a) => a Well, in ghci *Main> givenSum 10 [False,False,False,False,False,False,False,False,False,False] On Tue, Sep 29, 2009 at 2:45 PM, Thomas DuBuisson wrote: > On Mon, Sep 28, 2009 at 11:35 PM, Ma

Re: [Haskell-cafe] How to decide if a number is an integer?

2009-09-29 Thread Magicloud Magiclouds
your expectations are a bit off. > > Thomas > > On Mon, Sep 28, 2009 at 11:54 PM, Magicloud Magiclouds > wrote: >> The original code is >> givenSum num = map (\a -> >>                      let l = (sqrt $ fromIntegral (a * a + 2 + 2

Re: [Haskell-cafe] How to decide if a number is an integer?

2009-09-29 Thread Magicloud Magiclouds
givenSum 10 >> [False,False,False,False,False,False,False,False,False,False] >> >> On Tue, Sep 29, 2009 at 2:45 PM, Thomas DuBuisson >> wrote: >>> On Mon, Sep 28, 2009 at 11:35 PM, Magicloud Magiclouds >>> wrote: >>>> It never matches to (_, 0

Re: [Haskell-cafe] How to decide if a number is an integer?

2009-09-29 Thread Magicloud Magiclouds
gt;>                           True >>>>                         _ -> >>>>                           False >>>>                    ) $ take num [1..] >>>> :t l is (Floating a) => a >>>> Well, in ghci >>>> *Main> givenSu

[Haskell-cafe] NetSnmp problem.

2009-10-22 Thread Magicloud Magiclouds
Hi, I am trying to use NetSnmp to get some information from my switch. And I met this problem. After initialize, I used snmpWalk to get some information, and dealed with it. Everything is fine. Then I sleep for 5 mins. SnmpWalk again. But this time, all asnValues were unsupported format, which

Re: [Haskell-cafe] NetSnmp problem.

2009-10-22 Thread Magicloud Magiclouds
Hi, The box is just 32bit with linux. But anyway, I will try out the update. Thanks. On Thu, Oct 22, 2009 at 11:35 PM, John Dorsey wrote: >>   I am trying to use NetSnmp to get some information from my switch. >> And I met this problem. >>   After initialize, I used snmpWalk to get some informa

Re: [Haskell-cafe] NetSnmp problem.

2009-10-22 Thread Magicloud Magiclouds
It works pretty well. On Fri, Oct 23, 2009 at 7:24 AM, Magicloud Magiclouds wrote: > Hi, >  The box is just 32bit with linux. But anyway, I will try out the > update. Thanks. > > On Thu, Oct 22, 2009 at 11:35 PM, John Dorsey wrote: >>>   I am trying to use NetSnmp to g

[Haskell-cafe] TimeZone bug?

2009-10-23 Thread Magicloud Magiclouds
Hi, As we know, "CST" could mean both +8 or -6 time zone. So I got a problem. In the same envoironment. When a ZonedTime is shown, I got "x CST". Now it means +8 time zone. Then I read it, stupidly, it turns into -6 time zone. How could I fix this? I am using ghc 6.10.4 in rhel 5. -- 竹密岂

[Haskell-cafe] How come pattern match does not recognize this code style?

2009-10-25 Thread Magicloud Magiclouds
Hi, In case of this: case bala of [ bala , bala , bala ] -> bala bala bala _ -> bala ghc 6.10.4 would fail to compile, because of the wrong indent of line ", bala". -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org htt

Re: [Haskell-cafe] How come pattern match does not recognize this code style?

2009-10-25 Thread Magicloud Magiclouds
Ah, I see. The reason I have to use my style is the same as others: the list is too long On Mon, Oct 26, 2009 at 11:27 AM, Daniel Fischer wrote: > Am Montag 26 Oktober 2009 03:39:13 schrieb Magicloud Magiclouds: >> Hi, >>   In case of this: >> case bala of >>   [ b

[Haskell-cafe] How to fulfill the "code-reuse" destiny of OOP?

2009-10-29 Thread Magicloud Magiclouds
Hi, I think when people talk about OOP, especially the inheriting, their focus mainly is on functions (methods). My concern here is about the data member inheriting. In OOP, when I inherit a class, I also got the members of it. But in haskell, how to inherit a "data"? -- 竹密岂妨流水过 山高哪阻野云飞 __

Re: [Haskell-cafe] How to fulfill the "code-reuse" destiny of OOP?

2009-10-30 Thread Magicloud Magiclouds
On this subject, I think, any "content inherit" would lead to trouble somehow. But is that the reason that we should totally cut them loose? I mean the way of programming developing is easier making (writing), easier maintaining. In fact, I think this is a fork in front of me: Before any new though

Re: [Haskell-cafe] How to fulfill the "code-reuse" destiny of OOP?

2009-10-31 Thread Magicloud Magiclouds
Somehow, I agree with you. I think inherit is not evil, the people use it wrong is. The problem here is, inherit is naked right now. So people could use it wrong. On Fri, Oct 30, 2009 at 7:42 PM, Yaakov Nemoy wrote: > 2009/10/30 Peter Verswyvelen : >> The following is purely my own experience, I

Re: [Haskell-cafe] How to fulfill the "code-reuse" destiny of OOP?

2009-10-31 Thread Magicloud Magiclouds
gan Creswick wrote: >> On Thu, Oct 29, 2009 at 6:54 PM, Magicloud Magiclouds >> wrote: >> >>>  My concern here is about the data member inheriting. In OOP, when I >>> inherit a class, I also got the members of it. But in haskell, how to >>> inherit a &qu

Re: [Haskell-cafe] How to fulfill the "code-reuse" destiny of OOP?

2009-11-01 Thread Magicloud Magiclouds
at 9:57 AM, Gregory Collins wrote: > Tom Davie writes: > >> On 10/31/09, Magicloud Magiclouds wrote: >>> After all, I never think OO as an oppsite way to all other things. The >>> idea is so general that if you say I cannot use it in Haskell at all, >>>

[Haskell-cafe] How to convert records into Haskell structure in Haskell way?

2009-11-02 Thread Magicloud Magiclouds
Hi, Say I have something like this: [ Record { item = "A1", value = "0" } , Record { item = "B1", value = "13" } , Record { item = "A2", value = "2" } , Record { item = "B2", value = "10" } ] How to convert it into: [ XXInfo { name = "A", value1 = "0", value2 = "2" } , XXInfo { name = "B", valu

Re: [Haskell-cafe] How to convert records into Haskell structure in Haskell way?

2009-11-02 Thread Magicloud Magiclouds
Kind like: [ Record { item = "A1", value = "0" } ] This is not a legal XXInfo, I have to deal with it. Plus, there are 28 members of XXInfo, so xxInfo of yours would be very ugly. On Tue, Nov 3, 2009 at 9:55 AM, Daniel Fischer wrote: > Am Dienstag 03 November 2009 02:29:56

[Haskell-cafe] Problem about hidden package again.

2009-11-11 Thread Magicloud Magiclouds
Hi, Today, when I compiled gtk2hs, I got this: cairo/Graphics/Rendering/Cairo.hs.pp:264:0: Failed to load interface for `Data.Array.Base': it is a member of the hidden package `array-0.2.0.0' Use -v to see a list of the files searched for. As usual, I searched for the resolvemen

Re: [Haskell-cafe] Problem about hidden package again.

2009-11-12 Thread Magicloud Magiclouds
No, it is not. I used configure/make way. Well I just noticed that there is a "hide-all-package" options to ghc. I do not know why. Maybe the author went crazy. On Thu, Nov 12, 2009 at 5:09 PM, Magnus Therning wrote: > On Thu, Nov 12, 2009 at 7:32 AM, Magicloud Magiclouds &g

Re: [Haskell-cafe] Problem about hidden package again.

2009-11-12 Thread Magicloud Magiclouds
Just joking. But still, since gtk2hs still using the configure/make way, it is complex to add another option to the system. I tried to add array to build-depends of Cairo.cabal, no luck. On Thu, Nov 12, 2009 at 5:28 PM, Magnus Therning wrote: > On Thu, Nov 12, 2009 at 9:11 AM, Magicl

[Haskell-cafe] Could someone teach me why we use Data.Monoid?

2009-11-13 Thread Magicloud Magiclouds
Hi, I have looked the concept of monoid and something related, but still, I do not know why we use it? -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Could someone teach me why we use Data.Monoid?

2009-11-13 Thread Magicloud Magiclouds
> mempty = empty > mappend = union > > mconcat = unions > > Hope I have helped! > > Regards, > > Rafael > > > > On Fri, Nov 13, 2009 at 14:14, Magicloud Magiclouds > wrote: >> >> Hi,

Re: [Haskell-cafe] Could someone teach me why we use Data.Monoid?

2009-11-13 Thread Magicloud Magiclouds
That is OK. Since understand the basic concept of monoid (I mean the thing in actual math), the idea here is totally not hard for me. But the sample here does not show why (or how) we use it in programming, right? On Sat, Nov 14, 2009 at 12:48 AM, Stephen Tetley wrote: > 2009/11/13 Rafael Gustavo

Re: [Haskell-cafe] Could someone teach me why we use Data.Monoid?

2009-11-13 Thread Magicloud Magiclouds
monoid >  - Aforementioned monoids lifted to functions >  - Monoidal folds (Data.Foldable) >  - ... > > 2009/11/13 Magicloud Magiclouds : >> Hi, >>  I have looked the concept of monoid and something related, but >> still, I do not know why we use it? >> >> --

Re: [Haskell-cafe] Re: Could someone teach me why we use Data.Monoid?

2009-11-13 Thread Magicloud Magiclouds
It is a great example, shows both howto and benefits. Thanks. 2009/11/14 Maurí­cio CA : >>  I have looked the concept of monoid and something related, but >> still, I do not know why we use it? > > I don't know if it's a good example, but it's simple. This > package I wrote uses reverse polish not

Re: [Haskell-cafe] Could someone teach me why we use Data.Monoid?

2009-11-13 Thread Magicloud Magiclouds
is just a newtype for A -> A. > > More simply, dualization is flipping the binary operation, and the > endo monoid is the monoid of functions a->a with composition. > > 2009/11/13 Magicloud Magiclouds : >> I see. Then what is about Dual and Endo? Especially Endo, I compl

[Haskell-cafe] How to deal with C buf in Haskell?

2009-12-07 Thread Magicloud Magiclouds
Hi, I am warping some C libs. In one function, I do this: 183 allocaBytes bufLen $ \buf -> do 184ret <- {# call buf_read #} 185 bluh 186 bala 187 buf 188 bufLen 189if ret < 0 190 then userError "bufRead error" 191 else -- what should I do here? I am think

[Haskell-cafe] How to make this data type work?

2013-06-21 Thread Magicloud Magiclouds
data ActionData = AD { oldData :: (FromJSON j, ToJSON j) => j , newData :: (FromJSON j, ToJSON j) => j} instance ToJSON ActionData where toJSON (AD o n) = object [ "oldData" .= o , "newData" .= n ] instance FromJSON ActionData where parseJSO

Re: [Haskell-cafe] Fwd: How to make this data type work?

2013-06-23 Thread Magicloud Magiclouds
mismatch: for serializing (ToJSON) you need your "j" >> type to be known to the AD value (meaning: it should be quantified >> existentially), but for deserializing you need it to be any type >> (quantified universally). >> >> All in all, AD seems to be the

[Haskell-cafe] How to use Template Haskell based on code that generated by another Template?

2013-07-02 Thread Magicloud Magiclouds
I have a yesod project, which generated, say, UserPassword in module Model. Then I wrote my template code which generate a piece of code to use UserPassword. I imported Model in my code. Then I got Illegal variable name: `UserPassword' When splicing a TH declaration: -- 竹密岂妨流水过 山高哪阻野云飞 And f

Re: [Haskell-cafe] How to use Template Haskell based on code that generated by another Template?

2013-07-03 Thread Magicloud Magiclouds
Yes, I misunderstood the generated code and splice shown in error message. Thanks. On Wed, Jul 3, 2013 at 11:04 PM, adam vogt wrote: > On Wed, Jul 3, 2013 at 2:25 AM, Magicloud Magiclouds > wrote: > > Then I got > > Illegal variable name: `UserPassword' > > W

[Haskell-cafe] How to do this in FP way?

2008-06-15 Thread Magicloud Magiclouds
Hello, I am getting familiar with FP now, and I have a "program design" kind of question. Say I have something like this in C: static int old; int diff (int now) { /* this would be called once a second */ int ret = now - old; old = now; return ret; } Because there is no "variable"

[Haskell-cafe] Does gtk2hs support VTE?

2009-02-16 Thread Magicloud Magiclouds
Hi, I always see a file named vte something in "doc" folder, but I never see vte in reference or source. So I wonder if gtk2hs actually supports VTE. And I'd like to have that supporting -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-C

  1   2   3   >