Re: [Haskell-cafe] hoogle down

2009-11-28 Thread Neil Mitchell
Hi Keith,

Thanks for pointing this out. I've no idea why it's failing, but will
check once I get home - unfortunately the machine I'm currently on
doesn't permit me to ssh in and find out.

Thanks, Neil

On Sat, Nov 28, 2009 at 6:53 AM, Keith Sheppard keiths...@gmail.com wrote:
 hoogle is down for me: Internal Server Error

 Thanks
 Keith

 --
 keithsheppard.name
 ___
 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


[Haskell-cafe] Custom cabal languages (hooks?)

2009-11-28 Thread Svein Ove Aas
I'm currently working on a binding to Brian Gladman's C/assembler AES
implementation.

This code is sufficiently small that it makes little sense to create a
separate C library for it; furthermore, it isn't typically packaged by
the various linux distributions, never mind other OSs. As a result,
I'd like to make it part of the cabalized AES package.

This works well enough with the pure-C variant of the implementation,
but it also has assembly-based implementations of the core encryption
routines for x86 and x86_64, specifically using yasm, which I would
like to use when possible.

So, two problems..

- First, I need to make cabal detect yasm's presence, and call out to
it when appropriate. The former I can do with a configure script; the
latter, I'm not quite sure how to do. Currently, cabal can only do C;
basically, I'm looking for a way to let it use any language that can
be compiled to .o files.
- Second, having manually compiled the C/asm bits to .a and .so form,
I did eventually get cabal to link (seemingly) correctly against it,
but it then did not proceed to copy libaes.so into
~/.cabal/lib/AES/ I'm not sure how to make it do that, either. I
suppose I'll have to use hooks, but I'd appreciate a little advice on
how, exactly

Well, I've put a snapshot of my current code at
http://brage.info/~svein/aes/, so you can have a look. I'd really
appreciate the help.

--
Svein Ove Aas
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: deepseq-1.0.0.0

2009-11-28 Thread Nicolas Pouillard
Excerpts from Simon Marlow's message of Wed Nov 18 09:55:28 +0100 2009:
 On 17/11/2009 12:25, Nicolas Pouillard wrote:
  Excerpts from Simon Marlow's message of Tue Nov 17 12:00:21 +0100 2009:
  I've just uploaded deepseq-1.0.0.0 to Hackage
 
  Great!
 
  I'm wondering what is the need/purpose for DeepSeqIntegral and DeepSeqOrd?
 
 I don't actually know, they were previously NFDataIntegral and NFDataOrd 
 respectively.  Unless anyone can think of a reason to want these, I'll 
 remove them.

No one claimed for them, I think and are just useless, and thus confusing.

Best regards,

-- 
Nicolas Pouillard
http://nicolaspouillard.fr
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] FastCGI under Windows

2009-11-28 Thread Kevin Jardine
Just to provide completion to this thread, I gave up on Haskell Windows web 
development after discovering that some important libraries like 
network-minihttp did not compile under Windows (and I could never get FastCGI 
to work properly either, although it did compile).

I'm now developing using Fedora running in VirtualBox. It took several hours to 
get the Haskell Platform installed properly under the Fedora version I'll be 
deploying to (Fedora 9), but now everything seems fine, including FastCGI.

Since my end goal is to deploy to Fedora 9 in any case, this seems a good 
solution.

Kevin

--- On Thu, 11/26/09, Michael Snoyman mich...@snoyman.com wrote:

 From: Michael Snoyman mich...@snoyman.com
 Subject: Re: [Haskell-cafe] FastCGI under Windows
 To: Kevin Jardine kevinjard...@yahoo.com
 Cc: haskell-cafe@haskell.org
 Date: Thursday, November 26, 2009, 12:36 PM
 You could try calling the
 program as CGI instead of FastCGI to try and pin down where
 the error is coming from. Also, you could run a FastCGI
 script in a different language (Perl?) and see if that
 works. I can't say, however, that I've even used
 FastCGI on Windows.
 
 
 Michael
 
 On Thu, Nov 26, 2009 at 9:55 AM,
 Kevin Jardine kevinjard...@yahoo.com
 wrote:
 
 Just to add more detail:
 
 
 
 I am running Apache 2.2.9. The message I mentioned appeared
 in the Apache error log file when running the sample Haskell
 FastCGI scripts under localhost with mod_fastcgi.
 
 
 
 I understand that there are some problems with mod_fastcgi
 and Apache 2.2.9, so I downloaded the Apache 2.2.9 version
 of mod_fcgid from here:
 
 
 
 http://www.apachelounge.com/download/
 
 
 
 and tried that instead.
 
 
 
 I no longer get the error message I mentioned before, but
 instead get:
 
 
 
 [Thu Nov 26 08:44:30 2009] [warn] mod_fcgid: read timeout
 from pipe
 
 [Thu Nov 26 08:44:30 2009] [error] [client 127.0.0.1]
 Premature end of script headers: test2.fcgi
 
 
 
 Any suggestions?
 
 
 
 Kevin
 
 
 
 
 
 
 
 --- On Wed, 11/25/09, Kevin Jardine kevinjard...@yahoo.com
 wrote:
 
 
 
  From: Kevin Jardine kevinjard...@yahoo.com
 
  Subject: [Haskell-cafe] FastCGI under Windows
 
  To: haskell-cafe@haskell.org
 
  Date: Wednesday, November 25, 2009, 10:44 PM
 
  I'm attempting to
 get FastCGI working
 
  with Haskell under Windows XP.
 
 
 
  However, all the sample code I've tried always
 fails with:
 
 
 
  user error (FCGX_Accept_r failed with error code:
 -)
 
  unknown listenType (0)
 
 
 
  Has anyone seen this before? Any ideas on what I could
 try
 
  to get this to work?
 
 
 
  Kevin
 
 
 
 
 
 
 
       
 
  ___
 
  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
 
 
 
 



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] HWN This week

2009-11-28 Thread Joe Fredette

Hey folks,

 I'm at home this weekend, and the internet is somewhat dodgey, so  
I'm going to delay the special Thanksgiving episode of the HWN till  
sunday afternoon...


 I suppose the Turkey-coma isn't helping either, but I'll never admit  
it...



/Joe
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] hoogle down

2009-11-28 Thread Ozgur Akgun
Now it's running again. Just out of curiosity, what was wrong?

2009/11/28 Neil Mitchell ndmitch...@gmail.com

 Hi Keith,

 Thanks for pointing this out. I've no idea why it's failing, but will
 check once I get home - unfortunately the machine I'm currently on
 doesn't permit me to ssh in and find out.

 Thanks, Neil

 On Sat, Nov 28, 2009 at 6:53 AM, Keith Sheppard keiths...@gmail.com
 wrote:
  hoogle is down for me: Internal Server Error
 
  Thanks
  Keith
 
  --
  keithsheppard.name
  ___
  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




-- 
Ozgur Akgun
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Partially applied functions

2009-11-28 Thread Ozgur Akgun
Hi cafe,

Is such a thing possible,


add :: Int - Int - Int
add x y = x + y

-- a list of partially applied functions
adds = [add 3, add 5, add 7, add 3, add 5, add 8]

-- an example usage of the list
k = map (\ f - f 10 ) adds

add3s = filter (?) adds -- add3s = [add 3, add 3]
addEvens = filter (?) adds --addEvens = [add 8]


