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

2013-07-03 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

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 vogt.a...@gmail.com wrote: On Wed, Jul 3, 2013 at 2:25 AM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Then I got Illegal variable name

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

2013-06-23 Thread Magicloud Magiclouds
to be the wrong type. 21.06.2013, 12:18, Magicloud Magiclouds magicloud.magiclo...@gmail.com : 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

[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 parseJSON

Re: [Haskell-cafe] [Conduit] weird action of leftover.

2013-04-08 Thread Magicloud Magiclouds
/20130313-1/conduit/src/Data-Conduit-Binary.html#lines On Mon, Apr 8, 2013 at 8:44 AM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Say I have code like below. If I comment the leftover in main, I got (Just L1\n, Just L2\n, Just L3\n, Just L4\n). But if I did not comment

[Haskell-cafe] [Conduit] weird action of leftover.

2013-04-07 Thread Magicloud Magiclouds
Say I have code like below. If I comment the leftover in main, I got (Just L1\n, Just L2\n, Just L3\n, Just L4\n). But if I did not comment the leftover, then I got (Just L1\n, Just L1\n, Just , Just L2\n). Why is not it (Just L1\n, Just L1\n, Just L2\n, Just L3\n)? takeLine :: (Monad m) =

[Haskell-cafe] Fwd: [Yesod] Type issue when migrating to new yesod

2013-04-02 Thread Magicloud Magiclouds
Hi, I have a yesod project that used to be compilable. Now when I migrate it to latest yesod, it failed compiling. -- Forwarded message -- From: Magicloud Magiclouds magicloud.magiclo...@gmail.com Date: Tue, Apr 2, 2013 at 9:32 PM Subject: Re: [Yesod] Type issue in new yesod

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

2013-01-16 Thread Magicloud Magiclouds
Never noticed copy command. Let me see On Wed, Jan 16, 2013 at 1:51 PM, Albert Y. C. Lai tre...@vex.net wrote: 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

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

2013-01-16 Thread Magicloud Magiclouds
-library-profiling --disable-executable-profiling' The alias 'ciq' stands for 'cabal install quick' and disables things I don't need during development, but do slow down the build. Regards, Erik On Wed, Jan 16, 2013 at 3:10 AM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: So

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

2013-01-15 Thread Magicloud Magiclouds
So the only way is to use param every time I build this certain project? Really hoping I could disable it in project.cabal On Wed, Jan 16, 2013 at 6:45 AM, Albert Y. C. Lai tre...@vex.net wrote: On 13-01-15 12:06 AM, Magicloud Magiclouds wrote: I have enabled document in .cabal

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

2013-01-15 Thread Magicloud Magiclouds
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 fold on types?

2012-12-25 Thread Magicloud Magiclouds
You guys are great! Thanks. On Wed, Dec 26, 2012 at 9:04 AM, Timon Gehr timon.g...@gmx.ch wrote: On 12/25/2012 09:59 AM, Magicloud Magiclouds wrote: Say I have things like: data LongDec = LongDef a b c ... x y z values = [ 'a', 'b', 'c', ... 'x', 'y', 'z' ] Now I want them to be LongDef

Re: [Haskell-cafe] A weird bug of regex-pcre

2012-12-18 Thread Magicloud Magiclouds
I see. A known bug. Thank you all. On Tue, Dec 18, 2012 at 10:11 PM, Rico Moorman rico.moor...@gmail.comwrote: regex = table\\s+class=\sourceCode[^]+.*?/table- And mind the sneaky single - ... it doe not belong there ;-) -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use

Re: [Haskell-cafe] Is there a tool like ri from ruby?

2012-11-25 Thread Magicloud Magiclouds
Thank you two. I have got it working. Compared to ri, I think: The pro is I could find the package that I want even I do not know it. The con is I'd have to manually update its data. On Mon, Nov 26, 2012 at 9:21 AM, John Wiegley jo...@fpcomplete.com wrote: Tikhon Jelvis tik...@jelv.is writes:

[Haskell-cafe] Is there a tool like ri from ruby?

2012-11-23 Thread Magicloud Magiclouds
RI is a very easy using tool that search and show the documents of ruby modules/functions, etc. Using RI, I could get help when programming with a few commands. Quick and simple. And with RI backend (libs), I could also simply integrate ri to my IDE (like one hotkey to show function summary). So

Re: [Haskell-cafe] Hackage dependencies problem.

2012-11-19 Thread Magicloud Magiclouds
, Magicloud Magiclouds magicloud.magiclouds@gmail.**com magicloud.magiclo...@gmail.com wrote: command line: cannot satisfy -package Cabal-1.16.0: Cabal-1.16.0-**dd0ce1db6fea670a788547ee854114**86 is unusable due to missing or recursive dependencies: directory-1.2.0.0

