Re: [Haskell-cafe] (+) on two lists ?

2013-02-15 Thread Raphael Gaschignard
Out of curiosity, what is the rationale for allowing programs to infer certain types, but not for the (inferred) type to be declared? On Fri, Feb 15, 2013 at 4:54 PM, David McBride toa...@gmail.com wrote: sum' [] = [] -- returns a list of something the way you intended sum' (x:xs) = x +

Re: [Haskell-cafe] (+) on two lists ?

2013-02-15 Thread Ivan Lazar Miljenovic
On 15 February 2013 19:22, Raphael Gaschignard dasur...@gmail.com wrote: Out of curiosity, what is the rationale for allowing programs to infer certain types, but not for the (inferred) type to be declared? That's the type that's needed; the fact that you need an extension for GHC to allow you

Re: [Haskell-cafe] How to quantify the overhead?

2013-02-15 Thread Simon Marechal
On 13/02/2013 23:06, Daryoush Mehrtash wrote: Suppose I have a big list of integers and I like to find the first two that add up to a number, say 10. One approach is to put the numbers in the map as I read them and each step look for the 10-x of the number before going on to the next value

[Haskell-cafe] ifdef based on which OS you're on

2013-02-15 Thread Andrew Cowie
I've got a piece of code that looks like this: baselineContextSSL :: IO SSLContext baselineContextSSL = do ctx - SSL.context SSL.contextSetDefaultCiphers ctx #if defined __MACOSX__ SSL.contextSetVerificationMode ctx SSL.VerifyNone

Re: [Haskell-cafe] ifdef based on which OS you're on

2013-02-15 Thread Artyom Kazak
Andrew Cowie and...@operationaldynamics.com писал(а) в своём письме Fri, 15 Feb 2013 17:05:13 +0300: So my question is: what's an appropriate Haskell mechanism for building code that is OS / arch / distro specific? It's not like I have autoconf running generating me a config.h I could

Re: [Haskell-cafe] ifdef based on which OS you're on

2013-02-15 Thread Krzysztof Skrzętnicki
Well, for sure you can in define that in .cabal file: if !os(windows) CC-Options: -DWINDOWS or something. See: http://www.haskell.org/cabal/users-guide/developing-packages.html#configurations On Fri, Feb 15, 2013 at 3:05 PM, Andrew Cowie and...@operationaldynamics.com wrote:

Re: [Haskell-cafe] ifdef based on which OS you're on

2013-02-15 Thread Dan Cross
On Fri, Feb 15, 2013 at 9:05 AM, Andrew Cowie and...@operationaldynamics.com wrote: I've got a piece of code that looks like this: baselineContextSSL :: IO SSLContext baselineContextSSL = do ctx - SSL.context SSL.contextSetDefaultCiphers ctx

Re: [Haskell-cafe] ifdef based on which OS you're on

2013-02-15 Thread Andrew Cowie
That's interesting. But are there standard values for those functions? I'm guessing not, seeing a how they're String and not an ADT. AfC Sydney Artyom Kazak artyom.ka...@gmail.com wrote: You can know the OS and arch without even resorting to CPP; see System.Info which defines `os` and

Re: [Haskell-cafe] (+) on two lists ?

2013-02-15 Thread brandon s allbery kf8nh
Note also that typeclasses are open, so ghc is not allowed to say that there is no instance of Num for lists there; it will happily infer a type which requires such an instance, and only when it needs to firm down to concrete types at some point will it notice that there's no such instance in

Re: [Haskell-cafe] ifdef based on which OS you're on

2013-02-15 Thread Vincent Hanquez
On 02/15/2013 02:05 PM, Andrew Cowie wrote: all very nice (this being necessary because apparently the non-free operating systems don't store their certs in a reliably discoverable place; bummer). Sorry the answer is out of topic, but this is not true. Windows certificate and macos X

[Haskell-cafe] ANN: rss2irc-1.0, announces RSS/Atom feed updates to IRC

2013-02-15 Thread Simon Michael
I'm pleased to announce a new release of rss2irc, the software behind hackagebot on #haskell. rss2irc is an IRC bot that polls an RSS or Atom feed and announces updates to an IRC channel, with options for customizing output and behavior. It aims to be an easy-to-use, reliable, well-behaved

Re: [Haskell-cafe] optimization of recursive functions

2013-02-15 Thread Andrew Polonsky
Thanks for the exhaustive answer. Andrew On Wed, Feb 13, 2013 at 2:57 PM, Alp Mestanogullari alpmes...@gmail.comwrote: If a difference appears, I believe http://blog.johantibell.com/2010/09/static-argument-transformation.htmlwould be involved. Also, the second map function could be inlined

[Haskell-cafe] tls talking to certificate stores (was Re: ...)

2013-02-15 Thread Andrew Cowie
On Fri, 2013-02-15 at 15:12 +, Vincent Hanquez wrote: Sorry the answer is out of topic That's ok. Windows certificate and macos X certificate are stored in a reliably discoverable place. That openssl provide no way to get to it is a different story and one reason to have tls. Is

Re: [Haskell-cafe] ifdef based on which OS you're on

2013-02-15 Thread Andrew Cowie
On Fri, 2013-02-15 at 15:16 +0100, Krzysztof Skrzętnicki wrote: See: http://www.haskell.org/cabal/users-guide/developing-packages.html#configurations That link says os(): Tests if the current operating system is name. The argument is tested against System.Info.os on the target

[Haskell-cafe] Netwire, keyboard events, and games

2013-02-15 Thread Patrick Hurst
I'm using netwire to build a game; one of the things the player can do is move around using WASD. I want to use key *events* as the 'basis' of my wires, not the entire state vector of the keyboard so that, for example, a press event on D increments the velocity by (200, 0) and a release event

Re: [Haskell-cafe] ifdef based on which OS you're on

2013-02-15 Thread Henk-Jan van Tuyl
On Sat, 16 Feb 2013 01:57:14 +0100, Andrew Cowie and...@operationaldynamics.com wrote: Anyone have any idea if the Cabal library exposes this somewhere? See: http://hackage.haskell.org/packages/archive/Cabal/1.16.0.3/doc/html/Distribution-System.html Regards, Henk-Jan van Tuyl --