I want to have functions in place of the ? signs. I guess one would need a
way of extracting the applied value from a partially applied function (or
totally, doesn't matter)

I came across such a structure while designing an algotihm and used data
structures to represent functions and solved the problem. But this doesn't
seem very *cute* to me and requires some bolier-plate (if you have a lot of
this structure everywhere) , that's why I am asking for your precious
suggestions.

Best,

-- 
Ozgur Akgun
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Partially applied functions

2009-11-28 Thread Steffen Schuldenzucker
Ozgur Akgun wrote:
 Hi cafe,
 
 Is such a thing possible,
 
 
 add :: Int - Int - Int
 add x y = x + y
 
 -- a list of partially applied functions
 adds = [add 3, add 5, add 7, add 3, add 5, add 8]
 
 -- an example usage of the list
 k = map (\ f - f 10 ) adds
 
 add3s = filter (?) adds -- add3s = [add 3, add 3]
 addEvens = filter (?) adds --addEvens = [add 8]
 
 
 I want to have functions in place of the ? signs. I guess one would need
 a way of extracting the applied value from a partially applied function
 (or totally, doesn't matter)

Well, sure you can:

add3s = filter (\f - f 0 == 3) adds
addEvens = filter (\f - isEven $ f 0) adds

This is only possible since there is that special property of the
addition that (add a) 0 == a forall a, i.e. you can extract the first
parameter back out of the partial applied function by passing 0 as a
second parameter.

It clearly depends on the function how much information about the
parameters can be read from the result.


-- Steffen

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] hoogle down

2009-11-28 Thread Neil Mitchell
Hi,

Yep, it's all back now. The problem was that the server had run out of
disk space. Ian fixed it for now, but do let me know if it fails
again.

Thanks, Neil

On Sat, Nov 28, 2009 at 2:54 PM, Ozgur Akgun ozgurak...@gmail.com wrote:
 Now it's running again. Just out of curiosity, what was wrong?

 2009/11/28 Neil Mitchell ndmitch...@gmail.com

 Hi Keith,

 Thanks for pointing this out. I've no idea why it's failing, but will
 check once I get home - unfortunately the machine I'm currently on
 doesn't permit me to ssh in and find out.

 Thanks, Neil

 On Sat, Nov 28, 2009 at 6:53 AM, Keith Sheppard keiths...@gmail.com
 wrote:
  hoogle is down for me: Internal Server Error
 
  Thanks
  Keith
 
  --
  keithsheppard.name
  ___
  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



 --
 Ozgur Akgun

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Custom cabal languages (hooks?)

2009-11-28 Thread Duncan Coutts
On Sat, 2009-11-28 at 14:47 +0100, Svein Ove Aas wrote:
 I'm currently working on a binding to Brian Gladman's C/assembler AES
 implementation.
 
 This code is sufficiently small that it makes little sense to create a
 separate C library for it; furthermore, it isn't typically packaged by
 the various linux distributions, never mind other OSs. As a result,
 I'd like to make it part of the cabalized AES package.
 
 This works well enough with the pure-C variant of the implementation,
 but it also has assembly-based implementations of the core encryption
 routines for x86 and x86_64, specifically using yasm, which I would
 like to use when possible.

The simplest thing from the cabal pov would be to just include the asm
inline into a .c file.

 So, two problems..
 
 - First, I need to make cabal detect yasm's presence, and call out to
 it when appropriate. The former I can do with a configure script;

That's the bit that's actually easy within a Setup.hs, no need for
non-portable ./configure scripts.

 the latter, I'm not quite sure how to do. Currently, cabal can only do C;
 basically, I'm looking for a way to let it use any language that can
 be compiled to .o files.

Right, there's no support for that in the Simple build system. You'd
have to use the hooks.

 - Second, having manually compiled the C/asm bits to .a and .so form,
 I did eventually get cabal to link (seemingly) correctly against it,
 but it then did not proceed to copy libaes.so into
 ~/.cabal/lib/AES/ I'm not sure how to make it do that, either. I
 suppose I'll have to use hooks, but I'd appreciate a little advice on
 how, exactly

Right, it's only expecting one library. You could either link the stuff
into the same lib or add copying code in the copy hook.

Duncan

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Partially applied functions

2009-11-28 Thread Ozgur Akgun
Sorry, no good.

I don't want to guess the first paramater, I really want to access it.

2009/11/28 Steffen Schuldenzucker sschuldenzuc...@uni-bonn.de

 Ozgur Akgun wrote:
  Hi cafe,
 
  Is such a thing possible,
 
 
  add :: Int - Int - Int
  add x y = x + y
 
  -- a list of partially applied functions
  adds = [add 3, add 5, add 7, add 3, add 5, add 8]
 
  -- an example usage of the list
  k = map (\ f - f 10 ) adds
 
  add3s = filter (?) adds -- add3s = [add 3, add 3]
  addEvens = filter (?) adds --addEvens = [add 8]
 
 
  I want to have functions in place of the ? signs. I guess one would need
  a way of extracting the applied value from a partially applied function
  (or totally, doesn't matter)

 Well, sure you can:

 add3s = filter (\f - f 0 == 3) adds
 addEvens = filter (\f - isEven $ f 0) adds

 This is only possible since there is that special property of the
 addition that (add a) 0 == a forall a, i.e. you can extract the first
 parameter back out of the partial applied function by passing 0 as a
 second parameter.

 It clearly depends on the function how much information about the
 parameters can be read from the result.


 -- Steffen

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe




-- 
Ozgur Akgun
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Partially applied functions

2009-11-28 Thread Ozgur Akgun
Answering my own question, one can achieve the goal via doing a lookup, if
the number of possible parameters is limited.
eg. assume add is a function which can only take Int's from [0..9].

Interestingly, my situation is exactly like this. I think I'll implement
such a lookup.

The question is still open though, if somebody has some magic to extract the
prameter from an applied function...

2009/11/28 Ozgur Akgun ozgurak...@gmail.com

 Sorry, no good.

 I don't want to guess the first paramater, I really want to access it.

 2009/11/28 Steffen Schuldenzucker sschuldenzuc...@uni-bonn.de

 Ozgur Akgun wrote:
  Hi cafe,
 
  Is such a thing possible,
 
 
  add :: Int - Int - Int
  add x y = x + y
 
  -- a list of partially applied functions
  adds = [add 3, add 5, add 7, add 3, add 5, add 8]
 
  -- an example usage of the list
  k = map (\ f - f 10 ) adds
 
  add3s = filter (?) adds -- add3s = [add 3, add 3]
  addEvens = filter (?) adds --addEvens = [add 8]
 
 
  I want to have functions in place of the ? signs. I guess one would need
  a way of extracting the applied value from a partially applied function
  (or totally, doesn't matter)

 Well, sure you can:

 add3s = filter (\f - f 0 == 3) adds
 addEvens = filter (\f - isEven $ f 0) adds

 This is only possible since there is that special property of the
 addition that (add a) 0 == a forall a, i.e. you can extract the first
 parameter back out of the partial applied function by passing 0 as a
 second parameter.

 It clearly depends on the function how much information about the
 parameters can be read from the result.


 -- Steffen

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe




 --
 Ozgur Akgun




-- 
Ozgur Akgun
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Partially applied functions

2009-11-28 Thread Serguey Zefirov
 The question is still open though, if somebody has some magic to extract the
 prameter from an applied function...

It isn't possible.

Closest solution will be a list of pairs (function,arg) and a special
apply function that takes those pairs and apply to function an
argument and.them, apply something else.

Then you can interleave (+) and (*) as a function. ;)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: deepseq-1.0.0.0

2009-11-28 Thread Simon Marlow

On 28/11/09 14:04, Nicolas Pouillard wrote:

Excerpts from Simon Marlow's message of Wed Nov 18 09:55:28 +0100 2009:

On 17/11/2009 12:25, Nicolas Pouillard wrote:

Excerpts from Simon Marlow's message of Tue Nov 17 12:00:21 +0100 2009:

I've just uploaded deepseq-1.0.0.0 to Hackage


Great!

I'm wondering what is the need/purpose for DeepSeqIntegral and DeepSeqOrd?


I don't actually know, they were previously NFDataIntegral and NFDataOrd
respectively.  Unless anyone can think of a reason to want these, I'll
remove them.


No one claimed for them, I think and are just useless, and thus confusing.


Already gone in deepseq-1.1.0.0, which also renamed DeepSeq back to NFData.

Cheers,
Simon

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: [Haskell] ANN: NoSlow - Microbenchmarks for array libraries

2009-11-28 Thread Bryan O'Sullivan
On Fri, Nov 27, 2009 at 1:05 PM, Henning Thielemann 
lemm...@henning-thielemann.de wrote:


 I found that the dependency on Cairo and GTK originates from criterion. I
 have to build criterion with 'cabal install -f-chart criterion'.
 Unfortunately I cannot do 'cabal fetch criterion' in order to look into the
 cabal file, before the dependencies are resolved ...


Really? If cabal fetch runs the build depsolver before trying to download a
package, that seems like a bug. Have you reported it?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] cabal-install binary for FreeBSD

2009-11-28 Thread Michael Snoyman
Hi all,

I'm trying out NearlyFreeSpeech.net for hosting my Haskell apps. They use
FreeBSD 7.2, but I can't get cabal-install to compile since it runs out of
memory during the link phase. So far I haven't had trouble manually
installing packages, but it would be nice to just do cabal install...

Anyway, I don't have FreeBSD installed locally, and I was wondering if
anyone out there might have a cabal binary for FreeBSD that they could send
over.

Thanks,
Michael
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Partially applied functions

2009-11-28 Thread Mark Lentczner
-- Here's a expansion of the ideas presented for tracking the argument used 
-- to create a partially applied function:

--
-- Based on simple pairs
--

add :: Int - Int - Int
add x y = x + y

addr :: Int - (Int, Int - Int)
addr a = (a, add a)

-- a list of partially applied functions
adds = [addr 3, addr 5, addr 7, addr 3, addr 5, addr 8]

-- an example usage of the list
k = map (\ f - (snd f) 10 ) adds

-- filtering
add3s = filter (\ f - fst f == 3) adds
addEvens = filter (\f - even $ fst f) adds --addEvens = [add 8]

k3 = map (\ f - (snd f) 10) add3s
keven = map (\ f - (snd f) 10) addEvens


--
-- Generalized:
--

data TaggedPartial a b c = TAG a (b - c)

tag :: (a - b - c) - a - TaggedPartial a b c
tag f a = TAG a (f a)
-- create a tagged partially applied function

tap :: TaggedPartial a b c - b - c
tap (TAG _ f) b = f b
-- tagged partial function apply

ttest :: TaggedPartial a b c - (a - Bool) - Bool
ttest (TAG a _) f = f a
-- tagged tag test

tadds = [tag add 3, tag add 5, tag add 7, tag add 3, tag add 5, tag add 8]

tk = map (\ f - tap f 10) tadds

tadd3s = filter (\ f - ttest f (==3)) tadds
taddEvens = filter (\ f - ttest f even) tadds

tk3 = map (\ f - tap f 10) tadd3s
tkeven = map (\ f - tap f 10) taddEvens

--
-- The examples of map and filter usage, show that the arguments to
-- tap and ttest are awkwardly flipped.  Hence:
--

pat :: b - TaggedPartial a b c - c
pat = flip tap

testt :: (a - Bool) - TaggedPartial a b c - Bool
testt = flip ttest

tk' = map (pat 10) tadds

tadd3s' = filter (testt (==3)) tadds
taddEvens' = filter (testt even) tadds

tk3' = map (pat 10) tadd3s'
tkeven' = map (pat 10) taddEvens'


{-

Mark Lentczner
http://www.ozonehouse.com/mark/
m...@glyphic.com


-}



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] cabal-install binary for FreeBSD

2009-11-28 Thread Duncan Coutts
On Sat, 2009-11-28 at 19:39 +0200, Michael Snoyman wrote:
 Hi all,
 
 I'm trying out NearlyFreeSpeech.net for hosting my Haskell apps. They
 use FreeBSD 7.2, but I can't get cabal-install to compile since it
 runs out of memory during the link phase. So far I haven't had trouble
 manually installing packages, but it would be nice to just do cabal
 install...

I expect you'll find the same thing happens if you link anything else.
My suggestion is to rebuild ghc from source and disable the split
objects feature. That feature reduces final binary sizes but it makes
the linker work too hard (and use too much memory).

On Gentoo we used to disable split objects on machines with less than
256Mb memory. And that was with GNU ld which has had some memory use
improvements in recent years.

Duncan


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: [Haskell] ANN: NoSlow - Microbenchmarks for array libraries

2009-11-28 Thread Duncan Coutts
On Sat, 2009-11-28 at 09:29 -0800, Bryan O'Sullivan wrote:
 On Fri, Nov 27, 2009 at 1:05 PM, Henning Thielemann
 lemm...@henning-thielemann.de wrote:
  
 I found that the dependency on Cairo and GTK originates from
 criterion. I have to build criterion with 'cabal install
 -f-chart criterion'. Unfortunately I cannot do 'cabal fetch
 criterion' in order to look into the cabal file, before the
 dependencies are resolved ...


 Really? If cabal fetch runs the build depsolver before trying to
 download a package, that seems like a bug. Have you reported it?

It's not a bug, it's a feature! :-)

Henning, you want cabal unpack so you can study the package contents.

The fetch command is mainly so you can fetch packages and then install
them when you're offline. You'd be jolly annoyed if it missed
dependencies.

Duncan

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Partially applied functions

2009-11-28 Thread Casey Hawthorne
Will the following do what you wish?

add :: Int - Int - Int
add x y = x + y

addends = [3,5,7,3,5,8]::[Int]

add3s :: [Int] - [Int - Int]
add3s addends = map add (filter (3==) addends)

k3 :: [Int]
k3 = map (\ f - f 10 ) (add3s addends)
--
Regards,
Casey
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] cabal-install binary for FreeBSD

2009-11-28 Thread Michael Snoyman
On Sat, Nov 28, 2009 at 7:56 PM, Duncan Coutts duncan.cou...@googlemail.com
 wrote:

 On Sat, 2009-11-28 at 19:39 +0200, Michael Snoyman wrote:
  Hi all,
 
  I'm trying out NearlyFreeSpeech.net for hosting my Haskell apps. They
  use FreeBSD 7.2, but I can't get cabal-install to compile since it
  runs out of memory during the link phase. So far I haven't had trouble
  manually installing packages, but it would be nice to just do cabal
  install...

 I expect you'll find the same thing happens if you link anything else.
 My suggestion is to rebuild ghc from source and disable the split
 objects feature. That feature reduces final binary sizes but it makes
 the linker work too hard (and use too much memory).

 On Gentoo we used to disable split objects on machines with less than
 256Mb memory. And that was with GNU ld which has had some memory use
 improvements in recent years.

 Duncan


 I agree that would be a good idea, but I'm not sure if I'll have a success
on this host. I'll let you know. In any event, for the record, I got about
20 packages to compile, including getting my actual site up and running. It
was tedious with cabal-install, but I got the job done.

Michael
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Partially applied functions

2009-11-28 Thread Casey Hawthorne
Will the following do what you wish?


add :: Int - Int - Int
add x y = x + y

addends = [3,5,7,3,5,8]::[Int]

-- P for predicate
addPs :: (Int - Bool) - [Int] - [Int - Int]
addPs predicate addends = map add (filter predicate addends)

kP :: [Int]
kP = map (\ f - f 10 ) (addPs (3==) addends)

--
Regards,
Casey
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: [Haskell] ANN: NoSlow - Microbenchmarks for array libraries

2009-11-28 Thread Henning Thielemann
Duncan Coutts schrieb:
 On Sat, 2009-11-28 at 09:29 -0800, Bryan O'Sullivan wrote:
 On Fri, Nov 27, 2009 at 1:05 PM, Henning Thielemann
 lemm...@henning-thielemann.de wrote:
  
 I found that the dependency on Cairo and GTK originates from
 criterion. I have to build criterion with 'cabal install
 -f-chart criterion'. Unfortunately I cannot do 'cabal fetch
 criterion' in order to look into the cabal file, before the
 dependencies are resolved ...
 
 
 Really? If cabal fetch runs the build depsolver before trying to
 download a package, that seems like a bug. Have you reported it?
 
 It's not a bug, it's a feature! :-)
 
 Henning, you want cabal unpack so you can study the package contents.
 
 The fetch command is mainly so you can fetch packages and then install
 them when you're offline. You'd be jolly annoyed if it missed
 dependencies.

I well see the benefits of the current behaviour of 'cabal fetch' and
according to the name 'unpack' I didn't expect it could be the solution
of my problem. Duncan has explained kindly the issue in:

http://hackage.haskell.org/trac/hackage/ticket/612
http://hackage.haskell.org/trac/hackage/ticket/423


However I have still the problem, that once criterion is installed
without gtk and cairo, then 'cabal install' still wants to download them
 when I install packages that import 'criterion'. :-( Bug or feature?

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: [Haskell] ANN: NoSlow - Microbenchmarks for array libraries

2009-11-28 Thread Duncan Coutts
On Sat, 2009-11-28 at 20:13 +0100, Henning Thielemann wrote:

 However I have still the problem, that once criterion is installed
 without gtk and cairo, then 'cabal install' still wants to download them
  when I install packages that import 'criterion'. :-( Bug or feature?

That's a problem with the cabal-install resolver. When configuring
criterion it optimistically assumes that it will be able to install the
optional dependencies. I've been working on an extra bottom-up pass for
the resolver that will prune packages that cannot possibly be installed.
That should help in this case and for the more common case of packages
that need a particular version of base.

In the mean time, a workaround would be to try:
$ cabal install noslow criterion -f-chart --dry-run

That should make it select criterion without the chart dep, and since
the deps of criterion will then not change it should end up picking the
installed instance of criterion rather than rebuilding it.

Another thing that'd help here, but isn't implemented, is installed
constraints. So that you could ask it commit to using the installed
instance of criterion, rather than it having the option to rebuild
(which in general it needs so it can get consistent deps).

Duncan

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Partially applied functions

2009-11-28 Thread Brandon S. Allbery KF8NH

On Nov 28, 2009, at 12:01 , Ozgur Akgun wrote:
Answering my own question, one can achieve the goal via doing a  
lookup, if the number of possible parameters is limited.

eg. assume add is a function which can only take Int's from [0..9].

Interestingly, my situation is exactly like this. I think I'll  
implement such a lookup.


The question is still open though, if somebody has some magic to  
extract the prameter from an applied function...



You can't, because it's a chunk of machine code, not an AST that can  
be walked to pull out parameters.  The solution is to convert it to  
the latter form (in the simplest case, a tuple is good enough; if you  
need something more complicated you'll have to define an actual AST  
datatype).


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon universityKF8NH




PGP.sig
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] haskell in online contests

2009-11-28 Thread vishnu
this is where I've gotten to.
http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=5120#a5120
strangely enough Ive gotten no speedup at all from the substitution cost
UArray (though I had to make it Int, Int to deal with digits.). But still I
wonder if there's something else I missed. Im really curious what lazyness
you used to go from 60 to 1.6? I always thought lazyness was automatic and
seq made strictness possible.
thanks
Vishnu

On Sat, Nov 28, 2009 at 7:41 AM, Daniel Fischer daniel.is.fisc...@web.dewrote:

 Am Samstag 28 November 2009 02:04:31 schrieb Daniel Fischer:
  Make it
 
  distance orig new = f m n
 
  and no thunks need be written at all in this case.
  Cuts down running time by nearly half :)
 
  I think you could speed it up significantly by calculating the distance
  more lazily.

 Yup :D

 Timings here:
 Your last ByteString code: 128s
 That with corrected index calculation: 172s
 Correct indices and distance orig new = f m n instead of memf m n: 99s
 That and an array for the substitution cost: 64s

 String IO, substitution cost array and a suitably lazy break-early distance
 function: 1.7s
 That and a lazier surcharge function: 1.5s
 The same with ByteString IO: 1.4s

 Yes, I'd say that qualifies as a significant speedup.
 ___
 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] namespaces for values, types, and classes

2009-11-28 Thread Duncan Coutts
On Fri, 2009-11-27 at 11:07 +0100, Sebastian Fischer wrote:

 We cannot write
 
   class Name a where ...
   instance Name Name where ...

Yes! Very annoying.

I want to be able to make a type that is the most general instance of a
single-parameter type class. This is a useful OOish thing to do.

For example:

class Compiler c where
  getInstalledPackages :: c - ...
  compileModule:: c - ...

instance Compiler GHC where ...
instance Compiler NHC where ...

and sometimes I want a list of compilers...

newtype Compiler where
Compiler :: Compiler c = c - Compiler
  deriving Compiler

compilers :: [Compiler]
compilers = [Compiler ghc, Compiler nhc]

 Does anyone know why types and values are in separate namespaces but  
 classes and types are not?

I think it's because you cannot currently distinguish them in module
import/exports.

Duncan

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] control-monad-failure and mtl

2009-11-28 Thread Edward Z. Yang
Hello folks,

I took advantage of Thanksgiving weekend to port my application to use
Control.Monad.Failure, and learned (slightly painfully) that I still
needed to pick some mechanism to instantiate my failure monads as.
After the experience, I have three questions/comments:

1. Why isn't there an instance for Either in mtl? (There is one for
Transformers.  The error message left me very puzzled there: the docs
clearly claimed the instance existed, and only a little source code
diving elucidated the situation.)  Copying the instance declaration
from the transformers version seems to fix it.

2. I was having difficulty instantiating MonadFailure as an ErrorT
for an arbitrary monad.  Here is an example:

{-# LANGUAGE PackageImports, FlexibleContexts #-}

import mtl Control.Monad.Error
import mtl Control.Monad.State
import Control.Monad.Failure

data MyError = MyError String
instance Error MyError where
strMsg = MyError

type MyMonad = ErrorT MyError (State Integer)

failureFunction :: MonadFailure MyError m = Integer - m Integer
failureFunction 0 = failure $ MyError Cannot use zero
failureFunction n = return (n - 1)

-- instantiate
monadicFunction :: MyMonad Integer
monadicFunction = failureFunction 23

Which results in the following error:

failure.hs:19:18:
No instance for (MonadFailure
   MyError (ErrorT MyError (State Integer)))
  arising from a use of `failureFunction' at failure.hs:19:18-35
Possible fix:
  add an instance declaration for
  (MonadFailure MyError (ErrorT MyError (State Integer)))
In the expression: failureFunction 23
In the definition of `monadicFunction':
monadicFunction = failureFunction 23

Which seems to contradict the documentation and source code, which states:

Instances: [...]
(Error e, Monad m) = MonadFailure e (ErrorT e m)

How do I misunderstand?

3. In a motivating example, one of the goals of MonadFailure is to let
us mix the error code of third-party modules into the generic failure mode.
Control.Monad.Failure appears to give the machinery for instantiating a generic
failure monad, but it doesn't have any facilities for the opposite direction:
that is, marshalling a specific error form into the generic error form.  Am I
mistaken, and if not, would it be a welcome addition to the library?

Cheers,
Edward
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Partially applied functions

2009-11-28 Thread Casey Hawthorne
It sounds as if you want to carry some state around for each partially
applied function, I think that's in monad territory.

A cardinal rule of functional programming is to create new data,
whenever possible.
--
Regards,
Casey
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Partially applied functions

2009-11-28 Thread Casey Hawthorne
You can pattern match on the right hand side of '|' in a list
comprehension, since a list comprehension is just the list monad.


add :: Int - Int - Int
add x y = x + y

-- a list of partially applied functions
adds = [add 3, add 5, add 7, add 3, add 5, add 8]

-- an example usage of the list
kP num = map (\ f - f 10 ) (addPs num)

-- add3s = filter (?) adds -- add3s = [add 3, add 3]
-- addEvens = filter (?) adds --addEvens = [add 8]

addPs num = [ x | x - adds, x 0 == num ]

--
Regards,
Casey
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: implementing recursive let

2009-11-28 Thread Ben Franksen
Hi Ryan,

first, to get this out of the way, you wrote:

 Also, your definition of Function seems to have problems with
 scoping; unless you intended to make a dynamically scoped language,

No, absolutely not! In fact, the whole exercise has been born out of
frustration with certain ad-hoc extensions to an already evil
domain-specific (macro substitution) language -- the extension being to add
dynamically scoped local variables; and the basic evilness to allow
substitution to occur in variable names (similar to make) as a poor man's
substitute for functional abstraction. This makes for extremely cryptic
programs whose result is very hard to predict. My aim is to show that there
is a better way.

 (Value - Eval Value) seems very likely to get evaluated in the
 context it is called in.

Fortunately, this is not the case, as I explicitly capture the evironment at
the definition site, ignoring the one at the call site:

eval (Lam parm body) = do
  env - ask
  return $ Function (\val - local (\_ - M.insert parm val env) (eval
body))

Now to the interesting part:

 Now the question is, what do you want to happen when given a malformed
 let expression?  I am pretty sure that you need more complicated
 flow-control here in order to get the result.  I believe you are on
 the right track with continuations.

My problem is that I have never really become comfortable with
continuations; just couldn't wrap my head around all the nested lambdas
involved. Is there a nice tutorial (preferably one of those functional
perls, I love them) that explains how CPS actually works to produce those
wonderful effects, like jumping around, fixing evaluation order and
whatnot? I tried to follow the recent explanations by Jacques Carette and
Oleg Kiselyov on this list but I must admit that I understood nought.

 Here is a question; what should these expressions do?
 let y = x; x = 1 in y
 let y = x x; x = 1 in x
 let x = x in x
 
 The last one is quite telling; I can see three possible behaviors here:
 
 1) Loop
 2) return some simple undefined value
 3) Give an error blackhole
 
 I will note that behavior (1) seems very difficult to achieve with
 your current monad stack; eval (Var x) terminates simply by looking up
 the value in the environment.
 
 I think you need to think hard about evaluation order and decide what
 you really want to happen.  The simplest answer, if you want to stay
 with strict evaluation, is probably to only allow recursive *function*
 definitions.  This way you can delay fully initializing the
 environment until after you've finished evaluating the functions
 themselves.

Thanks, Ryan. This got me thinking about the right questions. I found out
that what I really want is a mixture of lazy and strict evaluation: I want
variable definitions in a let expression to be lazy, but application of
functions to be strict. (I don't know whether this kind of mixture has been
used before.) Thus

 let y = x; x = 1 in y

should evaluate to  1 . I want the meaning of declarations on the same level
to be independent of their relative order. This is a purely functional
language, after all, so why should it matter in which order things are
defined?

 let y = x x; x = 1 in x

Here  y  is never used, so again this evaluates to  1 .

 let x = x in x

This should loop (or maybe better detected as a failure i.e. backhole), but
only if and when x is used, either in an application or as the final result
of the program. (In the former case it doesn't make a difference whether  x 
is used in function or in argument position.)

  ***

Thinking about how to make it _explicit_ in my code that application is
strict, whereas variables are lazy, I saw that this needs a change in the
type of environments. It used to be a map from variable names to _values_,
i.e. evaluated expressions. If I change this to a map from variable names
to either thunks (i.e. unevaluated expressions) or (evaluated) values, then
everything else falls smoothly into place; no need for mdo/mfix anymore,
thus no need for fiddling with ErrorT internals to convince it that
variable lookup always succeeds, and last not least all my examples behave
as I expect them to do (see attached code).

So, in a way I /have/ (finally) given up ;-) because variables are now
(internally) mutable cells: when a variable is demanded (e.g. by an
application) it gets mutated from thunk to value. Could as well revert to a
Reader monad and use STRefs for efficiency. (Or maybe I will finally try to
understand how to use continuations for stuff like this.)

I have learned (at least) this: The problem with using the host language's
lazyness for implementing lazyness in the defined language is that the
former is not directly observable. Thus it works fine as long as you buy
the whole package, i.e. either make sure that there can't be a failure, or
else use not only the built-in evaluation order but also the built-in
failure mode: error, pattern match failure, i.e. exceptions that can occur
in 

Re: [Haskell-cafe] namespaces for values, types, and classes

2009-11-28 Thread Sebastian Fischer

Does anyone know why types and values are in separate namespaces but
classes and types are not?


I think it's because you cannot currently distinguish them in module
import/exports.


Ah, good point. For constructors there is special syntax which allows  
to distinguish them in im/exports. Even if you have


data One = Uno
data Two = One | Two

and you want to im/export only the constructor `One` but neither the  
type `One` nor the constructor `Two` you can write `Two(One)` to refer  
to it.


So, my assumption that class names and type names always appear in  
different contexts was wrong when it comes to im/exports and there  
doesn't seem to be an easy way to fix that.


Thank you for clarifying!

Sebastian

--
Underestimating the novelty of the future is a time-honored tradition.
(D.G.)



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Hoogle server error again

2009-11-28 Thread michael rice
Just tried to use Hoogle and got: 500 Internal Server Error

Michael




  ___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] haskell in online contests

2009-11-28 Thread wren ng thornton

vishnu wrote:

I always thought lazyness was automatic and
seq made strictness possible.


Laziness is the default, but that doesn't mean it's everywhere. For 
example, every time you do pattern matching you enforce strictness:


foo (x:xs) = 5
==
foo _|_ == _|_

However, there's also a way to make patterns lazy:

foo ~(x:xs) = 5
==
foo _|_ == 5

The difference here is in how they're compiled/desugared, something like 
this:


foo (x:xs) = 5
==
foo = \xs' - case xs' of (x:xs) - 5


foo ~(x:xs) = 5
==
foo = \xs' - let (x:xs) = xs' in 5
==
foo = \xs' - 5

So writing the same function in different ways can enforce different 
strictness behavior.


There are also more substantial algorithmic uses of laziness. One 
example is writing functions in a way that facilitates list fusion or 
on-line consumption of lists, vs writing functions in a way that forces 
more than one cell of the list at a time. Deforestation and garbage 
collection are not laziness, but appropriate uses of laziness can allow 
you to leverage them to improve the performance of your code.


--
Live well,
~wren
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ghci breakpoints

2009-11-28 Thread Sean McLaughlin
Hello,

  I'm having trouble setting breakpoints from ghci.  I load the files
and I can tell things are working correctly because I can run the
program and list the locations where I want to set breakpoints.  E.g.

Prelude :list Focus.focus
510   focus :: forall s m. Class s m = Neg - m [Foci]
511   focus f =
512 let ats = Path.atoms f

But when I try to set a breakpoint I get

Prelude :break Focus.focus
No breakpoints found at that location.

Does anyone have ideas about what I'm doing wrong in this case?  Do I
need to load with some special options to have breakpoints work?

Thanks,

Sean
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] haskell in online contests

2009-11-28 Thread wren ng thornton

vishnu wrote:

wow ok, I'm not even able to see why they're different in the desugared
version


They're different because case is strict binding (see caveat below) 
whereas let is lazy binding. If we say,


let foo = big ugly computation in bar

Then if foo isn't used in bar, it'll never be computed. (Even if foo 
occurs in bar, provided it occurs somewhere that won't be evaluated.) 
Whereas if we say,


case big ugly computation of foo - bar

Then we're forced to do the computation, regardless of whether foo is 
used in bar. Actually, that's not entirely true. In this example, 
because foo is a variable, the binding will be lazy; whereas if we 
replaced foo with a (non-lazy) pattern then it'd be strict.



Part of the complication in explaining the exact details is because both 
case and let can have patterns inside of the binding so the desugaring 
process has to continue recursively. Also there're some details about 
using let for defining recursive groups, which you can't do with case. 
Also Haskell's syntax conflates defining functions with doing pattern 
matching, so there's an extra step to separate functions using pattern 
matching into the definition binding vs the pattern matching. In any 
case, once you're done compiling you end up with a strict binding 
operator (kind of like case) and a lazy binding operator (kind of like let).


When in doubt, try playing around with different definitions to see 
whether they break when you pass in 'undefined'. There are also a few 
papers out there on how the STG works under the covers.


--
Live well,
~wren
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: ANNOUNCE: Clutterhs 0.1

2009-11-28 Thread Gour
On Sat, 28 Nov 2009 23:18:00 -0500
 Matt == Matt Arsenault arse...@rpi.edu wrote:  

Hi Matt,

Matt This is a very early announcement for an initial release of
Matt bindings for Clutter 1.0, now on
Matt Hackage,http://hackage.haskell.org/package/clutterhs  

Thanks a lot for this project. I'm just thinking about using Haskell
on Moblin OS. ;)
 
Matt It uses c2hs, and depends on gtk2hs from darcs for the
Matt glib/gobject bindings. Overall, its usage should be similar to
Matt gtk2hs.  

This is very cool.

Matt This is my first Haskell project, and suggestions on the API, bug
Matt reports, etc. are appreciated.  

What do you think about binding Moblin's nbtk (now it's called mx) ?


Otoh, are you aware of:

 http://github.com/elliottt/clutter 
 http://github.com/yav/clutter


Sincerely,
Gour

-- 

Gour  | Hlapicina, Croatia  | GPG key: F96FF5F6



signature.asc
Description: PGP signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe