Re: [Haskell-cafe] Is it possible to get the information of instances of a type?
On Thu, Oct 27, 2011 at 1:57 AM, Brent Yorgey wrote: > On Wed, Oct 26, 2011 at 09:10:23PM +0400, MigMit wrote: >> Can't be done. Even if this particular module doesn't contain >> "instance Class Type", it's quite possible that the said instance >> would be defined in another module, about which this one knows >> nothing about. > > That doesn't mean it can't be done, only that you would have to be > explicit about which modules to look in. > > -Brent > > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > May I know more about this? Have not used TH on this subject. -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is it possible to get the information of instances of a type?
On Thu, Oct 27, 2011 at 7:04 AM, Evan Laforge wrote: >> No, this lists all the instances of a class. OP asked for the classes >> of which a given type is an instace. >> >> Presumably it is possible, since Haddock does it! In the >> documentation generated for a type it lists classes of which the type >> is an instance. So you might want to look at how Haddock does it. I >> suspect the only way is through the GHC API. > > ghci :info does it too. > > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > Generally looked into GHC's source, seems like the :info (line 850 of compiler/main/InteractiveEval.hs) is internal function. At last, GHC parsed the code, it sure knew the type info. -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Haskell Weekly News: Issue 205
Welcome to issue 205 of the HWN, a newsletter covering developments in the Haskell community. This release covers the week of October 16 to 22, 2011. You can find an HTML version of this issue at: http://contemplatecode.blogspot.com/2011/10/haskell-weekly-news-issue-205.html Announcements Ian Lynah sent out a call for nominations for the haskell.org committee. See the link for details on how to submit a nomination. Nominations close on October 29. [1] http://goo.gl/J9J6H New and Updated Projects * netwire (Ertugrul Soeylemez; 1.2.7) [2] http://goo.gl/ULujm Quotes of the Week * kmc: i just used Hayoo to see if anyone implemented this function and it came back with one of my own libraries * JoeyA: LLVM: The easy-to-use compiler infrastructure nobody knows how to use. * kmc: Haskell isn't really designed by mathematicians. it's designed by people who programmers would consider to be mathematicians and mathematicians would consider to be programmers * Cale: foldr is the real fold; foldl is an imposter * @remember hey daniel kmc wants his uploads featured on HWN [edit note: oops, I guess that was meant for me :) +1 for new and inventive ways to communicate!] Top Reddit Stories * Tech-talk about Haskell at Google: Haskell Amuse-Bouche Domain: youtu.be, Score: 86, Comments: 5 On Reddit: [3] http://goo.gl/Pf0NZ Original: [4] http://goo.gl/NPZ17 * Deprecate Prelude.head and partial functions Domain: chrisdone.com, Score: 58, Comments: 60 On Reddit: [5] http://goo.gl/Yat8J Original: [6] http://goo.gl/NyiRO * What does your company use Haskell for? I'll go first. Domain: self.haskell, Score: 51, Comments: 38 On Reddit: [7] http://goo.gl/VOfrO Original: [8] http://goo.gl/VOfrO * I am working on a functional web-programming language as a senior thesis. What do you think so far? Domain: elm-lang.org, Score: 40, Comments: 58 On Reddit: [9] http://goo.gl/6PrQM Original: [10] http://goo.gl/l3odM * Dear Redditor Emac-loving Haskeller(s): what cool emacs Haskell Mode (or custom) features do you use? Domain: self.haskell, Score: 40, Comments: 7 On Reddit: [11] http://goo.gl/LKW0A Original: [12] http://goo.gl/LKW0A * Macros in Haskell Domain: playingwithpointers.com, Score: 38, Comments: 0 On Reddit: [13] http://goo.gl/pwfjt Original: [14] http://goo.gl/bSYN8 * Type-safe event-based programming Domain: jaspervdj.be, Score: 35, Comments: 0 On Reddit: [15] http://goo.gl/gyj9J Original: [16] http://goo.gl/ZBC55 * Yesod excellent ideas Domain: yannesposito.com, Score: 34, Comments: 5 On Reddit: [17] http://goo.gl/ikFJV Original: [18] http://goo.gl/UgBaC * AI Challenge: Ants. Haskell support is only for GHC 6.12. Shall we lobby for 7.0? Domain: aichallenge.org, Score: 28, Comments: 24 On Reddit: [19] http://goo.gl/ShqaM Original: [20] http://goo.gl/O2YOp * Why not Haskell? Domain: neugierig.org, Score: 27, Comments: 26 On Reddit: [21] http://goo.gl/INmRp Original: [22] http://goo.gl/wK3U3 Top StackOverflow Questions * What are some compelling use cases for dependent method types? votes: 44, answers: 2 Read on SO: [23] http://goo.gl/2Xmgu * Why monads? How does it resolve side-effects? votes: 14, answers: 7 Read on SO: [24] http://goo.gl/UJimh * How does Haskell printf work? votes: 13, answers: 1 Read on SO: [25] http://goo.gl/351dE * Why is my genetic algorithm seemingly behaving randomly? votes: 10, answers: 1 Read on SO: [26] http://goo.gl/a5FtH * What are the benefits of applicative parsing over monadic parsing? votes: 10, answers: 4 Read on SO: [27] http://goo.gl/UEkpx * Fixity of backtick operators? votes: 9, answers: 1 Read on SO: [28] http://goo.gl/nwji2 * Bit Size of GHC's Int Type votes: 8, answers: 2 Read on SO: [29] http://goo.gl/DDtFZ * Simple word count in haskell votes: 8, answers: 4 Read on SO: [30] http://goo.gl/ZAYyT * existential search and query without the fuss votes: 8, answers: 2 Read on SO: [31] http://goo.gl/Fnes6 * How to selectively link certain system libraries statically into Haskell program binary? votes: 8, answers: 2 Read on SO: [32] http://goo.gl/HjPTc Until next time, Daniel Santa Cruz References 1. http://permalink.gmane.org/gmane.comp.lang.haskell.general/18983 2. http://permalink.gmane.org/gmane.comp.lang.haskell.cafe/93163 3. http://youtu.be/b9FagOVqxmI 4. http://www.reddit.com/r/haskell/comments/lkiiw/techtalk_about_haskell_at_google_haskell/ 5. http://chrisdone.com/posts/2011-10-17-boycott-head.html 6. http://www.reddit.com/r/haskell/comments/lf71l/deprecate_preludehead_and_partial_functions/ 7. http://www.reddit.com/r/haskell/comments/lfwlv
Re: [Haskell-cafe] Is it possible to get the information of instances of a type?
> No, this lists all the instances of a class. OP asked for the classes > of which a given type is an instace. > > Presumably it is possible, since Haddock does it! In the > documentation generated for a type it lists classes of which the type > is an instance. So you might want to look at how Haddock does it. I > suspect the only way is through the GHC API. ghci :info does it too. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Really impossible to reinstall `base' using cabal?
On Wednesday 26 October 2011, 22:58:46, Joachim Breitner wrote: > Hi, > > Am Mittwoch, den 26.10.2011, 13:10 +1100 schrieb Ivan Lazar Miljenovic: > > > How did you get your ghc? > > > If from your distro's package manager, you should be able to get the > > > dyn- libs from that too. > > > > Unless you distro hasn't built GHC with dynamic library support. > > Debian (and in extension, Ubuntu) builds a ghc-dynamic package > (http://packages.debian.org/sid/ghc-dynamic) on i386 and amd64, but does > not build -dyn variants of the packaged libraries. So you base and > everything that comes with ghc is covered, everything else (including > stuff like mtl) is not. But everything that doesn't come with ghc *can* be reinstalled (though one has to be careful, and it may be inconvenient), so you provide a good starting point. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Really impossible to reinstall `base' using cabal?
Hi, Am Mittwoch, den 26.10.2011, 13:10 +1100 schrieb Ivan Lazar Miljenovic: > > How did you get your ghc? > > If from your distro's package manager, you should be able to get the dyn- > > libs from that too. > > Unless you distro hasn't built GHC with dynamic library support. Debian (and in extension, Ubuntu) builds a ghc-dynamic package (http://packages.debian.org/sid/ghc-dynamic) on i386 and amd64, but does not build -dyn variants of the packaged libraries. So you base and everything that comes with ghc is covered, everything else (including stuff like mtl) is not. Greetings, Joachim -- Joachim "nomeata" Breitner m...@joachim-breitner.de | nome...@debian.org | GPG: 0x4743206C xmpp: nome...@joachim-breitner.de | http://www.joachim-breitner.de/ signature.asc Description: This is a digitally signed message part ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: Monad.Reader Issue 19
On 26 October 2011 21:17, Brent Yorgey wrote: > I am pleased to announce that Issue 19 of The Monad.Reader, a special > issue on parallelism and concurrency, is now available: Thanks, I always really enjoy The Monad.Reader. > Issue 19 consists of the following three articles: > > * Mighttpd – a High Performance Web Server in Haskell > by Kazu Yamamoto Kazu, really interesting article! I have one question regarding your use of atomicModifyIORef: x <- atomicModifyIORef ref (\_ -> (tmstr, ())) x `seq` return () Can't you write that as just: writeIORef ref tmstr? If you're not using the previous value of the IORef there's no chance of inconsistency. I looked in the git repository of mighttpd2 and it seems that in the FileCache module we can make a similar change by rewriting: remover :: IORef Cache -> IO () remover ref = do threadDelay 1000 _ <- atomicModifyIORef ref (\_ -> (M.empty, ())) remover ref to: remover :: IORef Cache -> IO () remover ref = forever $ do threadDelay 1000 writeIORef ref M.empty Regards, Bas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: Monad.Reader Issue 19
I am pleased to announce that Issue 19 of The Monad.Reader, a special issue on parallelism and concurrency, is now available: http://themonadreader.files.wordpress.com/2011/10/issue19.pdf Issue 19 consists of the following three articles: * Mighttpd – a High Performance Web Server in Haskell by Kazu Yamamoto * High Performance Haskell with MPI by Bernie Pope and Dmitry Astapov * Coroutine Pipelines by Mario Blažević Feel free to browse the source files. You can check out the entire repository using darcs: darcs get http://code.haskell.org/~byorgey/TMR/Issue19 If you’d like to write something for Issue 20, please get in touch. The deadline will likely be in December; more details will be forthcoming. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is it possible to get the information of instances of a type?
On Wed, Oct 26, 2011 at 09:10:23PM +0400, MigMit wrote: > Can't be done. Even if this particular module doesn't contain > "instance Class Type", it's quite possible that the said instance > would be defined in another module, about which this one knows > nothing about. That doesn't mean it can't be done, only that you would have to be explicit about which modules to look in. -Brent ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is it possible to get the information of instances of a type?
On Wed, Oct 26, 2011 at 09:15:41AM -0700, Nathan Howell wrote: > On Wed, Oct 26, 2011 at 6:53 AM, Magicloud Magiclouds < > magicloud.magiclo...@gmail.com> wrote: > > > But in Haskell, could I write a code to list the classes that a type > > instanced? > > TemplateHaskell as well. > > > > It's possible with TemplateHaskell. Look at classInstances and the ClassI > data constructor. > > http://haskell.org/ghc/docs/7.0.4/html/libraries/template-haskell-2.5.0.0/Language-Haskell-TH.html#v:classInstances No, this lists all the instances of a class. OP asked for the classes of which a given type is an instace. Presumably it is possible, since Haddock does it! In the documentation generated for a type it lists classes of which the type is an instance. So you might want to look at how Haddock does it. I suspect the only way is through the GHC API. -Brent ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is it possible to get the information of instances of a type?
Can't be done. Even if this particular module doesn't contain "instance Class Type", it's quite possible that the said instance would be defined in another module, about which this one knows nothing about. On the other hand, what would you do with that information? Отправлено с iPad 26.10.2011, в 17:53, Magicloud Magiclouds написал(а): > Hi, > If this was in ruby or other languages that support reflection, it > won't be a question. > But in Haskell, could I write a code to list the classes that a type > instanced? > TemplateHaskell as well. > -- > 竹密岂妨流水过 > 山高哪阻野云飞 > > ___ > Haskell-Cafe mailing list > 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] Is it possible to get the information of instances of a type?
On Wed, Oct 26, 2011 at 6:53 AM, Magicloud Magiclouds < magicloud.magiclo...@gmail.com> wrote: > But in Haskell, could I write a code to list the classes that a type > instanced? > TemplateHaskell as well. > It's possible with TemplateHaskell. Look at classInstances and the ClassI data constructor. http://haskell.org/ghc/docs/7.0.4/html/libraries/template-haskell-2.5.0.0/Language-Haskell-TH.html#v:classInstances ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is it possible to get the information of instances of a type?
Magicloud Magiclouds wrote: > If this was in ruby or other languages that support reflection, it > won't be a question. > But in Haskell, could I write a code to list the classes that a type > instanced? In regular Haskell, type information is completely lost after compilation, so you can't recover any of that. There is no run-time type information like in languages with OO inheritance. However, types can choose to provide type information through the Typeable type class (Data.Typeable). Generally you wouldn't want to use it, if you write Haskell properly (i.e. if you don't try to write Ruby in Haskell). > TemplateHaskell as well. I'm not sure about that one. Greets, Ertugrul -- nightmare = unsafePerformIO (getWrongWife >>= sex) http://ertes.de/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Is it possible to get the information of instances of a type?
Hi, If this was in ruby or other languages that support reflection, it won't be a question. But in Haskell, could I write a code to list the classes that a type instanced? TemplateHaskell as well. -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Operator precedence and associativity with Polyparse
Am 26.10.2011 01:49, schrieb Tom Hawkins: Can someone provide guidance on how handle operator precedence and associativity with Polyparse? Do you mean parsing something like "1 + 2 * 3" ? I don't think there's any real difference in using Polyparse vs Parsec for this, except for doing "p `orElse` q" rather than "try p<|> q". Actually, I was looking for something equivalent to Text.ParserCombinators.Parsec.Expr.buildExpressionParser. I suppose I should learn how Parsec implements this under the hood. I would do it as described under chainl1 in http://hackage.haskell.org/packages/archive/parsec2/1.0.0/doc/html/Text-ParserCombinators-Parsec-Combinator.html I believe Parsec.Expr cannot handle a prefix operator (i.e. unary minus) properly, that has lower precedence than an infix operator (i.e. "^" power). If it can parse "-x^2" as "-(x^2)" then if cannot parse "x^ -2" as "x^(-2)". Cheers Christian -Tom ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Reminder Munich Haskell
Hi all, this evening, Haskeller meet at Cafe Puck at 19h30: www.haskell-munich.de See you, Heinrich -- -- hoerde...@funktional.info www.funktional.info -- ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Open CV or alternate image processing library for Haskell on windows?
Hi, Sorry for reopening an old thread (May 2011), but I just want to report that I'm using HOpenCV and cv-combinators under windows and I just wanted to tell you that it works just fine. I downloaded the opencv2 libraries as stated on this thread, and I'm successfully building software that works both on Windows (XP and 7, both x86) and Linux (x86 & amd64). The software will be released in a few days, if everything goes well. You'll be able to find it at keera.es, but I'll let you know when I release it anyway. Cheers, Ivan Perez. PS. I just re-subscribed to this mailing list. I can't reply to the old messages (don't have them), and I can't set the old Message-ID with gmail, so I'm providing a link to the original message. [1] http://www.mail-archive.com/haskell-cafe@haskell.org/msg89834.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe