Re: [Haskell-cafe] type error

2008-12-11 Thread Jason Dusek
You can disable the monomorphism restriction in your .ghci so it needn't trouble your interactive sessions further. My .ghci follows my signature. -- _jsn :set -XOverlappingInstances :set -XNoMonomorphismRestriction :set -XUnicodeSyntax :set -XArrows :set -Wall :set

[Haskell-cafe] Re: Haskell-Cafe Digest, Vol 64, Issue 17

2008-12-11 Thread Artyom Shalkhakov
Hello, 2008/12/10 Ben [EMAIL PROTECTED]: do you have any plans for iteratee based IO? I would like to use it in XHB (X Haskell Bindings). We use ByteStrings ATM, but I find the code hard to read. have you seen takusen? Actually, I only took a glance or two. Regards, Artyom Shalkhakov.

Re: [Haskell-cafe] Haskell project proposals reddit

2008-12-11 Thread Ketil Malde
Jason Dusek [EMAIL PROTECTED] writes: I think you are overlooking the Web 2.0 aspect of this. I've been wondering what reddit brings to the table that makes it worth keeping track of yet another web site, registering yet another user account, learning yet another interface. Assuming you're

Re: [Haskell-cafe] Problem with haddock 2.3.0 (again)

2008-12-11 Thread Sean Leather
Suppose that I wanted to generate documentation for everything in my Cabal package except for the modules with Template Haskell in them. Is it enough to add {-# OPTIONS_HADDOCK hide #-} to each of these modules? I tried, but it didn't pan out like I hoped. I'm still getting the same

Re: [Haskell-cafe] Projects that depend on the vty package?

2008-12-11 Thread Magnus Therning
On Wed, Dec 3, 2008 at 7:57 PM, Corey O'Connor [EMAIL PROTECTED] wrote: Hello, For further development of the vty package I'm really only paying attention to the requirements that fall out of the Yi project. Are there any other projects that depend on the vty package? In addition, the vty

Re: [Haskell-cafe] Problem with haddock 2.3.0 (again)

2008-12-11 Thread Duncan Coutts
On Thu, 2008-12-11 at 11:29 +0100, Sean Leather wrote: Now, I'm trying to use #ifndef __HADDOCK__ / #endif around those same modules, and I'm still running into the same internal Haddock error: haddock: internal Haddock or GHC error: Maybe.fromJust: Nothing I've been using cabal haddock

Re: [Haskell-cafe] Retrospective on 2008?

2008-12-11 Thread Henk-Jan van Tuyl
On Thu, 11 Dec 2008 06:35:24 +0100, Don Stewart [EMAIL PROTECTED] wrote: * Hackage currently holds 914 applications and libraries. Using the commands: cabal update cabal list | fgrep * | wc I counted 927 entries. -- Regards, Henk-Jan van Tuyl -- http://functor.bamikanarie.com

Re: [Haskell-cafe] Retrospective on 2008?

2008-12-11 Thread Dougal Stanton
On Thu, Dec 11, 2008 at 1:00 PM, Henk-Jan van Tuyl [EMAIL PROTECTED] wrote: Using the commands: cabal update cabal list | fgrep * | wc I counted 927 entries. Unfortunately that's not a reliable means of determining cabal packages. (Baffling, I know.) I think it actually lists things you

Re: [Haskell-cafe] Retrospective on 2008?

2008-12-11 Thread Duncan Coutts
On Thu, 2008-12-11 at 14:00 +0100, Henk-Jan van Tuyl wrote: On Thu, 11 Dec 2008 06:35:24 +0100, Don Stewart [EMAIL PROTECTED] wrote: * Hackage currently holds 914 applications and libraries. Using the commands: cabal update cabal list | fgrep * | wc I counted 927 entries.

Re: [Haskell-cafe] Retrospective on 2008?

2008-12-11 Thread Duncan Coutts
On Thu, 2008-12-11 at 13:13 +, Dougal Stanton wrote: On Thu, Dec 11, 2008 at 1:00 PM, Henk-Jan van Tuyl [EMAIL PROTECTED] wrote: Using the commands: cabal update cabal list | fgrep * | wc I counted 927 entries. Unfortunately that's not a reliable means of determining cabal

Re: [Haskell-cafe] Retrospective on 2008?

2008-12-11 Thread Henk-Jan van Tuyl
On Thu, 11 Dec 2008 14:13:00 +0100, Dougal Stanton [EMAIL PROTECTED] wrote: On Thu, Dec 11, 2008 at 1:00 PM, Henk-Jan van Tuyl [EMAIL PROTECTED] wrote: Using the commands: cabal update cabal list | fgrep * | wc I counted 927 entries. Unfortunately that's not a reliable means of

[Haskell-cafe] Multi-parameter Type Class

2008-12-11 Thread Paul Keir
Hi all, I've been trying to refactor my tree conversion code to make better use of type classes; and I've discovered multi-parameter type classes and functional dependencies. I have a class with a function a2b, and I'd like map to be used when it's a list of type a. I've created a simple failing

Re: [Haskell-cafe] Multi-parameter Type Class

2008-12-11 Thread Lennart Augustsson
Since your map function is calling zot to convert an x to a y you must state that this is possible: instance ZOT x y = ZOT [x] [y] where zot xs = map zot xs -- Lennart 2008/12/11 Paul Keir [EMAIL PROTECTED]: Hi all, I've been trying to refactor my tree conversion code to make better use

[Haskell-cafe] Re: how to pipe in pure input with HSH? (Would be helpful for sending emails via sendmail/mailx via HSH interface)

2008-12-11 Thread John Goerzen
Thomas Hartman wrote: {- I am trying to figure out a way to send email using HSH and I'm stumped. The problem is that there is no ShellCommand instance for a pure vanilla string, which can be piped into another ShellCommand. There is a ShellCommand String instance, but the string is a

[Haskell-cafe] Re: Can my type be allowed as return type in FFI?

2008-12-11 Thread Mauricio
This would solve half my problem. Can I always trust that? I've been told before that everytime a C function returns a struct it is actually returning a pointer, but I wasn't able to find that written in stone That's because it isn't true. In fact one of the classical ways for a C

Re: [Haskell-cafe] Problem with haddock 2.3.0 (again)

2008-12-11 Thread Sean Leather
Now, I'm trying to use #ifndef __HADDOCK__ / #endif around those same modules, and I'm still running into the same internal Haddock error: haddock: internal Haddock or GHC error: Maybe.fromJust: Nothing I've been using cabal haddock to run haddock on my package. I also get the same

Re: [Haskell-cafe] Re: Can my type be allowed as return type in FFI?

2008-12-11 Thread Brandon S. Allbery KF8NH
On 2008 Dec 11, at 10:28, Mauricio wrote: and obviously a C compiler is entitled to return a small struct in registers if it feels like it. If a compiler is compiling code that calls a library, how is it supposed to know if a return pointer is been passed as a register or by using a pointer?

[Haskell-cafe] Re: Can my type be allowed as return type in FFI?

2008-12-11 Thread Mauricio
Sorry, I'm not talking about how C implements passing structures to functions. The Haskell FFI can only bind functions that pass structures by pointer, not by value. So if you've got a C function that passes them by value then you need to write a wrapper function in C and bind to that. This

RE: [Haskell-cafe] Multi-parameter Type Class[MESSAGE NOT SCANNED]

2008-12-11 Thread Paul Keir
I took your suggestion and it worked exactly as I had hoped. Thankyou. GHCI (6.8.2) was though a little concerned, and told me I had an: Illegal instance declaration for `ZOT [x] [y]' and recommended I use -fallow-undecidable-instances. I did, and it worked. What have I done though? The word

RE: [Haskell-cafe] Multi-parameter Type Class[MESSAGE NOT SCANNED]

2008-12-11 Thread Paul Keir
Thanks to you both, that also looks fantastic. I'll print it out; put it under my pillow; let it brew overnight and then push in tomorrow ;) -Original Message- From: Thomas DuBuisson [mailto:[EMAIL PROTECTED] Sent: Thu 11/12/2008 15:30 To: Paul Keir Cc: haskell-cafe@haskell.org Subject:

Re: [Haskell-cafe] Multi-parameter Type Class

2008-12-11 Thread Thomas DuBuisson
I see Lennart answered your question. For more fun you could also do this with TypeFamilies, which are the new hot thing in Haskell type level logic. Since you are just getting into MPTC, FunDeps etc I figured you'd be interested. -- START CODE -- {-# LANGUAGE MultiParamTypeClasses,

Re: [Haskell-cafe] Multi-parameter Type Class[MESSAGE NOT SCANNED]

2008-12-11 Thread Daniel Fischer
Am Donnerstag, 11. Dezember 2008 16:52 schrieb Paul Keir: I took your suggestion and it worked exactly as I had hoped. Thankyou. GHCI (6.8.2) was though a little concerned, and told me I had an: Illegal instance declaration for `ZOT [x] [y]' and recommended I use

Re: [Haskell-cafe] Problem with haddock 2.3.0 (again)

2008-12-11 Thread Duncan Coutts
On Thu, 2008-12-11 at 16:26 +0100, Sean Leather wrote: The above is true, but then I ran it with --optghc=-D__HADDOCK__ and that fixed the problem. You see, I didn't know who was actually defining the __HADDOCK__ macro. Now, after looking at code for Haddock and Cabal, I realize it's Cabal.

Re: [Haskell-cafe] Problem with haddock 2.3.0 (again)

2008-12-11 Thread Sean Leather
For haddock-0.x, Cabal cpp's all the modules with -D__HADDOCK__ because the old haddock cannot parse all sorts of things. However for haddock-2.x it is important not to use -D__HADDOCK__ because the hacks that people added for haddock-0.x would make haddock-2.x fail. For example they'd

Re: [Haskell-cafe] type error

2008-12-11 Thread Ryan Ingram
The other simple option is to eta-expand: let myprint x = print x will get the correct type, The monomorphism restriction is to stop things that look like *values* whose computation results are memoized, from turning into *functions* which need a dictionary context and get recomputed every time

[Haskell-cafe] A curios monad

2008-12-11 Thread Andrew Coppin
Yesterday I wrote something slightly unusual: module Storage where data Storage x instance Monad Storage run :: Storage x - x data Key v instance Eq (Key v) instance Ord (Key v) new_key :: v - Storage (Key v) set_key :: Key v - v - Storage () get_key :: Key v - Storage (Maybe v) delete_key

Re: [Haskell-cafe] A curios monad

2008-12-11 Thread Andrew Coppin
Ryan Ingram wrote: Congratulations, you're halfway to reinventing ST! :) Except that, AFAIK, ST doesn't provide the hey you can store anything and retrieve it later trick. ;-) I did however wonder if there wasn't some way I could use an extra phantom type to somehow tag which thread a

Re: [Haskell-cafe] A curios monad

2008-12-11 Thread Andrew Coppin
Alberto G. Corona wrote: it is safe to use unsafeCoherce in your context? I mean, I think you need to use instances of Data.Typeable (or some with the same functionality) to make it safe. Like in Data.Dynamic... The *only* way for you to generate a Key value is to use the function I provide

[Haskell-cafe] Memoization-question

2008-12-11 Thread Mattias Bengtsson
The program below computes (f 27) almost instantly but if i replace the definition of (f n) below with (f n = f (n - 1) * f (n -1)) then it takes around 12s to terminate. I realize this is because the original version caches results and only has to calculate, for example, (f 25) once instead of (i

Re: [Haskell-cafe] Memoization-question

2008-12-11 Thread Donnie Jones
Hello Mattias, I think you will find this thread from the haskell-cafe mailing list quite helpful. Re: [Haskell-cafe] Memoization http://www.mail-archive.com/haskell-cafe@haskell.org/msg09924.html Also, the Haskell wiki contains comments about techniques for memoization along with references

Re: [Haskell-cafe] A curios monad

2008-12-11 Thread Tillmann Rendel
Andrew Coppin wrote: Except that, AFAIK, ST doesn't provide the hey you can store anything and retrieve it later trick. ;-) I would say that Data.STRef does exactly that. Tillmann ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Memoization-question

2008-12-11 Thread Daniel Fischer
Am Donnerstag, 11. Dezember 2008 16:18 schrieb Mattias Bengtsson: The program below computes (f 27) almost instantly but if i replace the definition of (f n) below with (f n = f (n - 1) * f (n -1)) then it takes around 12s to terminate. I realize this is because the original version caches

Re[2]: [Haskell-cafe] Memoization-question

2008-12-11 Thread Bulat Ziganshin
Hello Daniel, Thursday, December 11, 2008, 11:09:46 PM, you wrote: you is almost right. but ghc don't share results of function calls despite their type. it just assumes that value of any type may use a lot of memory even if this type is trivial :) example when automatic sharing is very bad

[Haskell-cafe] problems configuring hs-plugins 1.3.1 in windows

2008-12-11 Thread Alberto G. Corona
I have problems compiling plugins 1.3.1 in windows at the configure phase configure: error C compiler cannot create executables I use ghc 6.8.2 I know that plugins is nor much tested under windows but I´m trying anyway. I think that this problem is very common also in Linux. I tried to find

[Haskell-cafe] Re: problems with hs-plugins load-eval (possible bug)

2008-12-11 Thread Alberto G. Corona
Workaround: duplicate all the imported files and include a different copy in each side. Another workaround: package all the files imported in both sides. Surprisingly, duplicate references do not appear when the imported files are in a package. PD: plugins adds 18 MBytes!! to the size of the

Re: [Haskell-cafe] Memoization-question

2008-12-11 Thread Daniel Fischer
Am Donnerstag, 11. Dezember 2008 21:11 schrieb Bulat Ziganshin: Hello Daniel, Thursday, December 11, 2008, 11:09:46 PM, you wrote: you is almost right. but ghc don't share results of function calls despite their type. it just assumes that value of any type may use a lot of memory even if

Re: [Haskell-cafe] A curios monad

2008-12-11 Thread Lennart Augustsson
What ST doesn't provide is a delete operation, otherwise it the rest (but in a safe way). On Thu, Dec 11, 2008 at 9:04 PM, Tillmann Rendel ren...@daimi.au.dk wrote: Andrew Coppin wrote: Except that, AFAIK, ST doesn't provide the hey you can store anything and retrieve it later trick. ;-) I

Re[2]: [Haskell-cafe] Memoization-question

2008-12-11 Thread Bulat Ziganshin
Hello Daniel, Thursday, December 11, 2008, 11:49:40 PM, you wrote: sorry fo r noise, it seems that i know ghc worse than you Am Donnerstag, 11. Dezember 2008 21:11 schrieb Bulat Ziganshin: Hello Daniel, Thursday, December 11, 2008, 11:09:46 PM, you wrote: you is almost right. but ghc

[Haskell-cafe] Records and associated types

2008-12-11 Thread Taru Karttunen
Hello What is the correct way to transform code that uses record selection with TypeEq (like HList) to associated types? I keep running into problems with overlapping type families which is not allowed unless they match. The fundep code: class Select rec label val | rec label - val instance

Re: [Haskell-cafe] A curios monad

2008-12-11 Thread Andrew Coppin
Tillmann Rendel wrote: Andrew Coppin wrote: Except that, AFAIK, ST doesn't provide the hey you can store anything and retrieve it later trick. ;-) I would say that Data.STRef does exactly that. That's true - but you can't transport those from place to play. (By design.) The reason I went

Re: [Haskell-cafe] Memoization-question

2008-12-11 Thread Daniel Fischer
Am Donnerstag, 11. Dezember 2008 21:56 schrieb Bulat Ziganshin: Hello Daniel, Thursday, December 11, 2008, 11:49:40 PM, you wrote: sorry for noise, it seems that i know ghc worse than you If only that were true. I just know that GHC's optimiser can do some rather impressive stuff when given

Re: [Haskell-cafe] A curios monad

2008-12-11 Thread Andrew Coppin
Alberto G. Corona wrote: but because keys and data must be of the same type, you are restricted to instances of Eq and Ord. Itsn´n true? 2008/12/11 Andrew Coppin andrewcop...@btinternet.com mailto:andrewcop...@btinternet.com Alberto G. Corona wrote: Well, you have not to use

[Haskell-cafe] unsafeThawByteArray#

2008-12-11 Thread Patrick Perry
I've noticed that there is no longer an unsafeThawByteArray# function in GHC.Prim. Looking through the darcs history, I found a patch with description: [project @ 2000-03-13 12:11:43 by simonmar] simonmar**2313121144 Remove unsafeThawByteArray# primop (which was a no-op), and use

Re: [Haskell-cafe] Problem with haddock 2.3.0 (again)

2008-12-11 Thread Duncan Coutts
On Thu, 2008-12-11 at 18:20 +0100, Sean Leather wrote: For haddock-0.x, Cabal cpp's all the modules with -D__HADDOCK__ because the old haddock cannot parse all sorts of things. However for haddock-2.x it is important not to use -D__HADDOCK__

Re: [Haskell-cafe] Problem with haddock 2.3.0 (again)

2008-12-11 Thread Sean Leather
That's quite a presumption there. I can certainly write a module that compiles and produces documentation for Haddock but that is different when compiled into binary form. Even without this particular problem, I can see that being potentially useful. Sure, but it'd have to be a different

Re: [Haskell-cafe] Problem with haddock 2.3.0 (again)

2008-12-11 Thread Ross Paterson
On Thu, Dec 11, 2008 at 06:20:11PM +0100, Sean Leather wrote: Also, regarding transparency with Hackage: is it possible to determine exactly which tools (e.g. Haddock version) are being used on the server? You can see which versions are used in the log of any failed build. The docs aren't

Re: [Haskell-cafe] Problem with haddock 2.3.0 (again)

2008-12-11 Thread Duncan Coutts
On Thu, 2008-12-11 at 23:32 +0100, Sean Leather wrote: That's quite a presumption there. I can certainly write a module that compiles and produces documentation for Haddock but that is different when compiled into binary form. Even without this

Re: [Haskell-cafe] Problem with haddock 2.3.0 (again)

2008-12-11 Thread Sean Leather
I would be happy to work around it if I could, but I can't. As far as I can tell, I can't pass any flags to Haddock via the Cabal file. I would love to tell Hackage to run Haddock like so, cabal haddock --haddock-option=--optghc=-D__HADDOCK__, but I don't know how. Let's suppose that I do

Re: [Haskell-cafe] A curios monad

2008-12-11 Thread Luke Palmer
On Thu, Dec 11, 2008 at 2:05 PM, Andrew Coppin andrewcop...@btinternet.comwrote: Tillmann Rendel wrote: Andrew Coppin wrote: Except that, AFAIK, ST doesn't provide the hey you can store anything and retrieve it later trick. ;-) I would say that Data.STRef does exactly that. That's

Re: [Haskell-cafe] Problem with haddock 2.3.0 (again)

2008-12-11 Thread Claus Reinke
Let's see what David thinks. If he thinks is possible to fix these kinds of things where haddock is not covering the whole GHC AST (at least to the degree where it can ignore bits it does not understand). If that's not realistic in the short term then we probably should introduce some haddock

Re: [Haskell-cafe] Problem with haddock 2.3.0 (again)

2008-12-11 Thread Duncan Coutts
On Fri, 2008-12-12 at 00:22 +0100, Sean Leather wrote: Let's suppose that I do actually want to define __HADDOCK__ for my library. Can I do this with a user-defined hook using the Cabal library? main :: IO () main = defaultMainWithHooks hooks where hooks = simpleUserHooks { haddockHook

Re: [Haskell-cafe] Problem with haddock 2.3.0 (again)

2008-12-11 Thread Claus Reinke
I would be happy to work around it if I could, but I can't. As far as I can tell, I can't pass any flags to Haddock via the Cabal file. I would love to tell Hackage to run Haddock like so, cabal haddock --haddock-option=--optghc=-D__HADDOCK__, but I don't know how. Let's suppose that I do

Re: [Haskell-cafe] Haskell project proposals reddit

2008-12-11 Thread Jason Dusek
It's a nice interface for collecting comments on an idea and collecting people's level of agreement -- it does those things very well. If I had a blog, I would turn off comments and put a link to reddit at the bottom and then scrape reddit for the comments :) -- _jsn

Re: [Haskell-cafe] Problem with haddock 2.3.0 (again)

2008-12-11 Thread Sean Leather
Call the original haddockHook with the updated flags rather than the haddock command. -- Define CPP __HADDOCK__ macro when running haddock. haddockHook' p l h f = do putStrLn (f=\ ++ show f ++ \) putStrLn (g=\ ++ show g ++ \) *haddockHook* simpleUserHooks p l h g where -- The

Re: [Haskell-cafe] Problem with haddock 2.3.0 (again)

2008-12-11 Thread Sean Leather
Let's suppose that I do actually want to define __HADDOCK__ for my library. Can I do this with a user-defined hook using the Cabal library? You might want to define it conditionally, depending on version. I certainly might! Cabal supports package-version macros, and haddock installs both

Re: [Haskell-cafe] Problem with haddock 2.3.0 (again)

2008-12-11 Thread Claus Reinke
Still, you might find something useful in the discussion for this ticket: Cabal should support Cabal-version-dependent Setup.hs http://hackage.haskell.org/trac/hackage/ticket/326 or, more directly: http://www.haskell.org/pipermail/cabal-devel/2008-August/003576.html so, if you add the

Re: [Haskell-cafe] Problem with haddock 2.3.0 (again)

2008-12-11 Thread Duncan Coutts
On Fri, 2008-12-12 at 00:19 +, Claus Reinke wrote: Still, you might find something useful in the discussion for this ticket: Cabal should support Cabal-version-dependent Setup.hs http://hackage.haskell.org/trac/hackage/ticket/326 or, more directly:

Re: [Haskell-cafe] Records and associated types

2008-12-11 Thread Ryan Ingram
I don't think you can get a type equality comparison test into type families without additional compiler support. If you are willing to restrict your labels to type-level naturals or some other closed universe, and allow undecidable instances, you can do something like this: data Z = Z data S

Re: [Haskell-cafe] Problem with haddock 2.3.0 (again)

2008-12-11 Thread Duncan Coutts
On Fri, 2008-12-12 at 01:01 +0100, Sean Leather wrote: Call the original haddockHook with the updated flags rather than the haddock command. No change in output. Ah, sorry I misread the code. This works: import Distribution.Simple import

Re: [Haskell-cafe] Problem with haddock 2.3.0 (again)

2008-12-11 Thread Duncan Coutts
On Fri, 2008-12-12 at 01:01 +, Duncan Coutts wrote: On Fri, 2008-12-12 at 01:01 +0100, Sean Leather wrote: Call the original haddockHook with the updated flags rather than the haddock command. No change in output. Ah, sorry I misread the code. This

[Haskell-cafe] GHC 6.10.1 for Solaris i86

2008-12-11 Thread Donald Halomoan
I am waiting for GHC 6.10. 1 binary for Solaris i86. Thanks. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Re: problems with hs-plugins load-eval (possible bug)

2008-12-11 Thread Gwern Branwen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 2008/12/11 Alberto G. Corona : Workaround: duplicate all the imported files and include a different copy in each side. Another workaround: package all the files imported in both sides. Surprisingly, duplicate references do not appear when the

Re: [Haskell-cafe] Multi-parameter Type Class

2008-12-11 Thread Alexander Dunlap
2008/12/11 Thomas DuBuisson thomas.dubuis...@gmail.com: I see Lennart answered your question. For more fun you could also do this with TypeFamilies, which are the new hot thing in Haskell type level logic. Since you are just getting into MPTC, FunDeps etc I figured you'd be interested.