Re: [Haskell-cafe] Applicative and Monad transformers

2009-08-26 Thread Ralf Hinze
Hi Jeremy, > I have seen it said that all Monads are Applicative Functors because > you can just do: > > instance (Monad f, Applicative f) => Applicative (ReaderT r f) where > pure = return > (<*>) = ap > > However, that instance for ReaderT does not exhibit the properties I > was hoping

Re: [Haskell-cafe] Network.Socket error in MacOS 10.5?

2009-08-26 Thread kenny lu
Thanks for the pointers. I will take a look. Kenny On Thu, Aug 27, 2009 at 2:20 AM, Ross Mellgren wrote: > I don't think getNameInfo should work for for AF_UNIX -- the name given to > SockAddrUnix is a file path, there is no name resolution. From the man page > for getnameinfo(3) on OS X: > > N

Re: [Haskell-cafe] FFI link failing due to no main?

2009-08-26 Thread phil
Thanks for the reply! I think this might be a Mac OS X issue. I've stripped my rather longwinded example down to the simplest case (one Haskell source file to create a single shared library containing a single exported function) and this compiles (and ultimately runs) fine on Linux. So

[Haskell-cafe] Haskell Weekly News: Issue 128 - August 26, 2009

2009-08-26 Thread Brent Yorgey
--- Haskell Weekly News http://sequence.complete.org/hwn/20090826 Issue 128 - August 26, 2009 --- Welcome to issue 128 of HWN, a newsletter covering

[Haskell-cafe] ANN: scion 0.1

2009-08-26 Thread Thomas Schilling
Hello, I am pleased to announce the first release of Scion. Scion [1] is a Haskell library that aims to implement those parts of a Haskell IDE which are independent of a particular front-end. Scion is based on the GHC API and Cabal. It provides both a Haskell API and a server for non-Haskell c

Re: [Haskell-cafe] haddock: parse error in doc string

2009-08-26 Thread David Waern
2009/8/26 Peter Verswyvelen : > Oh, I just installed the Haskell platform. > I have > Haddock version 2.4.2, (c) Simon Marlow 2006 > Ported to use the GHC API by David Waern 2006-2008 > But I noticed that my bad comments were in the description of the cabal > file, not the source file. > So that mi

[Haskell-cafe] Re: [Hackathon] Edinburgh Meetup (Sat 29 Aug) and Hack Day (Sun 30 Aug)

2009-08-26 Thread Brent Yorgey
On Fri, Aug 14, 2009 at 05:04:00PM +0100, Eric Kow wrote: > Dear Haskellers, > > Just a quick reminder that we will be having a Hack Day in Edinburgh > on Sunday 30 August (ICFP venue). That's in two weeks! > > For the interested, we will also be meeting up the day before 09:30 > Saturday 29 Aug

Re: [Haskell-cafe] Network.Socket error in MacOS 10.5?

2009-08-26 Thread Ross Mellgren
I don't think getNameInfo should work for for AF_UNIX -- the name given to SockAddrUnix is a file path, there is no name resolution. From the man page for getnameinfo(3) on OS X: NAME getnameinfo -- socket address structure to hostname and service name ... DESCRIPTION ... The sockad

Re: [Haskell-cafe] Network.Socket error in MacOS 10.5?

2009-08-26 Thread Johan Tibell
On Wed, Aug 26, 2009 at 6:33 PM, kenny lu wrote: > Hi, > > I encountered a problem with Network.Socket in MacOS 10.5 > Here is the code that I am testing, > > - > - > module Main where > > import qualified Network.Socke

Re: [Haskell-cafe] Suggestion: define a standard keyboard codes library?

2009-08-26 Thread Peter Verswyvelen
I would already be happy with a low level library that holds the union of all keys, assigning them unique codes. So you would have keys like Apple, Amiga, Windows, Start, Popup, LeftControl, RightControl, etc... No mapping is done at the low level. Then one would need an OS dependent interface to f

Re: [Haskell-cafe] Applicative and Monad transformers

2009-08-26 Thread Edward Kmett
On Wed, Aug 26, 2009 at 12:04 PM, Martijn van Steenbergen < mart...@van.steenbergen.nl> wrote: > > Another example is parsing: I believe Doaitse's parsers allow more > optimization if they are only used in applicative style (but I'm not sure of > this). > That is correct. When you glue together P

[Haskell-cafe] Network.Socket error in MacOS 10.5?

2009-08-26 Thread kenny lu
Hi, I encountered a problem with Network.Socket in MacOS 10.5 Here is the code that I am testing, - - module Main where import qualified Network.Socket as Socket main :: IO () main = do { (hostname, _) <- Socket

Re: [Haskell-cafe] Applicative and Monad transformers

2009-08-26 Thread Martijn van Steenbergen
Jeremy Shaw wrote: What I would prefer is: instance (Monad f, Applicative f) => Applicative (ReaderT r f) where pure a = ReaderT $ const (pure a) f <*> a = ReaderT $ \r -> ((runReaderT f r) <*> (runReaderT a r)) Right. This doesn't only go for ReaderT, it already goes fo

Re: [Haskell-cafe] Applicative and Monad transformers

2009-08-26 Thread Jeremy Shaw
Attached is as slight better test example which does not rely on the 'fail' method. Doesn't really change anything significant though. {-# LANGUAGE FlexibleContexts, FlexibleInstances #-} module Main where import Control.Applicative (Applicative((<*>), pure), (<$>)) import Control.Monad (Monad((>

[Haskell-cafe] Applicative and Monad transformers

2009-08-26 Thread Jeremy Shaw
Hello, I have seen it said that all Monads are Applicative Functors because you can just do: instance (Monad f, Applicative f) => Applicative (ReaderT r f) where pure = return (<*>) = ap However, that instance for ReaderT does not exhibit the properties I was hoping for. By substitution

Re: [Haskell-cafe] How to calculate de number of digits of an integer? (was: Is logBase right?)

2009-08-26 Thread Uwe Hollerbach
Here's my version... maybe not as elegant as some, but it seems to work. For base 2 (or 2^k), it's probably possible to make this even more efficient by just walking along the integer as stored in memory, but that difference probably won't show up until at least tens of thousands of digits. Uwe i

[Haskell-cafe] Error during hlint install ?

2009-08-26 Thread Dusan Kolar
Hello all, Am I doing something wrong if I get the following error during cabal installation of hlint? Is there any way how to solve it? I run on: Linux pc 2.6.30-ARCH #1 SMP PREEMPT Fri Jul 31 07:30:28 CEST 2009 x86_64 Intel(R) Core(TM)2 Quad CPU Q9300 @ 2.50GHz GenuineIntel GNU/Linux The

Re: [Haskell-cafe] Suggestion: define a standard keyboard codes library?

2009-08-26 Thread Marc Weber
Excerpts from Peter Verswyvelen's message of Wed Aug 26 12:15:14 +0200 2009: > Maybe it would be nice to agree on a standard datatype for keys? This might > also include digital buttons on a joystick, etc... The synergy project (sourceforge) already does some mapping from Windows <-> Linux <-> Mac

Re: [Haskell-cafe] Is it possible to prove type *non*-equality in Haskell?

2009-08-26 Thread Conor McBride
Hi all Interesting stuff. Thanks for this. On 26 Aug 2009, at 03:45, Ryan Ingram wrote: Hi Dan, thanks for the great reply! Some thoughts/questions follow. On Tue, Aug 25, 2009 at 3:39 PM, Dan Doel wrote: Well, this isn't surprising; you wouldn't have it even in a more rigorous proof envir

Re: [Haskell-cafe] Suggestion: define a standard keyboard codes library?

2009-08-26 Thread Yitzchak Gale
Peter Verswyvelen wrote: >>> Several libraries define their own codes for they keyboard >>> (GLFW, GTK, GLUT, etc) >>> Maybe it would be nice to agree on a standard datatype >>> for keys? >>> ...The Windows API has virtual key codes for this. I wrote: >> X windows key symbols... >> are found in th

Re: [Haskell-cafe] How to calculate de number of digits of an integer? (was: Is logBase right?)

2009-08-26 Thread George Pollard
2009/8/26 Lennart Augustsson : > Try 10^1000 Cheat :) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] haddock: parse error in doc string

2009-08-26 Thread Peter Verswyvelen
Oh, I just installed the Haskell platform. I have Haddock version 2.4.2, (c) Simon Marlow 2006 Ported to use the GHC API by David Waern 2006-2008 But I noticed that my bad comments were in the description of the cabal file, not the source file. So that might be a new ticket? On Wed, Aug 26, 2009

Re: [Haskell-cafe] haddock: parse error in doc string

2009-08-26 Thread David Waern
2009/8/26 Peter Verswyvelen : > Ouch, with all the great Haskell parsers like Parsec around I think I was > expecting a line/column number :-) > But I see a ticket is already open for this > http://trac.haskell.org/haddock/ticket/83 Yes, and the line-number part of that ticket has been fixed in 2.

Re: [Haskell-cafe] Suggestion: define a standard keyboard codes library?

2009-08-26 Thread Peter Verswyvelen
But should we use X11 as the standard library then, even on Windows or Mac? It surely is better than nothing, but it feels a bit weird to install X11 just for using the key codes. Maybe splitting these keys into a separate package would be a good idea? On Wed, Aug 26, 2009 at 12:42 PM, Yitzchak

Re: [Haskell-cafe] Suggestion: define a standard keyboard codes library?

2009-08-26 Thread Yitzchak Gale
Peter Verswyvelen wrote: > Several libraries define their own codes for they keyboard (GLFW, GTK, GLUT, > etc) > Maybe it would be nice to agree on a standard datatype for keys? This might > also include digital buttons on a joystick, etc... > The Windows API has virtual key codes for this. X wind

[Haskell-cafe] Suggestion: define a standard keyboard codes library?

2009-08-26 Thread Peter Verswyvelen
Several libraries define their own codes for they keyboard (GLFW, GTK, GLUT, etc) Maybe it would be nice to agree on a standard datatype for keys? This might also include digital buttons on a joystick, etc... The Windows API has virtual key codes for this. _

Re: [Haskell-cafe] How to calculate de number of digits of an integer? (was: Is logBase right?)

2009-08-26 Thread Daniel Fischer
Am Mittwoch 26 August 2009 06:29:47 schrieb George Pollard: > You could also fudge the input: > > {-# LANGUAGE NoMonomorphismRestriction #-} > > log10 = floor . logBase 10 . (0.5+) . fromIntegral > > numDigits n | n < 0 = 1 + numDigits (-n) > numDigits 0 = 1 > numDigits n = 1 + log1

Re: [Haskell-cafe] haddock: parse error in doc string

2009-08-26 Thread Peter Verswyvelen
Ouch, with all the great Haskell parsers like Parsec around I think I was expecting a line/column number :-) But I see a ticket is already open for this http://trac.haskell.org/haddock/ticket/83 On Wed, Aug 26, 2009 at 2:47 AM, Gwern Branwen wrote: > On