Re: [Haskell-cafe] Executables got bigger using dynamic link.

2012-10-29 Thread Magicloud Magiclouds
Sorry, I left the profiling option on, which seems to suppress the dynamic options. On Mon, Oct 29, 2012 at 1:29 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Hi, I set shared: True in ~/.cabal/config, and using ghc 7.6.1. Then clear user space hackages and reinstall them

Re: [Haskell-cafe] object file cannot be loaded.

2012-10-09 Thread Magicloud Magiclouds
Seems like an issue with fedora17's ld. I altered it with ld.gold. Working. On Tue, Oct 9, 2012 at 7:33 AM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Could anyone help me on this? On Sun, Oct 7, 2012 at 10:34 AM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote

Re: [Haskell-cafe] object file cannot be loaded.

2012-10-08 Thread Magicloud Magiclouds
Could anyone help me on this? On Sun, Oct 7, 2012 at 10:34 AM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: There is none On Sun, Oct 7, 2012 at 4:27 AM, Thomas Schilling nomin...@googlemail.com wrote: Does `ghc-pkg check` report any issues? On 6 October 2012 15:24

Re: [Haskell-cafe] object file cannot be loaded.

2012-10-06 Thread Magicloud Magiclouds
There is none On Sun, Oct 7, 2012 at 4:27 AM, Thomas Schilling nomin...@googlemail.com wrote: Does `ghc-pkg check` report any issues? On 6 October 2012 15:24, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Hi, I am installing postgres hackage (cannot remember the exact

Re: [Haskell-cafe] What is the good way to work with list comprehension and UTCTime?

2012-09-17 Thread Magicloud Magiclouds
Thank you. Will do. On Mon, Sep 17, 2012 at 7:14 AM, Antoine Latter aslat...@gmail.com wrote: On Sun, Sep 16, 2012 at 5:04 PM, Richard O'Keefe o...@cs.otago.ac.nz wrote: On 15/09/2012, at 5:14 AM, Chris Heller wrote: You might want to have a look at the time-recurrence package:

Re: [Haskell-cafe] What is the good way to work with list comprehension and UTCTime?

2012-09-14 Thread Magicloud Magiclouds
) t | n - [0..]] (you need fromIntegral for seconds, because it is of fractional type in Data.Time). iterate style, as suggested by Karl: iterate (seconds ^+= 1) t iterate (minutes ^+= 1) t On Fri, Sep 14, 2012 at 7:29 AM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Hi

[Haskell-cafe] What is the good way to work with list comprehension and UTCTime?

2012-09-13 Thread Magicloud Magiclouds
Hi, Simple usage, I could make an instance of Enum to UTCTime, so [utcTime..] could work. But that is so stiff. How if sometimes I want to step by 1 min, sometimes I want to step by 1 sec? So I think some way like [ t | addUTCTime last 60 ] could be nice. But I cannot figure it out Any

[Haskell-cafe] How to waitForProcess?

2012-09-04 Thread Magicloud Magiclouds
Hi, I have code like this and it leaves lots of zombies of flow-export. Then I add waitForProcess Well I do not know where to put it. Before or after 'hGetContents' both make the program hung. exportCSV :: FilePath - IO [String] exportCSV file = do csv_ - withBinaryFile file ReadMode $ \i

Re: [Haskell-cafe] How to waitForProcess?

2012-09-04 Thread Magicloud Magiclouds
Forgot about that, just read 'readProcess' code to figure out. Thanks. On Wed, Sep 5, 2012 at 12:37 PM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 5 September 2012 13:45, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Hi, I have code like this and it leaves lots

[Haskell-cafe] How to simplify the code of Maybe within a monad?

2012-08-16 Thread Magicloud Magiclouds
Hi, Since Maybe is a monad, I could write code like 'maybeA maybeB maybeC' to check if all these are not Nothing. Or 'liftM foo maybeD' to avoid ugly 'case of'. But how if here maybe[ABC] are like 'IO (Maybe Int)', or foo is type of 'Int - IO Int'? -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use

[Haskell-cafe] How to add constraint to .cabal?

2012-07-18 Thread Magicloud Magiclouds
Hi, Say I have a package that only appends --constraint=template-haskell==2.7.0.0 --constraint=warp-tls==1.2.1 could I install it. Now I want to release the package, then how could I have these constraint into the .cabal so the user would not get troubled? -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please

Re: [Haskell-cafe] What is the difference between runhaskell and compile?

2012-07-16 Thread Magicloud Magiclouds
Have found the place in openldap where the error occurs, but do not know why. Please refer to http://hackage.haskell.org/trac/ghc/ticket/6128 . On Thu, Jul 12, 2012 at 2:03 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: I made a little code, to explicitly use unbind: ldapWith

Re: [Haskell-cafe] What is the difference between runhaskell and compile?

