Re: What could be the possible reason of linking errors on _info and _closure?
Sorry, my mistake. I had a misunderstanding of cabal file that I did not expose enough modules. On Mon, Feb 2, 2015 at 5:27 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Hi, I am making a cabal project including a library and a executable using the library. Building the library is fine. But when linking src/main, I got undefined reference to someFunction1_info and someFunction1_closure. -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
What could be the possible reason of linking errors on _info and _closure?
Hi, I am making a cabal project including a library and a executable using the library. Building the library is fine. But when linking src/main, I got undefined reference to someFunction1_info and someFunction1_closure. -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Dependencies missing when building ghc.
Works like a charm. Thank you. On Mon, Oct 13, 2014 at 3:16 PM, Yuras Shumovich shumovi...@gmail.com wrote: Hello, It is recommended to checkout 7.8 in special way, see https://ghc.haskell.org/trac/ghc/wiki/Building/GettingTheSources#checkout-old-branch That is because repo structure was changed after 7.8 Thanks, Yuras 13 Окт 2014 г. 4:03 пользователь Magicloud Magiclouds magicloud.magiclo...@gmail.com написал: Hi, I am with my new Ubuntu Trusty box. I have installed ghc by apt-get. Then I wanted to build ghc from git to upgrade to 7.8.3. I did following commands. I tried 'make clean', or reget the source. No luck yet. $ git clone --recursive git://git.haskell.org/ghc.git $ ./sync-all -r git://git.haskell.org remote set-url origin $ git checkout ghc-7.8.3-release $ ./sync-all get $ rm -r libraries/time # as prompted by sync-all $ ./sync-all get $ ./boot $ ./configure $ make ===--- building phase 0 make -r --no-print-directory -f ghc.mk phase=0 phase_0_builds make[1]: Nothing to be done for `phase_0_builds'. ===--- building phase 1 make -r --no-print-directory -f ghc.mk phase=1 phase_1_builds inplace/bin/ghc-cabal check libraries/haskell98 inplace/bin/ghc-cabal configure libraries/haskell98 dist-install --with-ghc=/home/local/ANT/shida/src/git/ghc/inplace/bin/ghc-stage1 --with-ghc-pkg=/home/local/ANT/shida/src/git/ghc/inplace/bin/ghc-pkg --disable-library-for-ghci --enable-library-vanilla --enable-library-profiling --enable-shared --configure-option=CFLAGS= -fno-stack-protector--configure-option=LDFLAGS= --configure-option=CPPFLAGS=--gcc-options= -fno-stack-protector --with-gcc=/usr/bin/gcc --with-ld=/usr/bin/ld --configure-option=--with-cc=/usr/bin/gcc --with-ar=/usr/bin/ar --with-ranlib=/usr/bin/ranlib --with-alex=/usr/bin/alex --with-happy=/usr/bin/happy Configuring haskell98-2.0.0.4... ghc-cabal: At least the following dependencies are missing: base ==4.8.* make[1]: *** [libraries/haskell98/dist-install/package-data.mk] Error 1 make: *** [all] Error 2 -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: [Haskell-cafe] Dependencies missing when building ghc.
That is something I did not know. Thank you. On Mon, Oct 13, 2014 at 4:14 PM, Daniel Trstenjak daniel.trsten...@gmail.com wrote: I am with my new Ubuntu Trusty box. I have installed ghc by apt-get. Then I wanted to build ghc from git to upgrade to 7.8.3. If you only want to install a newer ghc version on ubuntu or even multiple ghc versions at once, then I can only recommend the excellent PPA of Herbert Valerio Riedel: https://launchpad.net/~hvr/+archive/ubuntu/ghc Greetings, Daniel ___ Haskell-Cafe mailing list haskell-c...@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Dependencies missing when building ghc.
Hi, I am with my new Ubuntu Trusty box. I have installed ghc by apt-get. Then I wanted to build ghc from git to upgrade to 7.8.3. I did following commands. I tried 'make clean', or reget the source. No luck yet. $ git clone --recursive git://git.haskell.org/ghc.git $ ./sync-all -r git://git.haskell.org remote set-url origin $ git checkout ghc-7.8.3-release $ ./sync-all get $ rm -r libraries/time # as prompted by sync-all $ ./sync-all get $ ./boot $ ./configure $ make ===--- building phase 0 make -r --no-print-directory -f ghc.mk phase=0 phase_0_builds make[1]: Nothing to be done for `phase_0_builds'. ===--- building phase 1 make -r --no-print-directory -f ghc.mk phase=1 phase_1_builds inplace/bin/ghc-cabal check libraries/haskell98 inplace/bin/ghc-cabal configure libraries/haskell98 dist-install --with-ghc=/home/local/ANT/shida/src/git/ghc/inplace/bin/ghc-stage1 --with-ghc-pkg=/home/local/ANT/shida/src/git/ghc/inplace/bin/ghc-pkg --disable-library-for-ghci --enable-library-vanilla --enable-library-profiling --enable-shared --configure-option=CFLAGS= -fno-stack-protector--configure-option=LDFLAGS= --configure-option=CPPFLAGS=--gcc-options= -fno-stack-protector --with-gcc=/usr/bin/gcc --with-ld=/usr/bin/ld --configure-option=--with-cc=/usr/bin/gcc --with-ar=/usr/bin/ar --with-ranlib=/usr/bin/ranlib --with-alex=/usr/bin/alex --with-happy=/usr/bin/happy Configuring haskell98-2.0.0.4... ghc-cabal: At least the following dependencies are missing: base ==4.8.* make[1]: *** [libraries/haskell98/dist-install/package-data.mk] Error 1 make: *** [all] Error 2 -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
[Haskell-cafe] How to use Template Haskell based on code that generated by another Template?
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 for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to use Template Haskell based on code that generated by another Template?
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: `UserPassword' When splicing a TH declaration: Hi Magicloud, GHC seems to be trying to tell you that variables are lowercase in haskell. Since you don't have code, I'm guessing your error is from doing something like: wrong1 = print ($(dyn Just) 5) wrong2 = print ($(varE 'Just) 5) Which is a compile time error since you apparently can't pass a Name which is capitalized to `VarE :: Name - Exp' Any of these options work. They use the `ConE :: Name - Exp' constructor instead: opt1 = print ($(conE (mkName Just)) 5) opt2 = print ($(conE 'Just) 5) opt3 = print ($( [| Just |]) 5 ) -- Adam -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Fwd: How to make this data type work?
Thank you guys. I cannot use a explicit type for there are quite a few of them. But from MigMit, I understand why my original cannot work. On Sat, Jun 22, 2013 at 4:46 AM, Vincent Ambo taz...@gmail.com wrote: Is there a reason why you can't use an explicit type variable? {-# LANGUAGE OverloadedStrings, ExistentialQuantification #-} import Data.Aeson import Control.Applicative import Control.Monad (mzero) data ActionData j = (FromJSON j, ToJSON j) = AD j j instance ToJSON (ActionData j) where toJSON (AD o n) = object [ oldData .= o , newData .= n ] instance (ToJSON j, FromJSON j) = FromJSON (ActionData j) where parseJSON (Object v) = AD $ v .: oldData * v .: newData parseJSON _ = mzero 2013/6/21 Miguel Mitrofanov miguelim...@yandex.ru Forgot to reply all, as usual. Пересылаемое сообщение 21.06.2013, 12:52, Miguel Mitrofanov miguelim...@yandex.ru: Actually, this is not the real error you should care about. Try removing FromJSON instance completely, and you'll get a lot more. And these are fundamental: you have to decide what j to use when serializing. Haskell won't automagically substitute some suitable type for you. So, that's a classic 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 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 , newData .= n ] instance FromJSON ActionData where parseJSON (Object v) = AD $ v .: oldData * v .: newData parseJSON _ = mzero I got when compile: No instance for (FromJSON (forall j. (FromJSON j, ToJSON j) = j)) arising from a use of `.:' Possible fix: add an instance declaration for (FromJSON (forall j. (FromJSON j, ToJSON j) = j)) In the second argument of `($)', namely `v .: oldData' In the first argument of `(*)', namely `AD $ v .: oldData' In the expression: AD $ v .: oldData * v .: newData -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. , ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe Завершение пересылаемого сообщения ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] How to make this data type work?
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 (Object v) = AD $ v .: oldData * v .: newData parseJSON _ = mzero I got when compile: No instance for (FromJSON (forall j. (FromJSON j, ToJSON j) = j)) arising from a use of `.:' Possible fix: add an instance declaration for (FromJSON (forall j. (FromJSON j, ToJSON j) = j)) In the second argument of `($)', namely `v .: oldData' In the first argument of `(*)', namely `AD $ v .: oldData' In the expression: AD $ v .: oldData * v .: newData -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [Conduit] weird action of leftover.
Thank you for the reply. I've learnt the code of lines. So it is because how ByteString works, that the conduit is not a stream of bytes, but chunks, right? On Tue, Apr 9, 2013 at 12:12 PM, Michael Snoyman mich...@snoyman.comwrote: It's a bug in your implementation of takeLine I believe. It doesn't take into account that lines can span multiple chunks. When you call takeLine the first time, you get L1\n. leftover puts a chunk with exactly those contents back. When you call takeLine the second time, it gets the chunk L1\n, and your splitAt gives you back L1\n and . The is then leftover, and the next call to takeLine gets it. Your takeLine needs to include logic saying there's no newline in this chunk at all, let's get the next chunk and try that. You can look at the source to lines[1] for an example of the concept. Michael [1] http://haddocks.fpcomplete.com/fp/7.4.2/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 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) = Consumer ByteString m (Maybe ByteString) takeLine = do mBS - await case mBS of Nothing - return Nothing Just bs - case DBS.elemIndex _lf bs of Nothing - return $ Just bs Just i - do let (l, ls) = DBS.splitAt (i + 1) bs leftover ls return $ Just l main = do m - runResourceT $ sourceFile test.simple $$ (do a - takeLine leftover $ fromJust a b - takeLine c - takeLine d - takeLine return (a, b, c, d)) print m -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] [Conduit] weird action of leftover.
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) = Consumer ByteString m (Maybe ByteString) takeLine = do mBS - await case mBS of Nothing - return Nothing Just bs - case DBS.elemIndex _lf bs of Nothing - return $ Just bs Just i - do let (l, ls) = DBS.splitAt (i + 1) bs leftover ls return $ Just l main = do m - runResourceT $ sourceFile test.simple $$ (do a - takeLine leftover $ fromJust a b - takeLine c - takeLine d - takeLine return (a, b, c, d)) print m -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Fwd: [Yesod] Type issue when migrating to new yesod
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 To: yesod...@googlegroups.com yesod...@googlegroups.com Sure. The error message is as following. And the new code is here: http://pastebin.com/sqCkeY2q [12 of 13] Compiling Handler.FetchProcessPathRollup ( Handler/FetchProcessPathRollup.hs, dist/build/Handler/FetchProcessPathRollup.o ) Handler/FetchProcessPathRollup.hs:43:16: No instance for (PersistUnique (Data.Conduit.Internal.ConduitM (containers-0.5.0.0:Data.Map.Base.Map Text Text) ProcessPathRollup (ResourceT (Database.Persist.GenericSql.Raw.SqlPersist (GHandler App App) arising from a use of `getKey' Possible fix: add an instance declaration for (PersistUnique (Data.Conduit.Internal.ConduitM (containers-0.5.0.0:Data.Map.Base.Map Text Text) ProcessPathRollup (ResourceT (Database.Persist.GenericSql.Raw.SqlPersist (GHandler App App) In a stmt of a 'do' block: reportKey - getKey (UniqueReport (t Report)) (Report (t Report)) In the expression: do { let t = (!) r d = liftM fst . double . t ; reportKey - getKey (UniqueReport (t Report)) (Report (t Report)); lineitemKey - getKey (UniqueLineitem (t LineItem Name) (t LineItem Id)) (Lineitem (t LineItem Id) (t LineItem Name)); mainProcessKey - getKey (UniqueMainProcess (t Main Process)) (MainProcess (t Main Process)); } In the second argument of `($)', namely `\ r - do { let ...; reportKey - getKey (UniqueReport (t Report)) (Report (t Report)); }' On Tue, Apr 2, 2013 at 7:32 PM, Michael Snoyman mich...@snoyman.com wrote: Can you provide the new source code and the new compiler error message? On Tue, Apr 2, 2013 at 11:18 AM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Sorry, the first error about CSV was due to parsePPR's type. If I set it type, then CSV error was gone. And the error of PersistUnique reported on first getKey call, instead of processPPR call. On Tue, Apr 2, 2013 at 2:50 PM, Michael Snoyman mich...@snoyman.comwrote: This doesn't look like it's anything to do with Yesod; it looks like a problem with the usage of conduit and csv-conduit. Did you try following the GHC recommendation and adding a type signature to parsePPR? On Tue, Apr 2, 2013 at 8:09 AM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Hi, I have a yesod project that used to be compilable. Now when I migrate it to latest yesod, it failed compiling. The failed part is here: http://pastebin.com/pWn5FdeS . And the error message is: Handler/FetchProcessPathRollup.hs:27:30: No instance for (Data.CSV.Conduit.CSV Data.ByteString.Internal.ByteString (containers-0.5.0.0:Data.Map.Base.Map a0 Text)) arising from a use of `intoCSV' The type variable `a0' is ambiguous Possible fix: add a type signature that fixes these type variable(s) Note: there is a potential instance available: instance (Data.CSV.Conduit.CSV s (csv-conduit-0.5.1:Data.CSV.Conduit.Types.Row s'), Ord s', Data.String.IsString s) = Data.CSV.Conduit.CSV s (MapRow s') -- Defined in `Data.CSV.Conduit' Possible fix: add an instance declaration for (Data.CSV.Conduit.CSV Data.ByteString.Internal.ByteString (containers-0.5.0.0:Data.Map.Base.Map a0 Text)) In the first argument of `(=$=)', namely `intoCSV defCSVSettings' In the second argument of `($$+-)', namely `(intoCSV defCSVSettings =$= parsePPR (zonedTimeToUTC day) k =$ sinkPersist)' In a stmt of a 'do' block: responseBody src $$+- (intoCSV defCSVSettings =$= parsePPR (zonedTimeToUTC day) k =$ sinkPersist) Handler/FetchProcessPathRollup.hs:27:57: No instance for (PersistUnique (Data.Conduit.Internal.ConduitM (containers-0.5.0.0:Data.Map.Base.Map a0 Text) ProcessPathRollup (ResourceT (Database.Persist.GenericSql.Raw.SqlPersist (GHandler App App) arising from a use of `parsePPR' Possible fix: add an instance declaration
Re: I cannot compile ghc-7.6.2
Thank you. I thought the no such file lines were the problem. In fact my global container was hidden some how. On Tue, Feb 12, 2013 at 5:29 AM, Ian Lynagh i...@well-typed.com wrote: On Sun, Feb 10, 2013 at 06:35:25PM +0800, Magicloud Magiclouds wrote: Linuxmint Nadia, ghc-7.6.1 was built and running OK. Just downloaded ghc-7.6.2, without changing anything and environment, and boot and configure returned OK, I got these. What happened? /usr/local/bin/ghc -H32m -O --make utils/ghc-cabal/Main.hs -o utils/ghc-cabal/dist/build/tmp/ghc-cabal \ -no-user-package-db \ -Wall \ -DCABAL_VERSION=1,16,0 \ -odir bootstrapping \ -hidir bootstrapping \ -ilibraries/Cabal/Cabal \ -ilibraries/filepath \ -ilibraries/hpc \ rm -f compiler/stage1/build/Config.hs Creating compiler/stage1/build/Config.hs ... done. libraries/Cabal/Cabal/Distribution/ParseUtils.hs:88:18: Could not find module `Data.Map' It is a member of the hidden package `containers-0.5.0.0'. Use -v to see a list of the files searched for. make[1]: *** [utils/ghc-cabal/dist/build/tmp/ghc-cabal] Error 1 make: *** [all] Error 2 It looks like there is a problem with your bootstrapping compiler, possibly caused by having more than one copy of containers installed. ghc-pkg check or ghc-pkg list might help. Thanks Ian -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: How to compile ghc 7.6.2 with llvm?
On Wed, Feb 13, 2013 at 12:41 AM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: ./configure --with-gcc=/usr/bin/llvm-gcc Sorry, I was wrong. with 'with-gcc' option, I got a ld error, which I will post later. Without this option, I got native code generator result because the configure found gcc. Should I or not using this option? -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: How to compile ghc 7.6.2 with llvm?
Thank you for the replies. These are what I got, correct me if I am wrong: If I want to build ghc executables and standard libraries, all I need is to set perf-llvm. And set perf-llvm or not does not effect the ability of ghc to use llvm. Then how to check if the output files (executables, libraries) are generated by llvm, instead of gcc? In other words, to see if llvm was used correct. On Wed, Feb 13, 2013 at 1:09 AM, Brandon Allbery allber...@gmail.comwrote: On Tue, Feb 12, 2013 at 11:41 AM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Then I `mv build.mk.sample build.mk`, set BuildFlavour = perf-llvm, add GhcWithLlvmCodeGen = YES. Finally `./configure --with-gcc=/usr/bin/llvm-gcc`. Configure output attached. After make, I tried `inplace/bin/ghc-stage2 –info`, it is still using native code generator. What should I do? 1. I think --with-gcc= is independent of the llvm code generator. 2. Building the llvm codegen does not necessarily make it the *default* codegen; I think native remains default. I don't know if there's a way to specify that llvm should be the default code generator. fwiw, the ghc I have on here does not mention llvm in ghc --info, but ghc -fllvm at least tries to work. -- brandon s allbery kf8nh sine nomine associates allber...@gmail.com ballb...@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: [Haskell-cafe] How to disable document in .cabal file?
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 The param is for cabal install only. So don't use cabal install. cabal configure # may be skipped usually cabal build cabal copy If your project is a library (as opposed to an executable): add cabal register Why this is not controlled in project.cabal: The author of the project should not control whether users build docs or not. P.S. Ivan, --enable-documentation and --disable-documentation are not even valid flags to cabal configure. __**_ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/**mailman/listinfo/haskell-cafehttp://www.haskell.org/mailman/listinfo/haskell-cafe -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to disable document in .cabal file?
That is pretty much the way I do now. Just curious if there is another way On Wed, Jan 16, 2013 at 3:57 PM, Erik Hesselink hessel...@gmail.com wrote: You could do what I do: create an alias in bash. I have in my ~/.bashrc: alias ciq='cabal install --disable-documentation --disable-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 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/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? If cabal install: add --disable-documentation. See also cabal install --help. If cabal configure and cabal build etc: nothing to do, just omit cabal haddock. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to disable document in .cabal file?
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/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? If cabal install: add --disable-documentation. See also cabal install --help. If cabal configure and cabal build etc: nothing to do, just omit cabal haddock. __**_ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/**mailman/listinfo/haskell-cafehttp://www.haskell.org/mailman/listinfo/haskell-cafe -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to disable document in .cabal file?
The problem is, I enabled it in ~/.cabal/config file. So by default, when I install, it build the document. Sorry I used build term, by which I meant install On Wed, Jan 16, 2013 at 10:16 AM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 16 January 2013 13:10, Magicloud Magiclouds magicloud.magiclo...@gmail.com 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 Well, it's an option for the cabal-install tool, not for the Cabal build system. Note that you don't need to use this parameter every time you build your project, only every time you configure it (so if you don't change the .cabal file much and just tend to build it as you hack on it you don't need the extra params). 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/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? If cabal install: add --disable-documentation. See also cabal install --help. If cabal configure and cabal build etc: nothing to do, just omit cabal haddock. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com http://IvanMiljenovic.wordpress.com -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to fold on types?
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 'a' 'b' 'c' ... 'x' 'y' 'z'. In form, this is something like folding. But since the type changes, so code like following won't work: foldl (\def value - def value) LongDef values Is it possible to do this in some way? -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com http://gmail.com/. __**_ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/**mailman/listinfo/haskell-cafehttp://www.haskell.org/mailman/listinfo/haskell-cafe This hack works, in case that helps: {-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-} data LongDec = LongDef Char Char Char Char Char Char deriving Show values = [ 'a', 'b', 'c', 'x', 'y', 'z' ] class Apply a b c where apply :: b - [a] - c instance Apply a b b where apply = const instance (Apply a b c) = Apply a (a - b) c where apply f (x:xs) = apply (f x) xs main = print (apply LongDef values :: LongDec) It requires an explicit type annotation to fix type parameter 'c'. It cannot be a function type. (I am not sure why though.) __**_ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/**mailman/listinfo/haskell-cafehttp://www.haskell.org/mailman/listinfo/haskell-cafe -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] A weird bug of regex-pcre
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 magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is there a tool like ri from ruby?
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: Have you tried Hoogle? I know you can install it locally and use it from GHCi or Emacs. I'm not familiar with ri, but from your description I think a local Hoogle would serve the same purpose with the added benefit of being able to search by types. Here's the wiki page about it: http://www.haskell.org/haskellwiki/Hoogle See also: http://newartisans.com/2012/09/running-a-fully-local-hoogle/ With this setup I can use :doc head in my ghci sessions, and see docs very similar to what ri would show. -- John Wiegley FP Complete Haskell tools, training and consulting http://fpcomplete.com johnw on #haskell/irc.freenode.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Is there a tool like ri from ruby?
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 I am wondering if there is such thing in Haskell world. I know haddock saves the .haddock files in document folder. But I do not know if there is any existing tools to index and view them. -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hackage dependencies problem.
Not only shadowing. For example, when I installed warp-static, yesod, or gtk2hs. A clear-user-space may ease the problem and got them installed. But normally with a not brand new user space, it failed like above. And, the key point is that using upgrade-dependencies with cabal-install. I am using git (current) version of cabal-install. Without that argument, things could be fine. With it, it must fail. And ghc-pkg check reports no errors. On Tue, Nov 20, 2012 at 3:47 AM, Albert Y. C. Lai tre...@vex.net wrote: On 12-11-19 04:45 AM, Ivan Lazar Miljenovic wrote: On 19 November 2012 18:21, 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-**8edf300597b0da609c8eccc9aa6d0c**c3 process-1.1.0.2-**03ae5757aa509ffbe497f42660cba5**2c unix-2.6.0.0-**4bc27fc415f60036a88211de7cde3e**9a (use -v for more information) What should I do? Why user space directory and process would interrupt Cabal in global space? It shouldn't. Can you please give an example of a package that gives you an error like this? Also, what does ghc-pkg check say? The only thing I can think of is that you're trying to upgrade a package like array, containers, etc. It does. It has always been. When unioning user and global, user takes precedence: user directory-1.2.0.0 shadows global directory-1.2.0.0 (GHC User's Guide 4.9.4). But look closer: user directory-1.2.0.0-feedbabe... shadows global directory-1.2.0.0-deadbeef... Therefore, if global Cabal-1.16.0 was built against directory-1.2.0.0-deadbeef..., it's a missing dependency for you. See my http://www.vex.net/~trebla/**haskell/sicp.xhtml#pigeonhttp://www.vex.net/~trebla/haskell/sicp.xhtml#pigeon Fortunately, shadowing is a sessional property, not a data-loss property. One can say, it's a data-surplus property. To regain working sessions, cut surplus data, add -no-user-package-db to all your ghc and ghci commands. ghc-pkg check does not report shadowing. Go straight for ghc -v. This is what you get for --reinstall. __**_ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/**mailman/listinfo/haskell-cafehttp://www.haskell.org/mailman/listinfo/haskell-cafe -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: Executables got bigger using dynamic link.
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. First of all, I think comparing to static link, dynamic linked executables file should be smaller. And the libraries (.so) could benefits from caching to save memory usage. Well, I installed cabal-install and alex. I got this: cabal 9.9M - 24M alex 2.7M - 5.1M Is this correct? -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: [Haskell-cafe] Executables got bigger using dynamic link.
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. First of all, I think comparing to static link, dynamic linked executables file should be smaller. And the libraries (.so) could benefits from caching to save memory usage. Well, I installed cabal-install and alex. I got this: cabal 9.9M - 24M alex 2.7M - 5.1M Is this correct? -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: Does ghc 7.6.1 support gold ld?
Never mind. `make clean` helps. Though I have no idea why On Wed, Oct 10, 2012 at 1:40 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Hi, Since gold ld (GNU gold (GNU Binutils for Debian 2.22) 1.11) somehow better than ld, so I am using it in my debian box. Now I want to compile ghc 7.6.1 with it. And I have modified the configure script to skip checking --hash-size, --reduce-memory-overheads and if is gnu ld (all fixed to NO). And using normal build ghc 7.6.1. I got following errors. What should I do? 2012/10/10 Wed 13:32:01 magicloud@ctu1-tes-02 ~/src/ghc-7.6.1 4617 $ make ===--- building phase 0 make -r --no-print-directory -f ghc.mk phase=0 phase_0_builds make[1]: Nothing to be done for `phase_0_builds'. ===--- building phase 1 make -r --no-print-directory -f ghc.mk phase=1 phase_1_builds make[1]: Nothing to be done for `phase_1_builds'. ===--- building final phase make -r --no-print-directory -f ghc.mk phase=final all HC [stage 1] libraries/base/dist-install/build/GHC/Exception.o ghc-stage1: fd:5: hGetContents: invalid argument (invalid byte sequence) HC [stage 1] libraries/base/dist-install/build/GHC/Err.o ghc-stage1: fd:5: hGetContents: invalid argument (invalid byte sequence) HC [stage 1] libraries/base/dist-install/build/GHC/Char.o ghc-stage1: fd:5: hGetContents: invalid argument (invalid byte sequence) HC [stage 1] libraries/base/dist-install/build/GHC/Enum.o ghc-stage1: fd:5: hGetContents: invalid argument (invalid byte sequence) HC [stage 1] libraries/base/dist-install/build/GHC/Real.o ghc-stage1: fd:5: hGetContents: invalid argument (invalid byte sequence) HC [stage 1] libraries/base/dist-install/build/Text/ParserCombinators/ReadP.o ghc-stage1: fd:5: hGetContents: invalid argument (invalid byte sequence) HC [stage 1] libraries/base/dist-install/build/Text/Read/Lex.o ghc-stage1: fd:5: hGetContents: invalid argument (invalid byte sequence) HC [stage 1] libraries/base/dist-install/build/GHC/ST.o ghc-stage1: fd:5: hGetContents: invalid argument (invalid byte sequence) HC [stage 1] libraries/base/dist-install/build/GHC/Arr.o ghc-stage1: fd:5: hGetContents: invalid argument (invalid byte sequence) HC [stage 1] libraries/base/dist-install/build/Data/Bits.o ghc-stage1: fd:5: hGetContents: invalid argument (invalid byte sequence) HC [stage 1] libraries/base/dist-install/build/GHC/Float.o ghc-stage1: fd:5: hGetContents: invalid argument (invalid byte sequence) HC [stage 1] libraries/base/dist-install/build/Text/ParserCombinators/ReadPrec.o ghc-stage1: fd:5: hGetContents: invalid argument (invalid byte sequence) HC [stage 1] libraries/base/dist-install/build/GHC/Read.o ghc-stage1: fd:5: hGetContents: invalid argument (invalid byte sequence) HC [stage 1] libraries/base/dist-install/build/Numeric.o ghc-stage1: fd:5: hGetContents: invalid argument (invalid byte sequence) HC [stage 1] libraries/base/dist-install/build/GHC/Ptr.o ghc-stage1: fd:5: hGetContents: invalid argument (invalid byte sequence) HC [stage 1] libraries/base/dist-install/build/GHC/STRef.o ghc-stage1: fd:5: hGetContents: invalid argument (invalid byte sequence) make[1]: *** [libraries/base/dist-install/build/GHC/STRef.o] Error 2 make[1]: *** Deleting file `libraries/base/dist-install/build/GHC/STRef.o' make: *** [all] Error 2 -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Re: Does ghc 7.6.1 support gold ld?
Well, it does not seem so. Although around 7.0, there were patches to make gold ld work. But until now, the configure script is still missing something. For example, it checks that gold ld is GNU ld. Thus it uses ldscript to input .o files. But in fact, at least the version I am using, gold ld does not take relative paths from ldscript. After a few modifications to the root configure script (not others for libraries). I got it make-able. Now I am stuck at install step. The error is no HsBase.o file On Wed, Oct 10, 2012 at 7:04 PM, Achim Krause i...@achim-krause.de wrote: Well, the build system is intelligent enough to know what to rebuild after files got changed, and what to keep, but it does not know what files depend on what configurational changes. This gives you errors, because make still tries to use the previously built object files. Usually, many changes only go well with a clean build. Von Samsung Mobile gesendet Magicloud Magiclouds magicloud.magiclo...@gmail.com hat geschrieben: Never mind. `make clean` helps. Though I have no idea why On Wed, Oct 10, 2012 at 1:40 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Hi, Since gold ld (GNU gold (GNU Binutils for Debian 2.22) 1.11) somehow better than ld, so I am using it in my debian box. Now I want to compile ghc 7.6.1 with it. And I have modified the configure script to skip checking --hash-size, --reduce-memory-overheads and if is gnu ld (all fixed to NO). And using normal build ghc 7.6.1. I got following errors. What should I do? 2012/10/10 Wed 13:32:01 magicloud@ctu1-tes-02 ~/src/ghc-7.6.1 4617 $ make ===--- building phase 0 make -r --no-print-directory -f ghc.mk phase=0 phase_0_builds make[1]: Nothing to be done for `phase_0_builds'. ===--- building phase 1 make -r --no-print-directory -f ghc.mk phase=1 phase_1_builds make[1]: Nothing to be done for `phase_1_builds'. ===--- building final phase make -r --no-print-directory -f ghc.mk phase=final all HC [stage 1] libraries/base/dist-install/build/GHC/Exception.o ghc-stage1: fd:5: hGetContents: invalid argument (invalid byte sequence) HC [stage 1] libraries/base/dist-install/build/GHC/Err.o ghc-stage1: fd:5: hGetContents: invalid argument (invalid byte sequence) HC [stage 1] libraries/base/dist-install/build/GHC/Char.o ghc-stage1: fd:5: hGetContents: invalid argument (invalid byte sequence) HC [stage 1] libraries/base/dist-install/build/GHC/Enum.o ghc-stage1: fd:5: hGetContents: invalid argument (invalid byte sequence) HC [stage 1] libraries/base/dist-install/build/GHC/Real.o ghc-stage1: fd:5: hGetContents: invalid argument (invalid byte sequence) HC [stage 1] libraries/base/dist-install/build/Text/ParserCombinators/ReadP.o ghc-stage1: fd:5: hGetContents: invalid argument (invalid byte sequence) HC [stage 1] libraries/base/dist-install/build/Text/Read/Lex.o ghc-stage1: fd:5: hGetContents: invalid argument (invalid byte sequence) HC [stage 1] libraries/base/dist-install/build/GHC/ST.o ghc-stage1: fd:5: hGetContents: invalid argument (invalid byte sequence) HC [stage 1] libraries/base/dist-install/build/GHC/Arr.o ghc-stage1: fd:5: hGetContents: invalid argument (invalid byte sequence) HC [stage 1] libraries/base/dist-install/build/Data/Bits.o ghc-stage1: fd:5: hGetContents: invalid argument (invalid byte sequence) HC [stage 1] libraries/base/dist-install/build/GHC/Float.o ghc-stage1: fd:5: hGetContents: invalid argument (invalid byte sequence) HC [stage 1] libraries/base/dist-install/build/Text/ParserCombinators/ReadPrec.o ghc-stage1: fd:5: hGetContents: invalid argument (invalid byte sequence) HC [stage 1] libraries/base/dist-install/build/GHC/Read.o ghc-stage1: fd:5: hGetContents: invalid argument (invalid byte sequence) HC [stage 1] libraries/base/dist-install/build/Numeric.o ghc-stage1: fd:5: hGetContents: invalid argument (invalid byte sequence) HC [stage 1] libraries/base/dist-install/build/GHC/Ptr.o ghc-stage1: fd:5: hGetContents: invalid argument (invalid byte sequence) HC [stage 1] libraries/base/dist-install/build/GHC/STRef.o ghc-stage1: fd:5: hGetContents: invalid argument (invalid byte sequence) make[1]: *** [libraries/base/dist-install/build/GHC/STRef.o] Error 2 make[1]: *** Deleting file `libraries/base/dist-install/build/GHC/STRef.o' make: *** [all] Error 2 -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: [Haskell-cafe] object file cannot be loaded.
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: 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 name right now). When it compiling the template haskell part I got the following error message. I tried to clear all user space hackages. Not helping. Loading package text-0.11.2.3 ... linking ... ghc: /home/magicloud/.cabal/lib/text-0.11.2.3/ghc-7.6.1/HStext-0.11.2.3.o: unknown symbol `bytestringzm0zi10zi0zi1_DataziByteStringziInternal_PS_con_info' ghc: unable to load package `text-0.11.2.3' -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Push the envelope. Watch it bend. -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] object file cannot be loaded.
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, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Hi, I am installing postgres hackage (cannot remember the exact name right now). When it compiling the template haskell part I got the following error message. I tried to clear all user space hackages. Not helping. Loading package text-0.11.2.3 ... linking ... ghc: /home/magicloud/.cabal/lib/text-0.11.2.3/ghc-7.6.1/HStext-0.11.2.3.o: unknown symbol `bytestringzm0zi10zi0zi1_DataziByteStringziInternal_PS_con_info' ghc: unable to load package `text-0.11.2.3' -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Push the envelope. Watch it bend. -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] object file cannot be loaded.
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 name right now). When it compiling the template haskell part I got the following error message. I tried to clear all user space hackages. Not helping. Loading package text-0.11.2.3 ... linking ... ghc: /home/magicloud/.cabal/lib/text-0.11.2.3/ghc-7.6.1/HStext-0.11.2.3.o: unknown symbol `bytestringzm0zi10zi0zi1_DataziByteStringziInternal_PS_con_info' ghc: unable to load package `text-0.11.2.3' -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Push the envelope. Watch it bend. -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What is the good way to work with list comprehension and UTCTime?
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: http://hackage.haskell.org/package/time-recurrence For your simple cases you would do something like: Each second: starting (UTCTime ...) $ recur secondly Each minute: starting (UTCTime ...) $ recur minutely Ouch. Look up minutely (my-NEWT-ly) in an English dictionary. Look up secondly while you're there. You can blame RFC 5545 for that one. In section 3.3.10. our frequencies are: freq= SECONDLY / MINUTELY / HOURLY / DAILY / WEEKLY / MONTHLY / YEARLY Antoine ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What is the good way to work with list comprehension and UTCTime?
This is nice. Thanks to all. On Fri, Sep 14, 2012 at 4:03 PM, Roman Cheplyaka r...@ro-che.info wrote: Consider using the time-lens package. import Data.Time.Lens import Data.Lens.Common List comprehension style: [modL seconds (+ fromIntegral n) t | n - [0..]] [modL minutes (+ n) 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, 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 idea? -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] What is the good way to work with list comprehension and UTCTime?
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 idea? -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] How to waitForProcess?
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 - do (_, Just o, _, h) - createProcess $ CreateProcess (RawCommand /usr/bin/flow-export [-f2]) Nothing Nothing (UseHandle i) CreatePipe Inherit True False hGetContents o return $ tail $ lines csv_ -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to waitForProcess?
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 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. You're probably being bitten by hGetContents being lazy. Force the result of hGetContents (e.g. `evaluate . length = hGetContents o ') and then use waitForProcess. exportCSV :: FilePath - IO [String] exportCSV file = do csv_ - withBinaryFile file ReadMode $ \i - do (_, Just o, _, h) - createProcess $ CreateProcess (RawCommand /usr/bin/flow-export [-f2]) Nothing Nothing (UseHandle i) CreatePipe Inherit True False hGetContents o return $ tail $ lines csv_ -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com http://IvanMiljenovic.wordpress.com -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] How to simplify the code of Maybe within a monad?
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 magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] How to add constraint to .cabal?
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 use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What is the difference between runhaskell and compile?
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 :: String - LDAPInt - (LDAP - IO a) - IO a ldapWith host port f = withCString host $ \cs - do cld - cldap_init cs port ptr - checkNULL ldapWith (return cld) rv - newForeignPtr_ ptr ldapSetVersion3 cld a - f rv _ - cldap_unbind cld return a And it gave me another packet data. Sec 11 is runhaskell, Sec 15 is binary (failed). The failed one has a FIN, ACK, weird. LDAP-0.6.6 is a binding to c library without any other haskell library except base, I think how ghc works should not effect its internal network operation On Thu, Jul 12, 2012 at 10:14 AM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: 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 at 9:35 AM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: OK. Finally this problem totally prevents my project from working. By some guy's suggestion, I did a packet capturing, which really showed a difference. The rwdc file is for a ldap that at our IDC, which did not work with compiled binary. The rodc file is for a ldap that at local, which worked all the time. Each file contains two parts of records, at 3.* sec and 6/7.* sec. The 3.* part is for runhaskell way. The 6/7.* part is for compiled binary way. The big difference here is: the failed one sent unbindRequest before got bindResponse success. Just a clue, I have no idea what is going 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-cafe] What is the difference between runhaskell and compile? I see. Although I am using a UTF-8 environment, but all string I was using were ASCIIs. If it is not too much trouble, may I have your LDAP compiled library files? I think since the Main.o is identical, maybe the libraries are different. On Thu, May 31, 2012 at 2:09 PM, Chris Dornan ch...@chrisdornan.com wrote: I wouldn't pay too much attention to the fact that the hash tags are different -- they are very unlikely to be the same across two installations. (For example, my GHC installations are relocated under /usr/hs, immediately changing the contents of all of the .conf files and therefore the hashes.) The object files are more interesting, and they are identical! At the moment I can only explain what we are seeing by assuming that some change has affected the GHC 7.4.1 runtime system -- but only for compiled programs. Are you using non-ASCII characters in your LDAP passwords? I am thinking that maybe the compiled 7.4.1 could be using a different LOCALE from everything else, leading in some way to the passwords being encoded differently en route to the LDAP server. I don't know whether this could actually happen, but it is the kind of mechanism that seem most likely to be causing the problem. Did you try to running the variants that read address, account and passwords from standard input? Did it show the same perverse behaviour? Chris -Original Message- From: Magicloud Magiclouds [mailto:magicloud.magiclo...@gmail.com] Sent: 31 May 2012 02:47 To: Chris Dornan Subject: Re: [Haskell-cafe] What is the difference between runhaskell and compile? Hi, I have compared the files. The .o-es are exactly the same. The .hi-s are different. The interface hash, flag hash, and import -/ LDAP-0.6.6:LDAP.Constants x(hash) are different. I do not know why only this module (LDAP.Constants) has a different hash. I am not quite familiar with ghc compiling process. May I know your conclusion? On Wed, May 30, 2012 at 3:50 PM, Chris Dornan ch...@chrisdornan.com wrote: Did you carry out a standard (optimised) build to get ghc-7.4.1? Are you going to try the justhub rpms or compare the object/header files I sent. Chris -Original Message- From: Magicloud Magiclouds [mailto:magicloud.magiclo...@gmail.com] Sent: 30 May 2012 04:07 To: Chris Dornan Cc: Haskell-Cafe Subject: Re: [Haskell-cafe] What is the difference between runhaskell and compile? 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
Re: [Haskell-cafe] What is the difference between runhaskell and compile?
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 of limited interest down a widely subscribed list? Contrary to popular belief, bandwidth, time and spool storage isn't free. It might be a very good idea to take those off-list. -- Lars Viklund | z...@acc.umu.se ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Bad interface problem.
I am using ghc 7.4.2 which includes template-haskell-2.7.0.0. When I installed QuickCheck-2.5, it requires template-haskell-2.6.0.0. Even I removed all user space packages, the error was still. I think it is a ghc pkg problem, that every package register itself as package:function while ghc (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 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: template-haskell-2.6.0.0:Language.Haskell.TH differs from name found in the interface file template-haskell:Language.Haskell.TH You installed a bad template-haskell version. You can only use a version corresponding to your ghc version. I had a similar problem recently. My solution process was as follows: 1. check which template-haskell version came with my ghc: $ ghc -V The Glorious Glasgow Haskell Compilation System, version 7.4.2 $ ghc-pkg list template-haskell /home/claude/opt/lib/ghc-7.4.2/package.conf.d template-haskell-2.7.0.0 /home/claude/.ghc/x86_64-linux-7.4.2/package.conf.d $ 2. make sure to forbid every other version of template-haskell (because it will break horribly, as you found): $ cabal install --constraint='template-haskell==2.7.0.0' foo 3. if foo fails to install because it thinks it needs a different version of template-haskell, try adjusting dependencies in foo.cabal 4. if foo installs and works with the adjusted dependencies, let the maintainer know I think things are so messed up that it is time to clean out everything. See my http://www.vex.net/~trebla/haskell/sicp.xhtml#remove In fact, time to read the whole article and avoid unsafe re-installs and upgrades. It's a good read for sure! Perhaps it could be updated to add a problem I ran into recently: cabal install --solver=modular --avoid-reinstalls sounds perfect, if sicp.xhtml scared you properly. But excessively avoiding reinstalls is bad, as cabal-install seems to install a different allowable version instead. The result for me was horrible diamond dependency problems - half my packages were built with one version of mtl/transformers, and the other half with a different version of mtl/transformers. When I then tried to ghci using some modules from both halves of my installed packages, I got very very confusing type errors complaining about almost-identical-looking types not being identical. Claude -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.12 (GNU/Linux) iQEcBAEBAgAGBQJP/RBbAAoJEHZDo4jueIiW164IALlHcaauJX2AjBZTDExU0mKC wlH+dIbaKkl8H1IMIXQnWSX0GxFGMsbPTdBXf/BC2CMXTcSJr8YMiyKewMAs734g DijNU/x/nQlcVruOk1c8EAijIKs938vT3dF0j863+afMAA+cRWlyLWfV50Y7AIG6 4hF0Fr5Q73GwonFzTXuX+iWLxBL1i2jXgPjKJvNTJZr+iGn5txCj+6ZpJyfIXaaw PZtQrnX/37vQ/ctbKsnDqRQI27/ENJyW3zm76Gax47EIpMvL8fHzEg8IpyR9/eR8 8ZfGKYNA1EsARHT3KS6pBPsVQdhn/qYInVZ5NYQ1r/kd9D6nqoy5pETdz3z/23Y= =Rzob -END PGP SIGNATURE- ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Bad interface problem.
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: Even I removed all user space packages, the error was still. I think it is a ghc pkg problem, that every package register itself as package:function while ghc (or cabal?) required package-version:function. That's not the problem, it's the symptom. Package symbols are always versioned; ghc only shows the version when it's the only way to disambiguate symbols. So when it shows you a conflict where one is versioned and the other isn't, you have multiple versions of a package installed. But --constraint='template-haskell-2.7.0.0' did make it compiled. And that's how you prevent it. -- brandon s allbery allber...@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What is the difference between runhaskell and compile?
OK. Finally this problem totally prevents my project from working. By some guy's suggestion, I did a packet capturing, which really showed a difference. The rwdc file is for a ldap that at our IDC, which did not work with compiled binary. The rodc file is for a ldap that at local, which worked all the time. Each file contains two parts of records, at 3.* sec and 6/7.* sec. The 3.* part is for runhaskell way. The 6/7.* part is for compiled binary way. The big difference here is: the failed one sent unbindRequest before got bindResponse success. Just a clue, I have no idea what is going 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-cafe] What is the difference between runhaskell and compile? I see. Although I am using a UTF-8 environment, but all string I was using were ASCIIs. If it is not too much trouble, may I have your LDAP compiled library files? I think since the Main.o is identical, maybe the libraries are different. On Thu, May 31, 2012 at 2:09 PM, Chris Dornan ch...@chrisdornan.com wrote: I wouldn't pay too much attention to the fact that the hash tags are different -- they are very unlikely to be the same across two installations. (For example, my GHC installations are relocated under /usr/hs, immediately changing the contents of all of the .conf files and therefore the hashes.) The object files are more interesting, and they are identical! At the moment I can only explain what we are seeing by assuming that some change has affected the GHC 7.4.1 runtime system -- but only for compiled programs. Are you using non-ASCII characters in your LDAP passwords? I am thinking that maybe the compiled 7.4.1 could be using a different LOCALE from everything else, leading in some way to the passwords being encoded differently en route to the LDAP server. I don't know whether this could actually happen, but it is the kind of mechanism that seem most likely to be causing the problem. Did you try to running the variants that read address, account and passwords from standard input? Did it show the same perverse behaviour? Chris -Original Message- From: Magicloud Magiclouds [mailto:magicloud.magiclo...@gmail.com] Sent: 31 May 2012 02:47 To: Chris Dornan Subject: Re: [Haskell-cafe] What is the difference between runhaskell and compile? Hi, I have compared the files. The .o-es are exactly the same. The .hi-s are different. The interface hash, flag hash, and import -/ LDAP-0.6.6:LDAP.Constants x(hash) are different. I do not know why only this module (LDAP.Constants) has a different hash. I am not quite familiar with ghc compiling process. May I know your conclusion? On Wed, May 30, 2012 at 3:50 PM, Chris Dornan ch...@chrisdornan.com wrote: Did you carry out a standard (optimised) build to get ghc-7.4.1? Are you going to try the justhub rpms or compare the object/header files I sent. Chris -Original Message- From: Magicloud Magiclouds [mailto:magicloud.magiclo...@gmail.com] Sent: 30 May 2012 04:07 To: Chris Dornan Cc: Haskell-Cafe Subject: Re: [Haskell-cafe] What is the difference between runhaskell and compile? 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...@gmail.com wrote: 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 7.2.2. The code worked. At last, I installed 7.4.1 in CentOS. The code did not work. Could you send the .hi/.o to me, so maybe I could find out the different? Also the exact original source. Thank you. Interesting indeed! I am guessing that you are using the GHC-7.4.1 bindist from haskell.org. I will try and find some time to marshal the source code and intermediate files (am on the road -- will need to collect it from base, make it generic etc.). You might also like to try the http://justhub.org ghc-7.4.1-hub on your CentOS-6.1 node. It is a separate build from the haskell.org bindist and comes with it's own in-board gcc (4.6.1) and binutils (2.21) used for the build. It should work for you. (You could also try ghc-7.4.2-RC1-hub.) Chris -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. -- 竹密岂妨流水过 山高哪阻野云飞
Re: [Haskell-cafe] What is the difference between runhaskell and compile?
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 at 9:35 AM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: OK. Finally this problem totally prevents my project from working. By some guy's suggestion, I did a packet capturing, which really showed a difference. The rwdc file is for a ldap that at our IDC, which did not work with compiled binary. The rodc file is for a ldap that at local, which worked all the time. Each file contains two parts of records, at 3.* sec and 6/7.* sec. The 3.* part is for runhaskell way. The 6/7.* part is for compiled binary way. The big difference here is: the failed one sent unbindRequest before got bindResponse success. Just a clue, I have no idea what is going 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-cafe] What is the difference between runhaskell and compile? I see. Although I am using a UTF-8 environment, but all string I was using were ASCIIs. If it is not too much trouble, may I have your LDAP compiled library files? I think since the Main.o is identical, maybe the libraries are different. On Thu, May 31, 2012 at 2:09 PM, Chris Dornan ch...@chrisdornan.com wrote: I wouldn't pay too much attention to the fact that the hash tags are different -- they are very unlikely to be the same across two installations. (For example, my GHC installations are relocated under /usr/hs, immediately changing the contents of all of the .conf files and therefore the hashes.) The object files are more interesting, and they are identical! At the moment I can only explain what we are seeing by assuming that some change has affected the GHC 7.4.1 runtime system -- but only for compiled programs. Are you using non-ASCII characters in your LDAP passwords? I am thinking that maybe the compiled 7.4.1 could be using a different LOCALE from everything else, leading in some way to the passwords being encoded differently en route to the LDAP server. I don't know whether this could actually happen, but it is the kind of mechanism that seem most likely to be causing the problem. Did you try to running the variants that read address, account and passwords from standard input? Did it show the same perverse behaviour? Chris -Original Message- From: Magicloud Magiclouds [mailto:magicloud.magiclo...@gmail.com] Sent: 31 May 2012 02:47 To: Chris Dornan Subject: Re: [Haskell-cafe] What is the difference between runhaskell and compile? Hi, I have compared the files. The .o-es are exactly the same. The .hi-s are different. The interface hash, flag hash, and import -/ LDAP-0.6.6:LDAP.Constants x(hash) are different. I do not know why only this module (LDAP.Constants) has a different hash. I am not quite familiar with ghc compiling process. May I know your conclusion? On Wed, May 30, 2012 at 3:50 PM, Chris Dornan ch...@chrisdornan.com wrote: Did you carry out a standard (optimised) build to get ghc-7.4.1? Are you going to try the justhub rpms or compare the object/header files I sent. Chris -Original Message- From: Magicloud Magiclouds [mailto:magicloud.magiclo...@gmail.com] Sent: 30 May 2012 04:07 To: Chris Dornan Cc: Haskell-Cafe Subject: Re: [Haskell-cafe] What is the difference between runhaskell and compile? 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...@gmail.com wrote: 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 7.2.2. The code worked. At last, I installed 7.4.1 in CentOS. The code did not work. Could you send the .hi/.o to me, so maybe I could find out the different? Also the exact original source. Thank you. Interesting indeed! I am guessing that you are using the GHC-7.4.1 bindist from haskell.org. I will try and find some time to marshal the source code and intermediate files (am on the road -- will need to collect it from base, make it generic etc.). You might also like to try the http://justhub.org ghc-7.4.1-hub on your CentOS-6.1 node
Re: [Haskell-cafe] Bad interface problem.
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: Bad interface file: /home/magicloud/.cabal/lib/template-haskell-2.6.0.0/ghc-7.4.2/Language/Haskell/TH.hi Something is amiss; requested module template-haskell-2.6.0.0:Language.Haskell.TH differs from name found in the interface file template-haskell:Language.Haskell.TH I think things are so messed up that it is time to clean out everything. See my http://www.vex.net/~trebla/haskell/sicp.xhtml#remove In fact, time to read the whole article and avoid unsafe re-installs and upgrades. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Bad interface problem.
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: /home/magicloud/.cabal/lib/template-haskell-2.6.0.0/ghc-7.4.2/Language/Haskell/TH.hi Something is amiss; requested module template-haskell-2.6.0.0:Language.Haskell.TH differs from name found in the interface file template-haskell:Language.Haskell.TH $ cabal --version cabal-install version 0.15.0 using version 1.15.0 of the Cabal library -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] About using type to do type alias.
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, 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 section 2. Then 'start (M.fromList $ zip ord_args) worker' could not be compiled due to the second argument is type of 'M.Map Arg Arg', not 'JobArgs Arg Arg'. This shouldn't make a difference. As an example, this works: import qualified Data.Map as M type Foo a b = M.Map a b fooInsert :: (Ord a) = a - b - Foo a b - Foo a b fooInsert = M.insert Aliases are just for documentation; they shouldn't affect code working. What did I miss to make this work? -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com http://IvanMiljenovic.wordpress.com -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] About using type to do type alias.
Sorry, I forgot that. Magicloud.Map.mapM sure is a helper I use as lifted Data.Map.map. If I changed the type of the result of start, the Jobs module compiled. But still cannot compile with the other module (which uses start). And the error is on JobArgs. I post the function here, I am not sure how could I fix it. mapM :: (Monad m, Ord k) = (a - m b) - M.Map k a - m (M.Map k b) mapM f m = let (ks, as) = unzip $ M.toList m in Prelude.mapM f as = return . M.fromList . zip ks On Mon, Jun 25, 2012 at 5:11 PM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 25 June 2012 19:04, Arlen Cuss a...@len.me wrote: Magicloud, Try to reduce the particular problem you're having to the smallest possible example that reproduces 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. Though line 22 reveals something: I don't know what Magicloud.Map.mapM is, though I'm guessing it's a lifted version of Data.Map.map. However, I would guess that it's a type problem. Try changing the type of start to be ` start :: (Ord k, Exception e) = JobArgs k a - (a - IO b) - IO (M.Map k (JobInfo a e)) '; I would hazard a guess that you would get the same error, and thus the problem isn't with `type', it's that your mapping function isn't quite correct. Cheers, Arlen On Monday, 25 June 2012 at 5:46 PM, 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, Magicloud Magiclouds magicloud.magiclo...@gmail.com (mailto:magicloud.magiclo...@gmail.com) wrote: 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 section 2. Then 'start (M.fromList $ zip ord_args) worker' could not be compiled due to the second argument is type of 'M.Map Arg Arg', not 'JobArgs Arg Arg'. This shouldn't make a difference. As an example, this works: import qualified Data.Map as M type Foo a b = M.Map a b fooInsert :: (Ord a) = a - b - Foo a b - Foo a b fooInsert = M.insert Aliases are just for documentation; they shouldn't affect code working. What did I miss to make this work? -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com (http://gmail.com). ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org (mailto:Haskell-Cafe@haskell.org) http://www.haskell.org/mailman/listinfo/haskell-cafe -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com (mailto:ivan.miljeno...@gmail.com) http://IvanMiljenovic.wordpress.com -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com (http://gmail.com). ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org (mailto:Haskell-Cafe@haskell.org) http://www.haskell.org/mailman/listinfo/haskell-cafe -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com http://IvanMiljenovic.wordpress.com -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] About using type to do type alias.
Interesting, seems like mapM did not effect the problem Let me try more with the first argument of mapM On Mon, Jun 25, 2012 at 5:04 PM, Arlen Cuss a...@len.me wrote: Magicloud, Try to reduce the particular problem you're having to the smallest possible example that reproduces 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 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, Magicloud Magiclouds magicloud.magiclo...@gmail.com (mailto:magicloud.magiclo...@gmail.com) wrote: 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 section 2. Then 'start (M.fromList $ zip ord_args) worker' could not be compiled due to the second argument is type of 'M.Map Arg Arg', not 'JobArgs Arg Arg'. This shouldn't make a difference. As an example, this works: import qualified Data.Map as M type Foo a b = M.Map a b fooInsert :: (Ord a) = a - b - Foo a b - Foo a b fooInsert = M.insert Aliases are just for documentation; they shouldn't affect code working. What did I miss to make this work? -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com (http://gmail.com). ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org (mailto:Haskell-Cafe@haskell.org) http://www.haskell.org/mailman/listinfo/haskell-cafe -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com (mailto:ivan.miljeno...@gmail.com) http://IvanMiljenovic.wordpress.com -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com (http://gmail.com). ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org (mailto:Haskell-Cafe@haskell.org) http://www.haskell.org/mailman/listinfo/haskell-cafe -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] About using type to do type alias.
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 with the first argument of mapM On Mon, Jun 25, 2012 at 5:04 PM, Arlen Cuss a...@len.me wrote: Magicloud, Try to reduce the particular problem you're having to the smallest possible example that reproduces 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 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, Magicloud Magiclouds magicloud.magiclo...@gmail.com (mailto:magicloud.magiclo...@gmail.com) wrote: 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 section 2. Then 'start (M.fromList $ zip ord_args) worker' could not be compiled due to the second argument is type of 'M.Map Arg Arg', not 'JobArgs Arg Arg'. This shouldn't make a difference. As an example, this works: import qualified Data.Map as M type Foo a b = M.Map a b fooInsert :: (Ord a) = a - b - Foo a b - Foo a b fooInsert = M.insert Aliases are just for documentation; they shouldn't affect code working. What did I miss to make this work? -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com (http://gmail.com). ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org (mailto:Haskell-Cafe@haskell.org) http://www.haskell.org/mailman/listinfo/haskell-cafe -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com (mailto:ivan.miljeno...@gmail.com) http://IvanMiljenovic.wordpress.com -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com (http://gmail.com). ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org (mailto:Haskell-Cafe@haskell.org) http://www.haskell.org/mailman/listinfo/haskell-cafe -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] About using type to do type alias.
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 section 2. Then 'start (M.fromList $ zip ord_args) worker' could not be compiled due to the second argument is type of 'M.Map Arg Arg', not 'JobArgs Arg Arg'. What did I miss to make this work? -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Again, version conflicting problem with cabal-install
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), 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 the dependencies originally defined but not the binary compiled (which dependencies are fixed)? On Tue, Jun 19, 2012 at 5:50 PM, Andres Löh andres.l...@googlemail.com wrote: Hi. Hackage A depends on magicloud (any) and container (0.4.0.0), and hackage magicloud depends on container (any). Now I've installed magicloud, using container 0.5.0.0. Then I failed to install A, with any solver. So the solvers are using the status that is installed, not the definitions from original hackages? Could you please provide me with something I can reproduce? I'm not sure what you mean by A or magicloud. Are you saying they have no further dependencies except for the one on container? If you could just state which concrete packages have caused the problem, it'd probably be easier. The trace output of the modular solver with -v3 would also help (send it to me personally if it's too long). Thanks. Andres -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Again, version conflicting problem with cabal-install
And today I met another situation, which I think solvable by computer. Hackage A depends on magicloud (any) and container (0.4.0.0), and hackage magicloud depends on container (any). Now I've installed magicloud, using container 0.5.0.0. Then I failed to install A, with any solver. So 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 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, these hackages are not be able to build at all under certain conditions. So, I am voting on the force-allow flag. On Sat, Feb 4, 2012 at 12:36 AM, Andres Löh andres.l...@googlemail.com wrote: Hi. --force-allow=foo-1.3 with the semantics that all dependencies on foo will be changed to allow foo-1.3 to be chosen. Would that be ok? Other suggestions? Can't this be integrated with the current --constraint flag? It could be, but ... If the constraint is able to be satisfied without unrestricting any bounds, fine. Otherwise, unrestrict any bounds on that constraint. What would be the drawbacks? ... it shouldn't happen automatically. There are perfectly valid and safe reasons to use --constraint, whereas this new feature is inherently unsafe. But allowing general constraint syntax and calling the flag something with constraint in it is perhaps a good idea. An advantage is being able to specify --constraint='foo = 1.3' to get foo-1.3.7.2 instead of having to find out exactly which version you want. And if you already know what you want, you may always say --constraint='foo == 1.3.7.2'. Yes. Looking forward to the new solver! =) I need testers and feedback. You can already use it. It's in the cabal-install development version, and can be enabled by saying --solver=modular on the command line. Cheers, Andres -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Again, version conflicting problem with cabal-install
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 the dependencies originally defined but not the binary compiled (which dependencies are fixed)? On Tue, Jun 19, 2012 at 5:50 PM, Andres Löh andres.l...@googlemail.com wrote: Hi. Hackage A depends on magicloud (any) and container (0.4.0.0), and hackage magicloud depends on container (any). Now I've installed magicloud, using container 0.5.0.0. Then I failed to install A, with any solver. So the solvers are using the status that is installed, not the definitions from original hackages? Could you please provide me with something I can reproduce? I'm not sure what you mean by A or magicloud. Are you saying they have no further dependencies except for the one on container? If you could just state which concrete packages have caused the problem, it'd probably be easier. The trace output of the modular solver with -v3 would also help (send it to me personally if it's too long). Thanks. Andres -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What extension do I need to write type Job = Map k a?
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| JobInfo { jobId :: ThreadId 11| , result :: MVar (Either e a) } 12| 13|type Jobs k e a = (Ord k, Exception e) = 14| M.Map k (JobInfo e a) 15| 16|type JobArgs k a = (Ord k) = 17| M.Map k a 21| 22|start :: (Ord k, Exception e) = JobArgs k a - (a - IO b) - IO (Jobs k e a) 23|start args worker = do 24| arg - newEmptyMVar 25| Map.mapM (\a - do 26| putMVar arg a 27| result - newEmptyMVar 28| tId - forkIO $ do 29| arg_ - takeMVar arg 30| result_ - try $ worker arg_ 31| putMVar result result_ 32| return $ JobInfo tId result 33| ) args On Thu, Jun 14, 2012 at 1: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 understand a little. I use Job here just wants to simplify the code. And since I provide the function as library, I cannot decide what exact type k is. What should I do? Do you know what the type of `a'? If so: type Job k = Map k String Otherwise... do you even need a type alias? On Thu, Jun 14, 2012 at 11:23 AM, Arlen Cuss a...@len.me wrote: (resending to café, turns out I wasn't subbed from this address.) Hi Magicloud, This is correct; because you've hidden the type-variables away by universally quantifying them, there's no more level of specificity you can get back *out* of them than just some kind of Map (Job = M.Map k b, where k ≠ k0, b ≠ b0). If you have a Job type which can store *any* kind of Map (forall k a. Job (Map k a)), then that means you could have a Job with a Map Int Bool, and a Job with a Map String (Float - Float), and they'd both have the same type Job. You can't do anything with the values within, because you're being too permissive about what a Job is. You may want data Job k a = Job (Map k a), *or* if you do actually use one kind of Map only, then why not data Job = Job (Map Int String) (substituting your real types for Int and String). In this case, you could also consider using newtype (newtype Job = Job { getJob :: Map Int 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, all I want is to avoid having to type type variables all over the place. What should I do? My original code with RankNTypes and ImpredicativeTypes does not work The type Job = forall k a. M.Map k a works now. But function uses it does not. Compiler complains about Couldn't match expected type `Job' with actual type `M.Map k0 b0'. On Wed, Jun 13, 2012 at 9:15 PM, Daniel Peebles pumpkin...@gmail.com (mailto:pumpkin...@gmail.com) wrote: That doesn't require existential quantification, but it'll need Rank-2 typesif you ever do anything with Job. Unfortunately, a universally quantifiedJob like what you wrote (or what Magicloud seems to want) is only inhabitedby the empty Map. An existentially quantified Job, as you might get with data Job = forall k a. Job (Map k a) does let you wrap up any Map containing anything in it, but unfortunatelythe only thing you can do with that map afterwards is ask for structuralproperties about it, like whether it's empty or how many elements it has init. You could ask to enumerate the elements in it, but you wouldn't be ableto touch any of them because you wouldn't know what their types were. So I'm not really sure how to interpret the question. Was the goal to have aheterogeneous Map, maybe? Or just to avoid having to type type variables allover the place? Both of those are possible but require a bit moresophistication with types. -Dan On Wed, Jun 13, 2012 at 7:32 AM, Ismael Figueroa Paletifiguer...@gmail.com (mailto:ifiguer...@gmail.com) wrote: Do you want to hide the specific types of the job? Presumably to thendefine a type JobList = [Job] ?You can do that with the ExistentialQuantification extension. type Job = forall k a. Map k atype JobList = [Job] ??Note you can't unpack the types k a once you have hidden them. But thetypechecker 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 (mailto:magicloud.magiclo...@gmail.com) Hi,I've forgotten this.This is OK:type Job k a = Map k
Re: [Haskell-cafe] What extension do I need to write type Job = Map k a?
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| JobInfo { jobId :: ThreadId 11| , result :: MVar (Either e a) } 12| 13|type Jobs k e a = (Ord k, Exception e) = 14| M.Map k (JobInfo e a) 15| 16|type JobArgs k a = (Ord k) = 17| M.Map k a 21| 22|start :: (Ord k, Exception e) = JobArgs k a - (a - IO b) - IO (Jobs k e a) 23|start args worker = do 24| arg - newEmptyMVar 25| Map.mapM (\a - do 26| putMVar arg a 27| result - newEmptyMVar 28| tId - forkIO $ do 29| arg_ - takeMVar arg 30| result_ - try $ worker arg_ 31| putMVar result result_ 32| return $ JobInfo tId result 33| ) args On Thu, Jun 14, 2012 at 1: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 understand a little. I use Job here just wants to simplify the code. And since I provide the function as library, I cannot decide what exact type k is. What should I do? Do you know what the type of `a'? If so: type Job k = Map k String Otherwise... do you even need a type alias? On Thu, Jun 14, 2012 at 11:23 AM, Arlen Cuss a...@len.me wrote: (resending to café, turns out I wasn't subbed from this address.) Hi Magicloud, This is correct; because you've hidden the type-variables away by universally quantifying them, there's no more level of specificity you can get back *out* of them than just some kind of Map (Job = M.Map k b, where k ≠ k0, b ≠ b0). If you have a Job type which can store *any* kind of Map (forall k a. Job (Map k a)), then that means you could have a Job with a Map Int Bool, and a Job with a Map String (Float - Float), and they'd both have the same type Job. You can't do anything with the values within, because you're being too permissive about what a Job is. You may want data Job k a = Job (Map k a), *or* if you do actually use one kind of Map only, then why not data Job = Job (Map Int String) (substituting your real types for Int and String). In this case, you could also consider using newtype (newtype Job = Job { getJob :: Map Int 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, all I want is to avoid having to type type variables all over the place. What should I do? My original code with RankNTypes and ImpredicativeTypes does not work The type Job = forall k a. M.Map k a works now. But function uses it does not. Compiler complains about Couldn't match expected type `Job' with actual type `M.Map k0 b0'. On Wed, Jun 13, 2012 at 9:15 PM, Daniel Peebles pumpkin...@gmail.com (mailto:pumpkin...@gmail.com) wrote: That doesn't require existential quantification, but it'll need Rank-2 typesif you ever do anything with Job. Unfortunately, a universally quantifiedJob like what you wrote (or what Magicloud seems to want) is only inhabitedby the empty Map. An existentially quantified Job, as you might get with data Job = forall k a. Job (Map k a) does let you wrap up any Map containing anything in it, but unfortunatelythe only thing you can do with that map afterwards is ask for structuralproperties about it, like whether it's empty or how many elements it has init. You could ask to enumerate the elements in it, but you wouldn't be ableto touch any of them because you wouldn't know what their types were. So I'm not really sure how to interpret the question. Was the goal to have aheterogeneous Map, maybe? Or just to avoid having to type type variables allover the place? Both of those are possible but require a bit moresophistication with types. -Dan On Wed, Jun 13, 2012 at 7:32 AM, Ismael Figueroa Paletifiguer...@gmail.com (mailto:ifiguer...@gmail.com) wrote: Do you want to hide the specific types of the job? Presumably to thendefine a type JobList = [Job] ?You can do that with the ExistentialQuantification extension. type Job = forall k a. Map k atype JobList = [Job] ??Note you can't unpack the types k a once you have hidden them. But thetypechecker 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
Re: [Haskell-cafe] What extension do I need to write type Job = Map k a?
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 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| JobInfo { jobId :: ThreadId 11| , result :: MVar (Either e a) } 12| 13|type Jobs k e a = (Ord k, Exception e) = 14| M.Map k (JobInfo e a) 15| 16|type JobArgs k a = (Ord k) = 17| M.Map k a 21| 22|start :: (Ord k, Exception e) = JobArgs k a - (a - IO b) - IO (Jobs k e a) 23|start args worker = do 24| arg - newEmptyMVar 25| Map.mapM (\a - do 26| putMVar arg a 27| result - newEmptyMVar 28| tId - forkIO $ do 29| arg_ - takeMVar arg 30| result_ - try $ worker arg_ 31| putMVar result result_ 32| return $ JobInfo tId result 33| ) args On Thu, Jun 14, 2012 at 1: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 understand a little. I use Job here just wants to simplify the code. And since I provide the function as library, I cannot decide what exact type k is. What should I do? Do you know what the type of `a'? If so: type Job k = Map k String Otherwise... do you even need a type alias? On Thu, Jun 14, 2012 at 11:23 AM, Arlen Cuss a...@len.me wrote: (resending to café, turns out I wasn't subbed from this address.) Hi Magicloud, This is correct; because you've hidden the type-variables away by universally quantifying them, there's no more level of specificity you can get back *out* of them than just some kind of Map (Job = M.Map k b, where k ≠ k0, b ≠ b0). If you have a Job type which can store *any* kind of Map (forall k a. Job (Map k a)), then that means you could have a Job with a Map Int Bool, and a Job with a Map String (Float - Float), and they'd both have the same type Job. You can't do anything with the values within, because you're being too permissive about what a Job is. You may want data Job k a = Job (Map k a), *or* if you do actually use one kind of Map only, then why not data Job = Job (Map Int String) (substituting your real types for Int and String). In this case, you could also consider using newtype (newtype Job = Job { getJob :: Map Int 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, all I want is to avoid having to type type variables all over the place. What should I do? My original code with RankNTypes and ImpredicativeTypes does not work The type Job = forall k a. M.Map k a works now. But function uses it does not. Compiler complains about Couldn't match expected type `Job' with actual type `M.Map k0 b0'. On Wed, Jun 13, 2012 at 9:15 PM, Daniel Peebles pumpkin...@gmail.com (mailto:pumpkin...@gmail.com) wrote: That doesn't require existential quantification, but it'll need Rank-2 typesif you ever do anything with Job. Unfortunately, a universally quantifiedJob like what you wrote (or what Magicloud seems to want) is only inhabitedby the empty Map. An existentially quantified Job, as you might get with data Job = forall k a. Job (Map k a) does let you wrap up any Map containing anything in it, but unfortunatelythe only thing you can do with that map afterwards is ask for structuralproperties about it, like whether it's empty or how many elements it has init. You could ask to enumerate the elements in it, but you wouldn't be ableto touch any of them because you wouldn't know what their types were. So I'm not really sure how to interpret the question. Was the goal to have aheterogeneous Map, maybe? Or just to avoid having to type type variables allover the place? Both of those are possible but require a bit moresophistication with types. -Dan On Wed, Jun 13, 2012 at 7:32 AM, Ismael Figueroa Paletifiguer...@gmail.com (mailto:ifiguer...@gmail.com) wrote: Do you want to hide the specific types of the job? Presumably to thendefine a type JobList = [Job] ?You can do that with the ExistentialQuantification extension. type Job = forall k a. Map k atype JobList = [Job] ??Note you can't unpack the types k a once you have hidden them. But thetypechecker can
Re: [Haskell-cafe] What extension do I need to write type Job = Map k a?
Sorry, the full code is here: http://hpaste.org/69972 On Fri, Jun 15, 2012 at 7:09 AM, Arlen Cuss a...@len.me wrote: Hi Magicloud, The indentation has been lost in the mail. Could you post your code (preferably without line numbers) on hpaste.org or similar? —A On Thursday, 14 June 2012 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 14, 2012 at 3:19 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com (mailto: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| JobInfo { jobId :: ThreadId 11| , result :: MVar (Either e a) } 12| 13|type Jobs k e a = (Ord k, Exception e) = 14| M.Map k (JobInfo e a) 15| 16|type JobArgs k a = (Ord k) = 17| M.Map k a 21| 22|start :: (Ord k, Exception e) = JobArgs k a - (a - IO b) - IO (Jobs k e a) 23|start args worker = do 24| arg - newEmptyMVar 25| Map.mapM (\a - do 26| putMVar arg a 27| result - newEmptyMVar 28| tId - forkIO $ do 29| arg_ - takeMVar arg 30| result_ - try $ worker arg_ 31| putMVar result result_ 32| return $ JobInfo tId result 33| ) args On Thu, Jun 14, 2012 at 1:24 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com (mailto: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 (mailto:ivan.miljeno...@gmail.com) wrote: On 14 June 2012 14:20, Magicloud Magiclouds magicloud.magiclo...@gmail.com (mailto:magicloud.magiclo...@gmail.com) wrote: OK. I think I understand a little. I use Job here just wants to simplify the code. And since I provide the function as library, I cannot decide what exact type k is. What should I do? Do you know what the type of `a'? If so: type Job k = Map k String Otherwise... do you even need a type alias? On Thu, Jun 14, 2012 at 11:23 AM, Arlen Cuss a...@len.me (mailto:a...@len.me) wrote: (resending to café, turns out I wasn't subbed from this address.) Hi Magicloud, This is correct; because you've hidden the type-variables away by universally quantifying them, there's no more level of specificity you can get back *out* of them than just some kind of Map (Job = M.Map k b, where k ≠ k0, b ≠ b0). If you have a Job type which can store *any* kind of Map (forall k a. Job (Map k a)), then that means you could have a Job with a Map Int Bool, and a Job with a Map String (Float - Float), and they'd both have the same type Job. You can't do anything with the values within, because you're being too permissive about what a Job is. You may want data Job k a = Job (Map k a), *or* if you do actually use one kind of Map only, then why not data Job = Job (Map Int String) (substituting your real types for Int and String). In this case, you could also consider using newtype (newtype Job = Job { getJob :: Map Int 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, all I want is to avoid having to type type variables all over the place. What should I do? My original code with RankNTypes and ImpredicativeTypes does not work The type Job = forall k a. M.Map k a works now. But function uses it does not. Compiler complains about Couldn't match expected type `Job' with actual type `M.Map k0 b0'. On Wed, Jun 13, 2012 at 9:15 PM, Daniel Peebles pumpkin...@gmail.com (mailto:pumpkin...@gmail.com) wrote: That doesn't require existential quantification, but it'll need Rank-2 typesif you ever do anything with Job. Unfortunately, a universally quantifiedJob like what you wrote (or what Magicloud seems to want) is only inhabitedby the empty Map. An existentially quantified Job, as you might get with data Job = forall k a. Job (Map k a) does let you wrap up any Map containing anything in it, but unfortunatelythe only thing you can do with that map
[Haskell-cafe] What extension do I need to write type Job = Map k a?
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. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What extension do I need to write type Job = Map k a?
Thank you all. I just want to wrap some complex types. So I learn from all info above, I still have to use forall explicitly On Wed, Jun 13, 2012 at 9:19 PM, Yves Parès yves.pa...@gmail.com wrote: Mmmmh... no, to do that you need ImpredicativeTypes (which is I believe about to be deprecated). You have to declare Job a data, not a type, and use ExistentialQuantification. 2012/6/13 Ismael Figueroa Palet ifiguer...@gmail.com Do you want to hide the specific types of the job? Presumably to then define a type JobList = [Job] ? You can do that with the ExistentialQuantification extension. type Job = forall k a. Map k a type JobList = [Job] ?? Note you can't unpack the types k a once 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: 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. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Ismael ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What extension do I need to write type Job = Map k a?
Hi there, Thanks for the reply. To be clear, all I want is to avoid having to type type variables all over the place. What should I do? My original code with RankNTypes and ImpredicativeTypes does not work The type Job = forall k a. M.Map k a works now. But function uses it does not. Compiler complains about Couldn't match expected type `Job' with actual type `M.Map k0 b0'. On Wed, Jun 13, 2012 at 9:15 PM, Daniel Peebles pumpkin...@gmail.com wrote: That doesn't require existential quantification, but it'll need Rank-2 types if you ever do anything with Job. Unfortunately, a universally quantified Job like what you wrote (or what Magicloud seems to want) is only inhabited by the empty Map. An existentially quantified Job, as you might get with data Job = forall k a. Job (Map k a) does let you wrap up any Map containing anything in it, but unfortunately the only thing you can do with that map afterwards is ask for structural properties about it, like whether it's empty or how many elements it has in it. You could ask to enumerate the elements in it, but you wouldn't be able to touch any of them because you wouldn't know what their types were. So I'm not really sure how to interpret the question. Was the goal to have a heterogeneous Map, maybe? Or just to avoid having to type type variables all over the place? Both of those are possible but require a bit more sophistication with types. -Dan On Wed, Jun 13, 2012 at 7:32 AM, Ismael Figueroa Palet ifiguer...@gmail.com wrote: Do you want to hide the specific types of the job? Presumably to then define a type JobList = [Job] ? You can do that with the ExistentialQuantification extension. type Job = forall k a. Map k a type JobList = [Job] ?? Note you can't unpack the types k a once 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: 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. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Ismael ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What extension do I need to write type Job = Map k a?
OK. I think I understand a little. I use Job here just wants to simplify the code. And since I provide the function as library, I cannot decide what exact type k is. What should I do? On Thu, Jun 14, 2012 at 11:23 AM, Arlen Cuss a...@len.me wrote: (resending to café, turns out I wasn't subbed from this address.) Hi Magicloud, This is correct; because you've hidden the type-variables away by universally quantifying them, there's no more level of specificity you can get back *out* of them than just some kind of Map (Job = M.Map k b, where k ≠ k0, b ≠ b0). If you have a Job type which can store *any* kind of Map (forall k a. Job (Map k a)), then that means you could have a Job with a Map Int Bool, and a Job with a Map String (Float - Float), and they'd both have the same type Job. You can't do anything with the values within, because you're being too permissive about what a Job is. You may want data Job k a = Job (Map k a), *or* if you do actually use one kind of Map only, then why not data Job = Job (Map Int String) (substituting your real types for Int and String). In this case, you could also consider using newtype (newtype Job = Job { getJob :: Map Int 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, all I want is to avoid having to type type variables all over the place. What should I do? My original code with RankNTypes and ImpredicativeTypes does not work The type Job = forall k a. M.Map k a works now. But function uses it does not. Compiler complains about Couldn't match expected type `Job' with actual type `M.Map k0 b0'. On Wed, Jun 13, 2012 at 9:15 PM, Daniel Peebles pumpkin...@gmail.com (mailto:pumpkin...@gmail.com) wrote: That doesn't require existential quantification, but it'll need Rank-2 typesif you ever do anything with Job. Unfortunately, a universally quantifiedJob like what you wrote (or what Magicloud seems to want) is only inhabitedby the empty Map. An existentially quantified Job, as you might get with data Job = forall k a. Job (Map k a) does let you wrap up any Map containing anything in it, but unfortunatelythe only thing you can do with that map afterwards is ask for structuralproperties about it, like whether it's empty or how many elements it has init. You could ask to enumerate the elements in it, but you wouldn't be ableto touch any of them because you wouldn't know what their types were. So I'm not really sure how to interpret the question. Was the goal to have aheterogeneous Map, maybe? Or just to avoid having to type type variables allover the place? Both of those are possible but require a bit moresophistication with types. -Dan On Wed, Jun 13, 2012 at 7:32 AM, Ismael Figueroa Paletifiguer...@gmail.com (mailto:ifiguer...@gmail.com) wrote: Do you want to hide the specific types of the job? Presumably to thendefine a type JobList = [Job] ?You can do that with the ExistentialQuantification extension. type Job = forall k a. Map k atype JobList = [Job] ??Note you can't unpack the types k a once you have hidden them. But thetypechecker 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 (mailto:magicloud.magiclo...@gmail.com) Hi,I've forgotten this.This is OK:type Job k a = Map k aAnd 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 (http://gmail.com). ___Haskell-Cafe mailing listhaskell-c...@haskell.org (mailto:Haskell-Cafe@haskell.org) http://www.haskell.org/mailman/listinfo/haskell-cafe --Ismael ___Haskell-Cafe mailing listhaskell-c...@haskell.org (mailto:Haskell-Cafe@haskell.org) http://www.haskell.org/mailman/listinfo/haskell-cafe -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com (http://gmail.com). ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org (mailto:Haskell-Cafe@haskell.org) http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http
Re: [Haskell-cafe] What extension do I need to write type Job = Map k a?
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. And since I provide the function as library, I cannot decide what exact type k is. What should I do? Do you know what the type of `a'? If so: type Job k = Map k String Otherwise... do you even need a type alias? On Thu, Jun 14, 2012 at 11:23 AM, Arlen Cuss a...@len.me wrote: (resending to café, turns out I wasn't subbed from this address.) Hi Magicloud, This is correct; because you've hidden the type-variables away by universally quantifying them, there's no more level of specificity you can get back *out* of them than just some kind of Map (Job = M.Map k b, where k ≠ k0, b ≠ b0). If you have a Job type which can store *any* kind of Map (forall k a. Job (Map k a)), then that means you could have a Job with a Map Int Bool, and a Job with a Map String (Float - Float), and they'd both have the same type Job. You can't do anything with the values within, because you're being too permissive about what a Job is. You may want data Job k a = Job (Map k a), *or* if you do actually use one kind of Map only, then why not data Job = Job (Map Int String) (substituting your real types for Int and String). In this case, you could also consider using newtype (newtype Job = Job { getJob :: Map Int 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, all I want is to avoid having to type type variables all over the place. What should I do? My original code with RankNTypes and ImpredicativeTypes does not work The type Job = forall k a. M.Map k a works now. But function uses it does not. Compiler complains about Couldn't match expected type `Job' with actual type `M.Map k0 b0'. On Wed, Jun 13, 2012 at 9:15 PM, Daniel Peebles pumpkin...@gmail.com (mailto:pumpkin...@gmail.com) wrote: That doesn't require existential quantification, but it'll need Rank-2 typesif you ever do anything with Job. Unfortunately, a universally quantifiedJob like what you wrote (or what Magicloud seems to want) is only inhabitedby the empty Map. An existentially quantified Job, as you might get with data Job = forall k a. Job (Map k a) does let you wrap up any Map containing anything in it, but unfortunatelythe only thing you can do with that map afterwards is ask for structuralproperties about it, like whether it's empty or how many elements it has init. You could ask to enumerate the elements in it, but you wouldn't be ableto touch any of them because you wouldn't know what their types were. So I'm not really sure how to interpret the question. Was the goal to have aheterogeneous Map, maybe? Or just to avoid having to type type variables allover the place? Both of those are possible but require a bit moresophistication with types. -Dan On Wed, Jun 13, 2012 at 7:32 AM, Ismael Figueroa Paletifiguer...@gmail.com (mailto:ifiguer...@gmail.com) wrote: Do you want to hide the specific types of the job? Presumably to thendefine a type JobList = [Job] ?You can do that with the ExistentialQuantification extension. type Job = forall k a. Map k atype JobList = [Job] ??Note you can't unpack the types k a once you have hidden them. But thetypechecker 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 (mailto:magicloud.magiclo...@gmail.com) Hi,I've forgotten this.This is OK:type Job k a = Map k aAnd 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 (http://gmail.com). ___Haskell-Cafe mailing listhaskell-c...@haskell.org (mailto:Haskell-Cafe@haskell.org) http://www.haskell.org/mailman/listinfo/haskell-cafe --Ismael ___Haskell-Cafe mailing listhaskell-c...@haskell.org (mailto:Haskell-Cafe@haskell.org) http://www.haskell.org/mailman/listinfo/haskell-cafe -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com (http://gmail.com). ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org (mailto:Haskell-Cafe@haskell.org) http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What is the difference between runhaskell and compile?
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...@gmail.com wrote: 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 7.2.2. The code worked. At last, I installed 7.4.1 in CentOS. The code did not work. Could you send the .hi/.o to me, so maybe I could find out the different? Also the exact original source. Thank you. Interesting indeed! I am guessing that you are using the GHC-7.4.1 bindist from haskell.org. I will try and find some time to marshal the source code and intermediate files (am on the road -- will need to collect it from base, make it generic etc.). You might also like to try the http://justhub.org ghc-7.4.1-hub on your CentOS-6.1 node. It is a separate build from the haskell.org bindist and comes with it's own in-board gcc (4.6.1) and binutils (2.21) used for the build. It should work for you. (You could also try ghc-7.4.2-RC1-hub.) Chris -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What is the difference between runhaskell and compile?
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, with another box of different version of ghc and things. I finally got the cause. Or may I say as simple as Ozgun said, ghc 7.4.1 defaultly uses optimization. ghc-7.4.1 -O0 works. ghc-7.2.2 also works. Thank you all. On Sun, May 27, 2012 at 7:07 PM, Chris Dornan ch...@chrisdornan.com wrote: By configuration of the OpenLDAP client library I mean mostly so that SSL connections will work, but this is all system-level configuration. That GHC establishes connections in interactive mode for you indicates that the problem is not with the LDAP systems, but that something peculiar is going wrong with your GHC installation. Do you have only the one GHC installation on the system; is there any chance that ghc and ghci could be selecting different installations? Is it easy for you to try connecting with GHC-7.0.4? It would be worth a try if you can -- it might 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] Sent: 27 May 2012 10:12 To: Chris Dornan Cc: Brandon Allbery; Haskell-Cafe Subject: Re: [Haskell-cafe] What is the difference between runhaskell and compile? Hi, Sorry for the delayed reply. I am using ghc 7.4.1 and LDAP 0.6.6. When you said configuration of the OpenLDAP client library, may I have more information? Since ldap-utils and other client (php, perl, etc) do not have any problem. This might be the only clue to me. On Fri, May 25, 2012 at 4:43 PM, Chris Dornan ch...@chrisdornan.com wrote: I have been using LDAP with GHC without a problem – I get this error often but the problems have been with the configuration of the OpenLDAP client library or the OpenLDAP server. We are all taking about LDAP-0.6.6? Which version of GHC 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-Cafe Subject: Re: [Haskell-cafe] What is the difference between runhaskell and compile? On Thu, May 24, 2012 at 11:05 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Hi there, The code could not be simpler. Just ldapInit, ldapSimpleBind. I just found that the code works with ghci, too. So to sum up, ghci/runhaskell works, ghc not. A possibility that occurs to me: does it by any chance work with ghc -threaded? Perhaps the issue relates to the different behavior of the threaded runtime (which is used automatically by ghci/runghc). -- brandon s allbery allber...@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What is the difference between runhaskell and compile?
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 7.2.2. The code worked. At last, I installed 7.4.1 in CentOS. The code did not work. Could you send the .hi/.o to me, so maybe I could find out the different? Also the exact original source. Thank you. On Mon, May 28, 2012 at 6:27 PM, Chris Dornan ch...@chrisdornan.com wrote: 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. I have set up this test on 7.4.1 and I cannot recreate the problem -- compiling and running an equivalent program (the posted program with local domain, bindDN and bindPW definitions localised and all other let bindings removed) leads to a successful server connection when passed the right password but fails to connect with the wrong password. This was the behaviour you were seeing yourself with 7.2.2 was it not? I can only recommend re-installing 7.4.1 and trying again. Chris -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What is the difference between runhaskell and compile?
Hi, Sorry for the delayed reply. I am using ghc 7.4.1 and LDAP 0.6.6. When you said configuration of the OpenLDAP client library, may I have more information? Since ldap-utils and other client (php, perl, etc) do not have any problem. This might be the only clue to me. On Fri, May 25, 2012 at 4:43 PM, Chris Dornan ch...@chrisdornan.com wrote: I have been using LDAP with GHC without a problem – I get this error often but the problems have been with the configuration of the OpenLDAP client library or the OpenLDAP server. We are all taking about LDAP-0.6.6? Which version of GHC 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-Cafe Subject: Re: [Haskell-cafe] What is the difference between runhaskell and compile? On Thu, May 24, 2012 at 11:05 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Hi there, The code could not be simpler. Just ldapInit, ldapSimpleBind. I just found that the code works with ghci, too. So to sum up, ghci/runhaskell works, ghc not. A possibility that occurs to me: does it by any chance work with ghc -threaded? Perhaps the issue relates to the different behavior of the threaded runtime (which is used automatically by ghci/runghc). -- brandon s allbery allber...@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What is the difference between runhaskell and compile?
Alright, with another box of different version of ghc and things. I finally got the cause. Or may I say as simple as Ozgun said, ghc 7.4.1 defaultly uses optimization. ghc-7.4.1 -O0 works. ghc-7.2.2 also works. Thank you all. On Sun, May 27, 2012 at 7:07 PM, Chris Dornan ch...@chrisdornan.com wrote: By configuration of the OpenLDAP client library I mean mostly so that SSL connections will work, but this is all system-level configuration. That GHC establishes connections in interactive mode for you indicates that the problem is not with the LDAP systems, but that something peculiar is going wrong with your GHC installation. Do you have only the one GHC installation on the system; is there any chance that ghc and ghci could be selecting different installations? Is it easy for you to try connecting with GHC-7.0.4? It would be worth a try if you can -- it might 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] Sent: 27 May 2012 10:12 To: Chris Dornan Cc: Brandon Allbery; Haskell-Cafe Subject: Re: [Haskell-cafe] What is the difference between runhaskell and compile? Hi, Sorry for the delayed reply. I am using ghc 7.4.1 and LDAP 0.6.6. When you said configuration of the OpenLDAP client library, may I have more information? Since ldap-utils and other client (php, perl, etc) do not have any problem. This might be the only clue to me. On Fri, May 25, 2012 at 4:43 PM, Chris Dornan ch...@chrisdornan.com wrote: I have been using LDAP with GHC without a problem – I get this error often but the problems have been with the configuration of the OpenLDAP client library or the OpenLDAP server. We are all taking about LDAP-0.6.6? Which version of GHC 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-Cafe Subject: Re: [Haskell-cafe] What is the difference between runhaskell and compile? On Thu, May 24, 2012 at 11:05 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Hi there, The code could not be simpler. Just ldapInit, ldapSimpleBind. I just found that the code works with ghci, too. So to sum up, ghci/runhaskell works, ghc not. A possibility that occurs to me: does it by any chance work with ghc -threaded? Perhaps the issue relates to the different behavior of the threaded runtime (which is used automatically by ghci/runghc). -- brandon s allbery allber...@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] What is the difference between runhaskell and compile?
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 server. There is sure no problem with the server. So I am confused. I thought the two supposed to be the same. -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What is the difference between runhaskell and compile?
Hi there, The code could not be simpler. Just ldapInit, ldapSimpleBind. I just found that the code works with ghci, too. So to sum up, ghci/runhaskell works, ghc not. On Thu, May 24, 2012 at 8:15 PM, Vincent Ambo taz...@googlemail.com wrote: Can you paste your code somewhere? I'm using the LDAP package at work (for authenticating a Yesod app) and a quick test of the basic LDAP package in GHCi works for me: λ import LDAP λ ldap - ldapInit 10.0.0.12 ldapPort λ ldapSimpleBind ldap geva ** λ let desiredAttr = LDAPAttrList [name] λ let searchDN = Just OU=Redacted,DC=redacted,DC=com λ let searchFilter = Just sAMAccountName=geva λ ldapSearch ldap searchDN LdapScopeSubtree searchFilter desiredAttr False [LDAPEntry {ledn = CN=Vincent Ambo,OU=Redacted,DC=redacted,DC=com, leattrs = [(name,[Vincent Ambo])]}] It also works in compiled applications and in source files 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 ghc compiled (no any args), and ran, I got this: LDAP error: ldapSimpleBind: LDAPException LdapServerDown(-1): Can't contact LDAP server. There is sure no problem with the server. So I am confused. I thought the two supposed to be the same. -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What is the difference between runhaskell and compile?
Versions: libldap2 2.4.28 LDAP 0.6.6 ghc 7.4.1 Code below: import LDAP main :: IO () main = do let domain = vancloa.cn bindDN = CN=wangshida.admin,OU=admin_accounts,DC=vancloa,DC=cn bindPW = baseDN = Just DC=vancloa,DC=cn ldapFilter = Just (((sAMAccountName= ++ 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 magicloud.magiclo...@gmail.com wrote: Hi there, The code could not be simpler. Just ldapInit, ldapSimpleBind. I just found that the code works with ghci, too. So to sum up, ghci/runhaskell works, ghc not. A possibility that occurs to me: does it by any chance work with ghc -threaded? Perhaps the issue relates to the different behavior of the threaded runtime (which is used automatically by ghci/runghc). -- brandon s allbery allber...@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
How to staticly build ghc?
Hi, I am with ghc 7.4.1. For some reason I need a totally static linked compilation to my code. But it failed when linking some packages came with ghc, like unix-2.5.1.0. Trying to rebuild ghc to make all staticly, but failed to find args like this when configuring ghc. What should I do? -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: [Haskell-cafe] Problem with forall type in type declaration
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 actually return any inside type (depending on another function that passed to it). Even simple as different tuples would destroy this solution. On Fri, May 4, 2012 at 10:05 PM, Daniel Díaz Casanueva dhelta.d...@gmail.com wrote: If one parameter is not enough, you always can add more: Test m a b = Test { f :: m IO a - IO b } This way, if run :: m IO a - IO a then Test run :: Test m a a But for other type for your run function run' :: m IO a - IO b you get Test run' :: Test m a b So you can have different types in input and output. Anyway, your type 'm' is applied to other two types (m IO a), so it cannot be a monad, because monads have arity 1 as type constructors, i.e. monads have kind (* - *). Is perhaps 'm' some kind of monad transformer? Well, that's all I can say from your explanation of the problem! Hope it helps! Daniel Díaz. -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Problem with forall type in type declaration
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 { f :: Monad IO a - IO a} does not work. -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Problem with forall type in type declaration
Sorry, it was just a persudo code. This might be more clear: run :: (Monad m) = m IO a - IO a On Fri, May 4, 2012 at 4:32 PM, Yves Parès yves.pa...@gmail.com wrote: run :: Monad IO a - IO a Actually this type is wrong. Monad has to appear as a class constraint, for instance : run :: Monad 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) 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 { f :: Monad IO a - IO a} does not work. -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Problem with forall type in type declaration
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 this solution. On Fri, May 4, 2012 at 10:05 PM, Daniel Díaz Casanueva dhelta.d...@gmail.com wrote: If one parameter is not enough, you always can add more: Test m a b = Test { f :: m IO a - IO b } This way, if run :: m IO a - IO a then Test run :: Test m a a But for other type for your run function run' :: m IO a - IO b you get Test run' :: Test m a b So you can have different types in input and output. Anyway, your type 'm' is applied to other two types (m IO a), so it cannot be a monad, because monads have arity 1 as type constructors, i.e. monads have kind (* - *). Is perhaps 'm' some kind of monad transformer? Well, that's all I can say from your explanation of the problem! Hope it helps! Daniel Díaz. -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Again, version conflicting problem with cabal-install
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, these hackages are not be able to build at all under certain conditions. So, I am voting on the force-allow flag. On Sat, Feb 4, 2012 at 12:36 AM, Andres Löh andres.l...@googlemail.com wrote: Hi. --force-allow=foo-1.3 with the semantics that all dependencies on foo will be changed to allow foo-1.3 to be chosen. Would that be ok? Other suggestions? Can't this be integrated with the current --constraint flag? It could be, but ... If the constraint is able to be satisfied without unrestricting any bounds, fine. Otherwise, unrestrict any bounds on that constraint. What would be the drawbacks? ... it shouldn't happen automatically. There are perfectly valid and safe reasons to use --constraint, whereas this new feature is inherently unsafe. But allowing general constraint syntax and calling the flag something with constraint in it is perhaps a good idea. An advantage is being able to specify --constraint='foo = 1.3' to get foo-1.3.7.2 instead of having to find out exactly which version you want. And if you already know what you want, you may always say --constraint='foo == 1.3.7.2'. Yes. Looking forward to the new solver! =) I need testers and feedback. You can already use it. It's in the cabal-install development version, and can be enabled by saying --solver=modular on the command line. Cheers, Andres -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Again, version conflicting problem with cabal-install
Yes and probably a runtime crash even if passed the compile. But I think if we let it stay the way it is, the hackage empire would be down any minute. All big hackages are depending on many other hackages by many other authors. So big chance that the top hackage cannot be installed (like I 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 does say it more clearly than me. But still, currently, ghc only gives me one option: cannot be built. How about giving me another one: throw away the version information of D when building A. So when A uses types in D with B and C, it might work. Just the risk is on me now. It is not perfect, but would work sometimes But not always. We'd then have other errors: why isn't this build working? Types can be re-exported, class instances are implicitly imported/exported, etc. 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 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 not installable by cabal. A needs B 0.1 A needs C 0.1 B needs C0.2 See the Dreaded Diamond Dependency Problem: http://www.well-typed.com/blog/9 -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Again, version conflicting problem with cabal-install
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...@gmail.com wrote: Thank you. The document does say it more clearly than me. But still, currently, ghc only gives me one option: cannot be built. How about giving me another one: throw away the version information of D when building A. So when A uses types in D with B and C, it might work. Just the risk is on me now. It is not perfect, but would work sometimes But not always. We'd then have other errors: why isn't this build working? Types can be re-exported, class instances are implicitly imported/exported, etc. It's a valid complaint, and there's ongoing work to fix some of these issues. In the meantime, the development version of cabal-install, in particular the new modular solver, can deal with a few situations that can't be resolved by older cabal-install versions. I can't promise it will help here. But I'm still interested in feedback. Cheers, Andres -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Again, version conflicting problem with cabal-install
I think this could be gone with cabal-dev only if A has a new version or the compiled one that could use C-0.2 or caba-dev could ignore the version constraint. So it is kind of an old binary problem. It could also be resolved by reinstall A to use C-0.2 with cabal-install. The problem I met is that, A uses B and C-0.2, and B uses C-0.1. Both dependencies to C were strict. I had not gotten any B or C installed. Now I just started to install A. It would fail. In fact, there was a chance that I just modified B.cabal to use C-0.2 and all things done. But there also was a risk of unable to compile or even runtime crash. I am just wanting an option (ignore versions) to take that risk in develop environment. 2012/2/3 Jason Dagit dag...@gmail.com: In my experience the diamond of death is typically because: * You install package A that uses C-0.1 * Someone uploads C-0.2 to hackage * Later you 'cabal update', this does not rebuild A to use C-0.2, even though it could. * You install package B that uses C, and cabal builds it with C-0.2 * Now you want to build D that uses A and B, but A requires C-0.1 and B requires C-0.2, even though they could be rebuilt to use the same C. Typically, the constraints on A, B, and D would all accept the same version of C. Except that when they were compiled separately and C changed between building A and B, then the compiled versions become fixed on C-0.1 and C-0.2. It's true that it won't solve it in all cases, but in my 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 at the SAME time. On Fri, Feb 3, 2012 at 9:20 PM, Jason Dagit dag...@gmail.com wrote: On Thu, Feb 2, 2012 at 9:54 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: 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? I'm not sure, but for me this problem has gone away by using cabal-dev to build everything. Jason -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Again, version conflicting problem with cabal-install
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 not installable by cabal. A needs B 0.1 A needs C 0.1 B needs C0.2 -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Again, version conflicting problem with cabal-install
Thank you. The document does say it more clearly than me. But still, currently, ghc only gives me one option: cannot be built. How about giving me another one: throw away the version information of D when building A. So when A uses types in D with B and C, it might work. Just the risk is on me now. 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 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 not installable by cabal. A needs B 0.1 A needs C 0.1 B needs C0.2 See the Dreaded Diamond Dependency Problem: http://www.well-typed.com/blog/9 -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com -- 竹密岂妨流水过 山高哪阻野云飞 And for G+, please use magiclouds#gmail.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] LDAP hackage problem.
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 using. Running this code returns the similar thing. The problem is that only sn/givenName/displayName are empty. I have tried a few diag ways trying to find out why. No luck. $ ldapsearch -h vancloa.cn -D CN=wangshida.admin,OU=admin_accounts,DC=vancloa,DC=cn -w -b DC=vancloa,DC=cn -x '((sAMAccountName=chengtao)((objectClass=user)(!(ou=Recycle_Bin' # extended LDIF # # LDAPv3 # base DC=vancloa,DC=cn with scope subtree # filter: ((sAMAccountName=chengtao)((objectClass=user)(!(ou=Recycle_Bin # requesting: ALL # # 000634, Employees_Accounts, vancloa.cn dn: CN=000634,OU=Employees_Accounts,DC=vancloa,DC=cn objectClass: top objectClass: person objectClass: organizationalPerson objectClass: user cn: 000634 sn:: 56iL c: CN title:: 5oqA5pyv5pSv5oyB5bel56iL5biI description: 000634 physicalDeliveryOfficeName:: 5oiQ6YO95LuT5YKo givenName:: 5rab distinguishedName: CN=000634,OU=Employees_Accounts,DC=vancloa,DC=cn instanceType: 4 whenCreated: 20101231073752.0Z whenChanged: 20120106005157.0Z displayName:: 56iL5rab # search reference ref: ldap://ForestDnsZones.vancloa.cn/DC=ForestDnsZones,DC=vancloa,DC=cn # search reference ref: ldap://DomainDnsZones.vancloa.cn/DC=DomainDnsZones,DC=vancloa,DC=cn # search reference ref: ldap://vancloa.cn/CN=Configuration,DC=vancloa,DC=cn # search result search: 2 result: 0 Success # numResponses: 5 # numEntries: 1 # numReferences: 3 6|main :: IO () 7|main = do 8| args - getArgs 9| let alias = head args 10| putStrLn alias 11| entries - failLDAP $ do 12|ldap - ldapOpen vancloa.cn 389 13|ldapSimpleBind ldap CN=wangshida.admin,OU=admin_accounts,DC=vancloa,DC=cn 14|ldapSearch ldap (Just DC=vancloa,DC=cn) LdapScopeSubtree (Just (((sAMAccountName= ++ alias ++ )((objectClass=user)(!(ou=Recycle_Bin\ )) LDAPAllUserAttrs False --(LDAPAttrList [sn, givenname]) False 15| let LDAPEntry _ attrs = head entries 16| sn = head $ snd $ head $ filter (\(a, _) - a == sn) attrs 17| givenName = head $ snd $ head $ filter (\(a, _) - a == givenName) attrs 18| print entries -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] How to catch all exceptions that could be caught?
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 does not seem to exist in Haskell document? And the most awful part is that even when the program failed with error message, I still did not know what exception was this. Take recv: does not exist (Connection refused) for example. -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to catch all exceptions that could be caught?
Yes, that is a problem. But consider my PS in original mail, I have no idea what exception should I catch. Where could I get that information? On Thu, Jan 12, 2012 at 2:49 PM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 12 January 2012 17:34, Gregory Crosswhite gcrosswh...@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. But it is usually recommended that you *don't* do this, as it even captures Ctrl-c invocations: http://www.haskell.org/ghc/docs/latest/html/libraries/base/Control-Exception.html#g:4 -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to catch all exceptions that could be caught?
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 should I catch. Where could I get that information? In my experience, exceptions fall into three categories. First, when performing IO, some functions throw an exception instead of returning an error code, as is the case for many of the functions in System.IO; however, in these cases the exceptions that can be thrown are clearly documented. Second, when a bug in your code has caused it to reach a point where it can no longer proceed, such as when there is a deadlock, when there is an infinite loop, when you violated a precondition of a pure function by for example calling head on an empty list, etc.; in such cases it is very unlikely that you would even want to catch and gracefully recover from them, so an exception specification would not help you very much anyway. Third, when you are running someone else's code and you want to be able to catch any exceptions it throws so that you can handle the error reporting yourself; in this case the only thing that you care about is whether the exception is an AsyncException or not, since if it is an AsyncException then you should almost certainly should just let it propagate up the call stack rather than dealing with it yourself. Incidentally, in all of these cases catching *all* exceptions is a bad idea unless you really know what you are doing for the reasons that others here have pointed out, so I apologize for misleading you with that suggestion. Cheers, Greg -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] How to show a utf8 string?
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 firefox, no luck. -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to show a utf8 string?
Thank you guys. I forgot the point that print involves show. On Tue, Jan 10, 2012 at 6:27 PM, Roel van Dijk vandijk.r...@gmail.com wrote: Have you tried using putStrLn? Small GHCI example: Prelude putStrLn \29579 王 I believe the Show instances for chars and strings escape all 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 terminal's fault, so tried to use System.IO.UTF8 to put the result into a file and viewed by firefox, no luck. -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Deduce problem.
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, FlexibleInstances #-} class (ClassA a, ClassB b) = ClassC a b where from :: a - [b] to :: a - [b] data H = H class ClassA a where toInt :: a - Int class ClassB b where fromInt :: Int - b instance ClassB H where fromInt _ = H data Test = Test { m :: H } instance ClassA Test where toInt _ = 0 instance ClassC Test H where from = (:[]) . m to = (:[]) . m The constraints in the ClassC a b declaration specify that in all instances of ClassC, the type a must be in ClassA and the type b must be in ClassB. This is the case for the ClassC Test H instance. You can also specify that for some particular 'a' the function 'from' can produce the value of the type [b] for any b in ClassB. The caller will determine which b it wants. This is similar to your original intention, as I understand. instance ClassA Int where toInt = id instance ClassB b = ClassC Int b where from x = [fromInt x] t1:: [H] t1 = from (5::Int) -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Deduce problem.
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 Well, I got could not deduce error here at from = m and to = m. `c' is a rigid type variable bound by the type signature for to :: ClassB c = Test - [c]. Referring to some similar questions on internet, I should remove the (ClassB c) thing. Is this the only solution? -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Deduce problem.
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 = Test { m :: H } instance ClassA Test where ... instance ClassC Test where from = m to = m Well, I got could not deduce error here at from = m and to = m. `c' is a rigid type variable bound by the type signature for to :: ClassB c = Test - [c]. Referring to some similar questions on internet, I should remove the (ClassB c) thing. Is this the only solution? -- 竹密岂妨流水过 山高哪阻野云飞 I was wrong, forall b. did not help -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Deduce problem.
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? Referring to Data.List.genericLength, I was confused. On Thu, Nov 17, 2011 at 12:34 PM, MigMit miguelim...@yandex.ru wrote: You've declared from as forall b. Test - [b], 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 ... data Test = Test { m :: H } instance ClassA Test where ... instance ClassC Test where from = m to = m Well, I got could not deduce error here at from = m and to = m. `c' is a rigid type variable bound by the type signature for to :: ClassB c = Test - [c]. Referring to some similar questions on internet, I should remove the (ClassB c) thing. Is this the only solution? -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Deduce problem.
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? Referring to Data.List.genericLength, I was confused. Because it doesn't mean that *you* get to decide what it is; it means *the caller* gets to decide, and you are obligated to honor the caller's wishes. Returning always an H violates this, because there is no way to prove that H is the only possible response. -- brandon s allbery allber...@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms Ah, list and single value is a typo problem. So I think I got what you guys meant, I limited ClassB to only H. Then how to archive my requirement, that from and to only return items that instanced ClassB? -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Usage question with TemplateHaskell and Generic
2011/11/7 José Pedro Magalhães j...@cs.uu.nl: Hi, I'm not sure I understand your question. But if you mean that you want to retrieve the type variable names, as they were defined in the source, then I can tell you that the generic deriving mechanism cannot do this. Cheers, Pedro On Sun, 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 this question: If I have data A b = C b, then with TemplateHaskell, the type would be VarT b, which means at compile time, I cannot get the exact type, so the type name would be b. So I wonder if this could be resolved by TemplateHaskell, or Generic is the only choice. PS: I have not tried to do this in Generic. -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe Thank you. After deeply thinking about this, GH sure does not -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Usage question with TemplateHaskell and Generic
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 be VarT b, which means at compile time, I cannot get the exact type, so the type name would be b. So I wonder if this could be resolved by TemplateHaskell, or Generic is the only choice. PS: I have not tried to do this in Generic. -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ghc 7.2.1 Generics problem
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...@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: Unsupported extension: DeriveRepresentable There's no extension of that name in 7.2.1. Do you mean DeriveGeneric? Cheers, Andres I do not know. I will try that. I got the name from http://www.haskell.org/haskellwiki/Generics. -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe Thank you. I saw the page was updated. So I followed the document. And got stuck again. Copying the code and compile, I got: 25instance (GSerialize a) = GSerialize (M1 i a) where 26 gput (M1 x) = gput x test.hs:25:40: `M1 i a' is not applied to enough type arguments The first argument of `GSerialize' should have kind `* - *', but `M1 i a' has kind `(* - *) - * - *' In the instance declaration for `GSerialize (M1 i a)' -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Is generic information dumpable?
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. -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Problem with TemplateHaskell
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 _ _ _ cons _ = datad to = mkName toDocument from = mkName fromDocument fund - mapM (\con - case con of RecC n types - do let nvs = map (\(nv, _, _) - nv ) types funD to [clause [conP n $ map varP nvs] (normalB $ listE $ map (\nv - infixE (Just $ litE $ stringL $ show nv) (varE $ mkName =:) $ Just $ appE (varE $ mkName val) $ varE nv ) nvs) []] ) cons return (datad : fund) Testing code is as: data T = T { a :: Int , b :: Char } *TH runQ (bson [d|data T = T {a :: Int, b :: Char}|]) [DataD [] T_0 [] [RecC T_1 [(a_2,NotStrict,ConT GHC.Types.Int),(b_3,NotStrict,ConT GHC.Types.Char)]] [],FunD toDocument [Clause [ConP T_1 [VarP a_2,VarP b_3]] (NormalB (ListE [InfixE (Just (LitE (StringL a_2))) (VarE =:) (Just (AppE (VarE val) (VarE a_2))),InfixE (Just (LitE (StringL b_3))) (VarE =:) (Just (AppE (VarE val) (VarE b_3)))])) []]] So you see that, it changed the name from T/a/b to T_0/T_1/a_2/b_3. Why is that? I did not have code to modify original data declaration. -- 竹密岂妨流水过 山高哪阻野云飞 Here is the code it actually generated: test.hs:1:1: Splicing declarations bson [d| data T = T {a :: Int, b :: String} |] == test.hs:(7,3)-(8,38) data T_a1XY = T_a1XZ {a_a1Y0 :: Int, b_a1Y1 :: String} toName (T_a1XZ a_a1Y0 b_a1Y1) = [(a_1627397516 =: a_a1Y0), (b_1627397517 =: b_a1Y1)] How to avoid the name changing? -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Problem with TemplateHaskell
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. And just now I found out that, the name changing occurred when using quote, so at the very beginning, data T was not data T already. -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Problem with TemplateHaskell
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? Maybe you should use nameBase rather than show? Max Yes, that is one of the problem. And just now I found out that, the name changing occurred when using quote, so at the very beginning, data T was not data T already. -- 竹密岂妨流水过 山高哪阻野云飞 I kind of fingering out where am I wrong. I should declare the data type in quote. I should make it outside the template and using type name and reify to get it in bson. -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe