Re: [Haskell-cafe] Existential question

2011-08-17 Thread oleg
> -- Is there a way to make this one work also? > data Kl i o = forall s. Kl (i -> s -> (s, o)) > iso :: (i -> Kl () o) -> Kl i o > iso f = Kl $ \i s -> (\(Kl kl) -> kl () s) (f i) Yes, if you move the quantifier: type Kl i o = i -> Kl1 o data Kl1 o = forall s. Kl1 (s -> (s,o)) iso :: (i -> Kl (

[Haskell-cafe] FFI question - FunPtrs to top-level functions

2011-08-17 Thread Antoine Latter
Hi Haskell, I have a question about the Haskell FFI and creating FunPtrs to Haskell functions. Does anyone have any recommendations for when I have a top-level function that I would like to pass to a C function as a function pointer (that is called via a foreign import)? I know that the FFI prov

[Haskell-cafe] Haskell Weekly News: Issue 195

2011-08-17 Thread Daniel Santa Cruz
Welcome to issue 195 of the HWN, a newsletter covering developments in the Haskell community. This release covers the week of August 7 to 13, 2011. [1] http://goo.gl/8hDku You can find a HTML rendition of this newsletter at: http://contemplatecode.blogspot.com/2011/08/haskell-we

[Haskell-cafe] Existential question

2011-08-17 Thread Tom Schouten
{-# LANGUAGE ExistentialQuantification #-} -- Dear Cafe, this one works. data Kl' s i o = Kl' (i -> s -> (s, o)) iso' :: (i -> Kl' s () o) -> Kl' s i o iso' f = Kl' $ \i s -> (\(Kl' kl') -> kl' () s) (f i) -- Is there a way to make this one work also? data Kl i o = forall s. Kl (i -> s -> (s, o)

Re: [Haskell-cafe] writing a good Setup.hs is *hard* (was: broken on install encoding 0.6.6)

2011-08-17 Thread Antoine Latter
On Wed, Aug 17, 2011 at 9:11 AM, Rogan Creswick wrote: > On Wed, Aug 17, 2011 at 6:29 AM, Gang wrote: >> >> sorry to bother >> > > Not in the least! > > I was trying to figure out what problem you were encountering, and I > learned a lot.  I never did recreate your problem, but in the process > I

Re: [Haskell-cafe] why is Random in System?

2011-08-17 Thread Bryan O'Sullivan
On Wed, Aug 17, 2011 at 12:27 PM, Ryan Newton wrote: > The more fundamental problem is that splitting is neither well understood >> nor generally safe, and as such it should not be in the basic Random class. >> > > Would you mind elaborating? > Certainly. The purpose of splitting a PRNG is to cr

Re: [Haskell-cafe] why is Random in System?

2011-08-17 Thread Ryan Newton
> > The more fundamental problem is that splitting is neither well understood > nor generally safe, and as such it should not be in the basic Random class. > Would you mind elaborating? Splitting was not well-understood by the original authors of System.Random; that much is in the comments. Nor

Re: [Haskell-cafe] writing a good Setup.hs is *hard* (was: broken on install encoding 0.6.6)

2011-08-17 Thread Antoine Latter
Ccing cabal-dev. On Aug 17, 2011 9:12 AM, "Rogan Creswick" wrote: > > On Wed, Aug 17, 2011 at 6:29 AM, Gang wrote: > > > > sorry to bother > > > > Not in the least! > > I was trying to figure out what problem you were encountering, and I > learned a lot. I never did recreate your problem, but i

Re: [Haskell-cafe] Overloading in a sub-class

2011-08-17 Thread Albert Y. C. Lai
On 11-08-17 12:10 PM, Patrick Browne wrote: -- Are + and negate part of the signature of Numb1? class Numb0 a => Numb1 a where No. -- Is it possible to override these operations in instances of Numb1? -- Something like: -- instance Numb1 Float where --x + y = y --negate x = x No

Re: [Haskell-cafe] why is Random in System?

2011-08-17 Thread Bryan O'Sullivan
On Wed, Aug 17, 2011 at 11:10 AM, Ryan Newton wrote: > The problem with Mersenne twister is that it doesn't split well. The main > reason for crypto prng in this package would not be to advertise to people > that "System.Random can be used for security-related apps" *but to make > splitting reas

Re: [Haskell-cafe] why is Random in System?

2011-08-17 Thread Ryan Newton
The problem with Mersenne twister is that it doesn't split well. The main reason for crypto prng in this package would not be to advertise to people that "System.Random can be used for security-related apps" *but to make splitting reasonably safe*. It's not good enough to have a known-bad generat

[Haskell-cafe] Compilation error in Chapter 5 of "Real World Haskell"

2011-08-17 Thread Paul Reiners
I'm trying to do the following from Chapter 5 of "Real World Haskell": Our choice of naming for the source file and function is deliberate. To create an executable, *ghc* expects a module named Main that contains a function named main. The main function is the one that will be called when we run t

Re: [Haskell-cafe] ANNOUNCE: TKYProf

2011-08-17 Thread Michael Snoyman
I'm not sure I understand the comments there. Does this solve the issue for GHC 7.2 only, or for 7.* as well? Yesod is still officially supporting 6.12 and 7.0. On Wed, Aug 17, 2011 at 11:17 AM, Bas van Dijk wrote: > On 17 August 2011 07:16, Michael Snoyman wrote: >> There's a bug in GHC that pr

Re: [Haskell-cafe] why is Random in System?

2011-08-17 Thread Bryan O'Sullivan
On Wed, Aug 17, 2011 at 8:56 AM, Ryan Newton wrote: > > I'm the maintainer of random. If people could decide on what the > alternative name would be we could put it through the library proposal > process. It seems that one problem at this moment is the lack of a single, > clear "right" answer.

Re: [Haskell-cafe] why is Random in System?

2011-08-17 Thread Ertugrul Soeylemez
Ryan Newton wrote: > I'm the maintainer of random. If people could decide on what the > alternative name would be we could put it through the library proposal > process. It seems that one problem at this moment is the lack of a > single, clear "right" answer. Replacing one debatable not-quite-

[Haskell-cafe] Overloading in a sub-class

2011-08-17 Thread Patrick Browne
Hi, Below are two questions concerning overloading in a sub-class. Thanks, Pat class Numb0 a where (+) :: a -> a -> a negate :: a -> a instance Numb0 Int where x + y = y negate x = x -- Are + and negate part of the signature of Numb1? class Numb0 a => Numb1 a where -- Is it possible to

Re: [Haskell-cafe] why is Random in System?

2011-08-17 Thread Ryan Newton
Hi all, I'm the maintainer of random. If people could decide on what the alternative name would be we could put it through the library proposal process. It seems that one problem at this moment is the lack of a single, clear "right" answer. Replacing one debatable not-quite-right choice with an

Re: [Haskell-cafe] Haskell transformation of C code

2011-08-17 Thread mukesh tiwari
Thank you for your reply. On Aug 17, 7:48 pm, Ryan Yates wrote: > I had to stare at this for a while to see the difference.  In the C++ > version the comparison's in loop B and loop C are always between areas > of triangles that are off by one in a single index.  In the haskell > calArea though,

[Haskell-cafe] ICFP Hotel Roommate

2011-08-17 Thread Daniel Winograd-Cort
Hi, I'll be heading to ICFP in September, and I'm hoping to find someone to share a room with to save on hotel costs. Are there any other students looking for a roommate? Cheers, Dan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.has

Re: [Haskell-cafe] Haskell transformation of C code

2011-08-17 Thread Ryan Yates
I had to stare at this for a while to see the difference. In the C++ version the comparison's in loop B and loop C are always between areas of triangles that are off by one in a single index. In the haskell calArea though, comparisons are between the passed area and triangles off by one from the

[Haskell-cafe] writing a good Setup.hs is *hard* (was: broken on install encoding 0.6.6)

2011-08-17 Thread Rogan Creswick
On Wed, Aug 17, 2011 at 6:29 AM, Gang wrote: > > sorry to bother > Not in the least! I was trying to figure out what problem you were encountering, and I learned a lot. I never did recreate your problem, but in the process I ran into a whole host of other annoyances and strange situations relat

Re: [Haskell-cafe] broken on install encoding 0.6.6

2011-08-17 Thread Gang
Solved. Under my ghc6.12.3 environment, I manually downloaded and installed the encoding-0.6.3 package together with mtl-1.1.0.2, and pin HaXml to 1.19 , Modify the dependence rules of mtl to mtl <2 HaXml>=1.19 to HaXml=1.19 Then runhaskell Setup configure --flags=splitBase --flags=newGHC --u

[Haskell-cafe] Haskell transformation of C code

2011-08-17 Thread mukesh tiwari
Hello all I am trying implement this algorithm [ http://stackoverflow.com/questions/1621364/how-to-find-largest-triangle-in-convex-hull-aside-from-brute-force-search ] in Haskell but i am getting wrong answer for some test cases. A c++ implementation which is accepted for this problem [ http://ww

[Haskell-cafe] broken on install encoding 0.6.6

2011-08-17 Thread Gang Yu
hi, cafe: I go through to the encoding package installation problem again. cabal install encoding Resolving dependencies... /tmp/encoding-0.6.68093/encoding-0.6.6/dist/setup/setup: 4: Syntax error: ";" unexpected when I have a check on the this issue, I get: file ~/.cabal/packages/ hackage

Re: [Haskell-cafe] why is Random in System?

2011-08-17 Thread Ertugrul Soeylemez
Brandon Allbery wrote: > > > I've noticed there's a convention to put modules having to deal > > > with randomness into System.Random. I thought System was for OS > > > interaction? Granted getting a random seed usually means going to > > > the OS, but isn't the rest of it, like generating rand

Re: [Haskell-cafe] ANNOUNCE: TKYProf

2011-08-17 Thread Bas van Dijk
On 17 August 2011 07:16, Michael Snoyman wrote: > There's a bug in GHC that prevents C++ code from working correctly with > Template Haskell For reference this is the bug Michael is talking about: http://hackage.haskell.org/trac/ghc/ticket/5289 As explained by Sebastian and the ticket, to work

Re: [Haskell-cafe] ANNOUNCE: TKYProf

2011-08-17 Thread Brandon Allbery
On Wed, Aug 17, 2011 at 00:31, Sebastian Fischer wrote: > Additionally, I linked /usr/lib/libstdc++.so.6 to /usr/lib/libstdc++.so >> before I could successfully install tkyprof. Not sure about the >> consequences.. > > This means you didn't install your distribution's libstdc++-dev (or whatever i