2012-07-16 Thread Magicloud Magiclouds
Sorry for that. The problem got solved yesterday. On Mon, Jul 16, 2012 at 6:01 PM, Lars Viklund z...@acc.umu.se wrote: On Thu, Jul 12, 2012 at 09:41:43AM +0800, Magicloud Magiclouds wrote: Sorry for the attachments. They are wireshark files. May I suggest not sending multi-megabyte files

Re: [Haskell-cafe] Bad interface problem.

2012-07-11 Thread Magicloud Magiclouds
(or cabal?) required package-version:function. But --constraint='template-haskell-2.7.0.0' did make it compiled. On Wed, Jul 11, 2012 at 1:34 PM, Claude Heiland-Allen cla...@mathr.co.uk wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, On 11/07/12 05:51, Magicloud Magiclouds wrote: I

Re: [Haskell-cafe] Bad interface problem.

2012-07-11 Thread Magicloud Magiclouds
But why it does not occur on other installation? And Albert, I did not directly install QuickCheck. It was required by yesod. On Wed, Jul 11, 2012 at 10:55 PM, Brandon Allbery allber...@gmail.com wrote: On Wed, Jul 11, 2012 at 5:28 AM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote

Re: [Haskell-cafe] What is the difference between runhaskell and compile?

2012-07-11 Thread Magicloud Magiclouds
on On Fri, Jun 1, 2012 at 5:17 PM, Chris Dornan ch...@chrisdornan.com wrote: No problem -- I have attached the executable too. Chris -Original Message- From: Magicloud Magiclouds [mailto:magicloud.magiclo...@gmail.com] Sent: 01 June 2012 02:01 To: Chris Dornan Subject: Re: [Haskell

Re: [Haskell-cafe] What is the difference between runhaskell and compile?

2012-07-11 Thread Magicloud Magiclouds
Dug a little more. Seems that ghc 7.4.* finalizes (ldap_unbind action) the ldap ptr before the references were actually dropped. On Thu, Jul 12, 2012 at 9:41 AM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Sorry for the attachments. They are wireshark files. On Thu, Jul 12, 2012

Re: [Haskell-cafe] Bad interface problem.

2012-07-10 Thread Magicloud Magiclouds
I cleaned out everything, no luck On Fri, Jul 6, 2012 at 2:14 AM, Albert Y. C. Lai tre...@vex.net wrote: On 12-07-03 04:19 AM, Magicloud Magiclouds wrote: $ cabal --upgrade-dependencies --enable-documentation --force-reinstalls --solver=topdown QuickCheck-2.5 Test/QuickCheck/All.hs:15:1

[Haskell-cafe] Bad interface problem.

2012-07-03 Thread Magicloud Magiclouds
Hi, This had never happened to me. And I have no idea what to do. $ cabal --upgrade-dependencies --enable-documentation --force-reinstalls --solver=topdown QuickCheck-2.5 Test/QuickCheck/All.hs:15:1: Bad interface file:

Re: [Haskell-cafe] About using type to do type alias.

2012-06-25 Thread Magicloud Magiclouds
Here is the code, I joined two modules in one paste. Both of them cannot pass compiling. http://hpaste.org/70418 On Mon, Jun 25, 2012 at 2:16 PM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 25 June 2012 12:50, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Hi

Re: [Haskell-cafe] About using type to do type alias.

2012-06-25 Thread Magicloud Magiclouds
, Magicloud Magiclouds wrote: Here is the code, I joined two modules in one paste. Both of them cannot pass compiling. http://hpaste.org/70418 On Mon, Jun 25, 2012 at 2:16 PM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com (mailto:ivan.miljeno...@gmail.com) wrote: On 25 June 2012 12:50

Re: [Haskell-cafe] About using type to do type alias.

2012-06-25 Thread Magicloud Magiclouds
the issue. None of us can compile your code, either, because we're missing many of the dependencies, and unfortunately the issue is no easier (for me) to track down with the full source listing in this case. Cheers, Arlen On Monday, 25 June 2012 at 5:46 PM, Magicloud Magiclouds wrote: Here

Re: [Haskell-cafe] About using type to do type alias.

2012-06-25 Thread Magicloud Magiclouds
Even more weird, I installed container-0.5.0.0, and now it just compiled! I will dig more of that. Sorry to bother you guys. On Mon, Jun 25, 2012 at 5:53 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Interesting, seems like mapM did not effect the problem Let me try more

[Haskell-cafe] About using type to do type alias.

2012-06-24 Thread Magicloud Magiclouds
Hi, There was another mail, but the subject might be confusing. So I write this one. The code is here: http://hpaste.org/70414 If I understand correct, generally, I could use 'type' to do alias to save the ugly-long code. Like section 1. This works when I 't [(0, Just x)]'. But, if I wrote

Re: [Haskell-cafe] Again, version conflicting problem with cabal-install

2012-06-20 Thread Magicloud Magiclouds
OK. I found cabal-src tool, which solved this perfect. On Wed, Jun 20, 2012 at 9:22 AM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Hi,  The names here were just placeholder. And I just found out the reason.  Hackage magicloud is local (not from hackage.haskell.org

Re: [Haskell-cafe] Again, version conflicting problem with cabal-install

2012-06-19 Thread Magicloud Magiclouds
the solvers are using the status that is installed, not the definitions from original hackages? On Wed, May 2, 2012 at 2:47 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Hi, long time no see. I am using cabal-install-0.15.0. And the new solver. It sure solves some problem. Thanks

Re: [Haskell-cafe] Again, version conflicting problem with cabal-install

2012-06-19 Thread Magicloud Magiclouds
Hi, The names here were just placeholder. And I just found out the reason. Hackage magicloud is local (not from hackage.haskell.org), there is no its information in cabal INDEX (I assumed so). But this raised another question, how to reference a local hackage in .cabal. So the solver could use

Re: [Haskell-cafe] What extension do I need to write type Job = Map k a?

2012-06-14 Thread Magicloud Magiclouds
:24 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: I think I need to think this through On Thu, Jun 14, 2012 at 12:28 PM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 14 June 2012 14:20, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: OK. I think I

Re: [Haskell-cafe] What extension do I need to write type Job = Map k a?

2012-06-14 Thread Magicloud Magiclouds
Sorry, the last 'a' of line 22 is 'b'. On Thu, Jun 14, 2012 at 3:19 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: OK. I am totally confused here. Why Couldn't match expected type `Jobs k e a' with actual type `M.Map k0 b0'  9|data JobInfo a e = (Exception e) = 10

Re: [Haskell-cafe] What extension do I need to write type Job = Map k a?

2012-06-14 Thread Magicloud Magiclouds
And line 14, should be JobInfo a e. I must be too sleepy On Thu, Jun 14, 2012 at 3:30 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Sorry, the last 'a' of line 22 is 'b'. On Thu, Jun 14, 2012 at 3:19 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: OK. I am

Re: [Haskell-cafe] What extension do I need to write type Job = Map k a?

2012-06-14 Thread Magicloud Magiclouds
at 5:33 PM, Magicloud Magiclouds wrote: And line 14, should be JobInfo a e. I must be too sleepy On Thu, Jun 14, 2012 at 3:30 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com (mailto:magicloud.magiclo...@gmail.com) wrote: Sorry, the last 'a' of line 22 is 'b'. On Thu, Jun

[Haskell-cafe] What extension do I need to write type Job = Map k a?

2012-06-13 Thread Magicloud Magiclouds
Hi, I've forgotten this. This is OK: type Job k a = Map k a And this is OK: {-# LANGUAGE RankNTypes #-} -- or LiberalTypeSynonyms? type Job = forall a. forall k. Map k a Then how to write it like this? type Job = Map k a -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com.

Re: [Haskell-cafe] What extension do I need to write type Job = Map k a?

2012-06-13 Thread Magicloud Magiclouds
*. 2012/6/13 Magicloud Magiclouds magicloud.magiclo...@gmail.com Hi,  I've forgotten this.  This is OK: type Job k a = Map k a  And this is OK: {-# LANGUAGE RankNTypes #-} -- or LiberalTypeSynonyms? type Job = forall a. forall k. Map k a  Then how to write it like this? type Job = Map k

Re: [Haskell-cafe] What extension do I need to write type Job = Map k a?

2012-06-13 Thread Magicloud Magiclouds
you have hidden them. But the typechecker can use it to ensure some static property. Also you could use unsafeCoerce to do some casts, but *only if you are *sure* that things will go OK*. 2012/6/13 Magicloud Magiclouds magicloud.magiclo...@gmail.com Hi,  I've forgotten this.  This is OK

Re: [Haskell-cafe] What extension do I need to write type Job = Map k a?

2012-06-13 Thread Magicloud Magiclouds
String }) to provide the guarantee that you're getting a Job (and not any Map Int String) without performance loss. Let me know if I've been more confusing than helpful; Arlen On Thursday, 14 June 2012 at 1:16 PM, Magicloud Magiclouds wrote: Hi there, Thanks for the reply. To be clear

Re: [Haskell-cafe] What extension do I need to write type Job = Map k a?

2012-06-13 Thread Magicloud Magiclouds
I think I need to think this through On Thu, Jun 14, 2012 at 12:28 PM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 14 June 2012 14:20, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: OK. I think I understand a little. I use Job here just wants to simplify the code

Re: [Haskell-cafe] What is the difference between runhaskell and compile?

2012-05-29 Thread Magicloud Magiclouds
A little information. I did not notice the gcc/binutils versions. But in CentOS, the ghc 7.2.2/7.4.1 were all compiled myself with all default configurations. On Tue, May 29, 2012 at 10:54 PM, Chris Dornan ch...@chrisdornan.com wrote: On 29 May 2012 02:21, Magicloud Magiclouds magicloud.magiclo

Re: [Haskell-cafe] What is the difference between runhaskell and compile?

2012-05-28 Thread Magicloud Magiclouds
Sorry for the wrong information. I made a mistake when did the test. After more testing, I think it is a bug of ghc 7.4.1. Until now, I cannot find a way to make ghc 7.4.1 compiled binary work. On Mon, May 28, 2012 at 11:01 AM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Alright

Re: [Haskell-cafe] What is the difference between runhaskell and compile?

2012-05-28 Thread Magicloud Magiclouds
Interesting. I have this code tested in Debian unstable/stable, CentOS 6.1, all 64 bit, with two different version of libldap2. At first, Debian-s were installed with 7.4.1, CentOS with 7.2.2. Only in CentOS the code connected after compiled. Then I removed 7.4.1 from Debian stable and installed

Re: [Haskell-cafe] What is the difference between runhaskell and compile?

2012-05-27 Thread Magicloud Magiclouds
are we talking about? (I don’t think I have tested this on GHC-7.4.1, and maybe the others haven’t either.) Chris From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe-boun...@haskell.org] On Behalf Of Brandon Allbery Sent: 25 May 2012 04:21 To: Magicloud Magiclouds Cc: Haskell

Re: [Haskell-cafe] What is the difference between runhaskell and compile?

2012-05-27 Thread Magicloud Magiclouds
be a 7.4.1 oddity but it looks as if it could be some kind of GHC mis-installation. (If trying this with GHC-7.0.4 would be bothersome I would be interested to hear more; which O/S are you using?) Chris -Original Message- From: Magicloud Magiclouds [mailto:magicloud.magiclo...@gmail.com

[Haskell-cafe] What is the difference between runhaskell and compile?

2012-05-24 Thread Magicloud Magiclouds
Hi, I am writing a small program using LDAP hackage. A weird problem occured. When the code was run by runhaskell, things were fine, worked as expected. But when ghc compiled (no any args), and ran, I got this: LDAP error: ldapSimpleBind: LDAPException LdapServerDown(-1): Can't contact LDAP

Re: [Haskell-cafe] What is the difference between runhaskell and compile?

2012-05-24 Thread Magicloud Magiclouds
run with runhaskell. Our directory server runs Active Directory. On May 24, 2012, at 11:36 AM, Magicloud Magiclouds wrote: Hi,  I am writing a small program using LDAP hackage. A weird problem occured.  When the code was run by runhaskell, things were fine, worked as expected.  But when

Re: [Haskell-cafe] What is the difference between runhaskell and compile?

2012-05-24 Thread Magicloud Magiclouds
= ++ alias ++ )((objectClass=user)(!(ou=Recycle_Bin) ldap - ldapInit domain ldapPort ldapSimpleBind ldap bindDN bindPW And ghc -threaded does not help. On Fri, May 25, 2012 at 11:20 AM, Brandon Allbery allber...@gmail.com wrote: On Thu, May 24, 2012 at 11:05 PM, Magicloud Magiclouds

Re: [Haskell-cafe] Problem with forall type in type declaration

2012-05-07 Thread Magicloud Magiclouds
Anyone could help on this? On Fri, May 4, 2012 at 11:12 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Sorry to use Monad as the example, I meant this one:  run :: MonadTrans m = m IO a - IO a And Daniel, I do not think adding another type b a good idea. Since run could

[Haskell-cafe] Problem with forall type in type declaration

2012-05-04 Thread Magicloud Magiclouds
Hi, Assuming this: run :: Monad IO a - IO a data Test = Test { f } Here I'd like to set f to run, like Test run. Then what is the type of f? The confusing (me) part is that, the argument pass to f is not fixed on return type, like f1 :: Monad IO (), f2 :: Monad IO Int. So data Test a = Test

Re: [Haskell-cafe] Problem with forall type in type declaration

2012-05-04 Thread Magicloud Magiclouds
m = m a - IO a Are you trying to make: run :: IO a - IO a ?? 2012/5/4 Magicloud Magiclouds magicloud.magiclo...@gmail.com Hi,  Assuming this: run :: Monad IO a - IO a data Test = Test { f }  Here I'd like to set f to run, like Test run. Then what is the type of f?  The confusing (me

Re: [Haskell-cafe] Problem with forall type in type declaration

2012-05-04 Thread Magicloud Magiclouds
Sorry to use Monad as the example, I meant this one: run :: MonadTrans m = m IO a - IO a And Daniel, I do not think adding another type b a good idea. Since run could actually return any inside type (depending on another function that passed to it). Even simple as different tuples would destroy

Re: [Haskell-cafe] Again, version conflicting problem with cabal-install

2012-05-02 Thread Magicloud Magiclouds
Hi, long time no see. I am using cabal-install-0.15.0. And the new solver. It sure solves some problem. Thanks for the work. Well, on the other hand, there still are hackages that I just have no idea how the author make it (probably not up-to-date hackage database). After human-solver checking,

Re: [Haskell-cafe] Again, version conflicting problem with cabal-install

2012-02-03 Thread Magicloud Magiclouds
suffered recently). Maybe I should crack my cabal source to add an argument to ignore version checking On Fri, Feb 3, 2012 at 2:44 PM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 3 February 2012 17:29, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Thank you. The document

Re: [Haskell-cafe] Again, version conflicting problem with cabal-install

2012-02-03 Thread Magicloud Magiclouds
Glad to hear that. I will checkout the trunk and try. On Fri, Feb 3, 2012 at 6:20 PM, Andres Löh andres.l...@googlemail.com wrote: Hi. On Fri, Feb 3, 2012 at 7:44 AM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 3 February 2012 17:29, Magicloud Magiclouds magicloud.magiclo

Re: [Haskell-cafe] Again, version conflicting problem with cabal-install

2012-02-03 Thread Magicloud Magiclouds
experience using cabal-dev made the problem go away. I hope that clarifies. Jason On Fri, Feb 3, 2012 at 7:33 AM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Well, cabal-dev could not resolve the conflict of the diamond. Because the conflict is depending different version

[Haskell-cafe] Again, version conflicting problem with cabal-install

2012-02-02 Thread Magicloud Magiclouds
Hello, As I recalled, ghc works in staticly link mode. So after one library is compiled, all its build dependencies are useless. Lost, changed, wheresoever, it does not matter. Then why the problem of version conflicting exists? By version conflicting I mean like following. This way, A is

Re: [Haskell-cafe] Again, version conflicting problem with cabal-install

2012-02-02 Thread Magicloud Magiclouds
. It is not perfect, but would work sometimes On Fri, Feb 3, 2012 at 2:04 PM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 3 February 2012 16:54, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Hello,  As I recalled, ghc works in staticly link mode. So after one

[Haskell-cafe] LDAP hackage problem.

2012-01-12 Thread Magicloud Magiclouds
Hi, I have a Windows AD server. And ldapsearch tool works to get someone's information. But when I turned it into Haskell code. It does not work as expected. Here is the ldapsearch and result. You can see that sn/givenName have values that are encoded utf-8. Next to it is the code I am

[Haskell-cafe] How to catch all exceptions that could be caught?

2012-01-11 Thread Magicloud Magiclouds
Hi, With Prelude.catch, I could write catch () $ \_ - return Nothing. But with Control.Exception.catch, I must specify a type for the _. What should I do? PS: In Java document, a function declaration would tell us both the incoming args and outgoing, AND what exceptions would it throw. But it

Re: [Haskell-cafe] How to catch all exceptions that could be caught?

2012-01-11 Thread Magicloud Magiclouds
...@gmail.com wrote: On 01/12/12 13:03, Magicloud Magiclouds wrote: Hi,   With Prelude.catch, I could write catch () $ \_ - return Nothing. But with Control.Exception.catch, I must specify a type for the _. What should I do? Use SomeException for the type, as it is the base of the exception hierarchy

Re: [Haskell-cafe] How to catch all exceptions that could be caught?

2012-01-11 Thread Magicloud Magiclouds
Thank you so much. I was always confused by what exception should I catch. On Thu, Jan 12, 2012 at 3:49 PM, Gregory Crosswhite gcrosswh...@gmail.com wrote: On 01/12/12 16:58, Magicloud Magiclouds wrote: Yes, that is a problem. But consider my PS in original mail, I have no idea what exception

[Haskell-cafe] How to show a utf8 string?

2012-01-10 Thread Magicloud Magiclouds
Hi, I am using LDAP hackage to do some ldap searching. I am not sure if this is its problem. All Chinese chars returned like \29579. How to convert it to the actual Chinese char? I thought it was my terminal's fault, so tried to use System.IO.UTF8 to put the result into a file and viewed by

Re: [Haskell-cafe] How to show a utf8 string?

2012-01-10 Thread Magicloud Magiclouds
characters with a codepoint 127. 2012/1/10 Magicloud Magiclouds magicloud.magiclo...@gmail.com: Hi,  I am using LDAP hackage to do some ldap searching. I am not sure if this is its problem. All Chinese chars returned like \29579.  How to convert it to the actual Chinese char? I thought it was my

Re: [Haskell-cafe] Deduce problem.

2011-11-17 Thread Magicloud Magiclouds
From the code, I think it is what I want. But still, I need some time to understand it Anyway, thank you. On Thu, Nov 17, 2011 at 4:02 PM, o...@okmij.org wrote: Multi-parameter type classes are more flexible. Here is how you can write your old code: {-# LANGUAGE MultiParamTypeClasses,

[Haskell-cafe] Deduce problem.

2011-11-16 Thread Magicloud Magiclouds
Hi, Consider I have declarations like this: class (ClassA a) = ClassC a where from :: (ClassB b) = a - [b] to :: (ClassB c) = a - [c] data H = ... instance ClassB H where ... data Test = Test { m :: H } instance ClassA Test where ... instance ClassC Test where from = m to = m

Re: [Haskell-cafe] Deduce problem.

2011-11-16 Thread Magicloud Magiclouds
On Thu, Nov 17, 2011 at 11:48 AM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Hi,  Consider I have declarations like this: class (ClassA a) = ClassC a where  from :: (ClassB b) = a - [b]  to :: (ClassB c) = a - [c] data H = ... instance ClassB H where  ... data Test

Re: [Haskell-cafe] Deduce problem.

2011-11-16 Thread Magicloud Magiclouds
], but you're trying to implement it as Test - H. On 17 Nov 2011, at 07:48, Magicloud Magiclouds wrote: Hi,  Consider I have declarations like this: class (ClassA a) = ClassC a where  from :: (ClassB b) = a - [b]  to :: (ClassB c) = a - [c] data H = ... instance ClassB H where

Re: [Haskell-cafe] Deduce problem.

2011-11-16 Thread Magicloud Magiclouds
On Thu, Nov 17, 2011 at 1:17 PM, Brandon Allbery allber...@gmail.com wrote: On Wed, Nov 16, 2011 at 23:54, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: I think this is where I did not understand from the very beginning. If the the declaration was correct, then why cannot b be H

Re: [Haskell-cafe] Usage question with TemplateHaskell and Generic

2011-11-11 Thread Magicloud Magiclouds
, Nov 6, 2011 at 14:35, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Hi,  I'd like to simpler the work of deriving MyClass. And I have two ways to do: TemplateHaskell $(derivingMyClass), or Generic deriving (MyClass).  Since I need to get the type name in the deriving, then I met

[Haskell-cafe] Usage question with TemplateHaskell and Generic

2011-11-06 Thread Magicloud Magiclouds
Hi, I'd like to simpler the work of deriving MyClass. And I have two ways to do: TemplateHaskell $(derivingMyClass), or Generic deriving (MyClass). Since I need to get the type name in the deriving, then I met this question: If I have data A b = C b, then with TemplateHaskell, the type would

Re: [Haskell-cafe] ghc 7.2.1 Generics problem

2011-11-03 Thread Magicloud Magiclouds
2011/11/1 José Pedro Magalhães j...@cs.uu.nl: Oh, right, I see that some things on that page need updating; I'll do so. Thanks, Pedro On Tue, Nov 1, 2011 at 09:33, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: On Tue, Nov 1, 2011 at 1:59 PM, Andres Löh andres.l

[Haskell-cafe] Is generic information dumpable?

2011-11-03 Thread Magicloud Magiclouds
Hi, I am learning the new generic feature of ghc. I'd have to say, it is harder than template to enter. When I started to learn template, ghc -ddump-slices really helped. So I wonder if I could get the representation generated when deriving Generic. I think that would be a great help. --

Re: [Haskell-cafe] Problem with TemplateHaskell

2011-11-02 Thread Magicloud Magiclouds
On Tue, Nov 1, 2011 at 5:42 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Hi,  I have code as following, to make a toDocument function (using Data.Bsin.=:) for a data structure. bson :: DecsQ - DecsQ bson decsq = do  decs - decsq  let datad = head decs      DataD

Re: [Haskell-cafe] Problem with TemplateHaskell

2011-11-02 Thread Magicloud Magiclouds
On Wed, Nov 2, 2011 at 4:08 PM, Max Bolingbroke batterseapo...@hotmail.com wrote: On 2 November 2011 07:42, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: How to avoid the name changing? Maybe you should use nameBase rather than show? Max Yes, that is one of the problem

Re: [Haskell-cafe] Problem with TemplateHaskell

2011-11-02 Thread Magicloud Magiclouds
On Wed, Nov 2, 2011 at 4:50 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: On Wed, Nov 2, 2011 at 4:08 PM, Max Bolingbroke batterseapo...@hotmail.com wrote: On 2 November 2011 07:42, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: How to avoid the name changing

Re: [Haskell-cafe] ghc 7.2.1 Generics problem

2011-11-01 Thread Magicloud Magiclouds
On Tue, Nov 1, 2011 at 1:59 PM, Andres Löh andres.l...@googlemail.com wrote: Hi.  I do not know why, my ghc 7.2.1 does not seem to support DeriveRepresentable. I compiled the ghc 7.2.1 myself by ghc 7.0.4. All options default. $ ghc Types/TopTalkerRecord.hs Types/TopTalkerRecord.hs:2:14:

[Haskell-cafe] Problem with TemplateHaskell

2011-11-01 Thread Magicloud Magiclouds
Hi, I have code as following, to make a toDocument function (using Data.Bsin.=:) for a data structure. bson :: DecsQ - DecsQ bson decsq = do decs - decsq let datad = head decs DataD _ _ _ cons _ = datad to = mkName toDocument from = mkName fromDocument fund - mapM (\con

[Haskell-cafe] ghc 7.2.1 Generics problem

2011-10-31 Thread Magicloud Magiclouds
Hi, I do not know why, my ghc 7.2.1 does not seem to support DeriveRepresentable. I compiled the ghc 7.2.1 myself by ghc 7.0.4. All options default. $ ghc Types/TopTalkerRecord.hs Types/TopTalkerRecord.hs:2:14: Unsupported extension: DeriveRepresentable $ ghc --version The Glorious

Re: [Haskell-cafe] Is it possible to get the information of instances of a type?

2011-10-27 Thread Magicloud Magiclouds
On Thu, Oct 27, 2011 at 7:04 AM, Evan Laforge qdun...@gmail.com wrote: No, this lists all the instances of a class.  OP asked for the classes of which a given type is an instace. Presumably it is possible, since Haddock does it!  In the documentation generated for a type it lists classes of

Re: [Haskell-cafe] Is it possible to get the information of instances of a type?

2011-10-27 Thread Magicloud Magiclouds
On Thu, Oct 27, 2011 at 1:57 AM, Brent Yorgey byor...@seas.upenn.edu wrote: On Wed, Oct 26, 2011 at 09:10:23PM +0400, MigMit wrote: Can't be done. Even if this particular module doesn't contain instance Class Type, it's quite possible that the said instance would be defined in another module,

[Haskell-cafe] Is it possible to get the information of instances of a type?

2011-10-26 Thread Magicloud Magiclouds
Hi, If this was in ruby or other languages that support reflection, it won't be a question. But in Haskell, could I write a code to list the classes that a type instanced? TemplateHaskell as well. -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Problem on using class as type.

2011-10-08 Thread Magicloud Magiclouds
Hi there, I am using the toJson = id way, which doesn't seem to cause other problem. Thank you. On Mon, Oct 3, 2011 at 11:18 PM, Steffen Schuldenzucker sschuldenzuc...@uni-bonn.de wrote: On 10/03/2011 10:42 PM, Magicloud Magiclouds wrote: Hi,   I have a function: post :: (ToJson p

Re: [Haskell-cafe] How to compile this example code?

2011-10-03 Thread Magicloud Magiclouds
it through aspecial preprocessor. 1 - http://www.haskell.org/ghc/docs/7.2.1/html/users_guide/hsc2hs.html2 - http://www.cse.unsw.edu.au/~chak/haskell/c2hs/3 - http://stackoverflow.com/questions/6009031/difference-between-hsc2hs-and-c2hs 2011/10/3 Magicloud Magiclouds magicloud.magiclo

[Haskell-cafe] Problem on using class as type.

2011-10-03 Thread Magicloud Magiclouds
Hi, I have a function: post :: (ToJson p, FromJson q) = String - String - String - Map.Map String p - IO q Now I'd like to call it like: r - post site token user.addMedia (Map.fromList [ (users, users :: ToJson) , (medias, medias :: ToJson) ])

[Haskell-cafe] Problem on using template haskell.

2011-10-02 Thread Magicloud Magiclouds
Hi, I am trying to use data-flags library. And failed on compiling the test code. The code is like following, and the compiling error is test.hs:4:24: parse error on input `{' {-# LANGUAGE TemplateHaskell #-} import Data.Flags.TH $(bitmaskWrapper Severity ''Int [] False [ (NotClassified,

Re: [Haskell-cafe] Problem on using template haskell.

2011-10-02 Thread Magicloud Magiclouds
On Mon, Oct 3, 2011 at 1:44 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Hi,  I am trying to use data-flags library. And failed on compiling the test code.  The code is like following, and the compiling error is test.hs:4:24: parse error on input `{' {-# LANGUAGE

[Haskell-cafe] How to compile this example code?

2011-10-02 Thread Magicloud Magiclouds
Hi, I am learning to use data-flags, and got this example code: import Data.Flags newtype MyFlags = MyFlags CInt deriving (Eq, Flags) #{enum MyFlags, MyFlags , myFlag1 = C_FLAG1 , myFlag2 = C_FLAG2 , myFlag3 = C_FLAG3 } I modified it trying to compile it. Well, I got illegal syntax at

  1   2   3   >