[Haskell-cafe] nun.haskell.org http services down?

2010-05-05 Thread Jens Petersen
http://{code,community,projects}.haskell..org/ seem to be inaccessible.

Could someone please look into it?

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


Re: [Haskell-cafe] nun.haskell.org http services down?

2010-05-05 Thread Christopher Done
Why does this happen so often? Broken hardware, software crash,
bandwidth overuse, etc.? I have 200GB of bandwidth/month on the
tryhaskell.org server. It's not much but hopefully I can make a
Hackage mirror out of it one weekend for when the main server goes
down.

On 5 May 2010 09:05, Jens Petersen peter...@haskell.org wrote:
 http://{code,community,projects}.haskell..org/ seem to be inaccessible.

 Could someone please look into it?

 Thanks, Jens
 ___
 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] Fwd: Error instaling Happstack on Windows - cabal bug?

2010-05-05 Thread Stephen Tetley
Hi all

A cursory look at Happstack.Crypto.MD5 shows it uses -fvia-c:


{-# LANGUAGE BangPatterns #-}
{-# OPTIONS_GHC -funbox-strict-fields -fvia-c -optc-funroll-all-loops
-optc-O3 #-}
--
-- Module  : Happstack.Crypto.MD5
-- License : BSD3



GHC (on Windows) comes with perl so it shouldn't need installing again.

As an expedience, one could try removing the OPTIONS_GHC pragma to see
if it compiles at least (there may be other modules that use fvia-c
too).

Best wishes

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


[Haskell-cafe] class Arbitrary in quickcheck

2010-05-05 Thread Tim Docker
I've notice a behaviour of quickcheck that is unexpected to me. With
this code:

import Test.QuickCheck

main = check myconfig 
 ((\v - v == v) :: (Maybe Double,Maybe Double) - Bool)

myconfig = defaultConfig{configMaxTest=10,
 configEvery = \n args - show n ++ :\n
  ++ unlines args}

I am relying on the default Arbitrary instances to generate pairs of
maybe doubles. But to my surprise, all of the pairs have these patterns:

(Just _ Just _)
(Nothing, Nothing)

I never see patterns:

(Just _, Nothing)
(Nothing, Just _)

Why is this the case?

Thanks,

Tim






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


Re: [Haskell-cafe] class Arbitrary in quickcheck

2010-05-05 Thread Ozgur Akgun
your quick check property (in a different way of writing) is the following:

prop_1 :: Maybe Double - Bool
prop_1 v = v == v

but what you want is actually the following:

prop_2 :: Maybe Double - Maybe Double - Bool
prop_2 v1 v2 = v2 == v2

if I understood the problem correctly, using prop_2 should solve it. just
run 
verboseCheckhttp://hackage.haskell.org/packages/archive/QuickCheck/1.1.0.0/doc/html/Test-QuickCheck.html#v:verboseCheckon
these two and observe the results.

Best,



On 5 May 2010 08:47, Tim Docker t...@dockerz.net wrote:

 I've notice a behaviour of quickcheck that is unexpected to me. With
 this code:

 import Test.QuickCheck

 main = check myconfig
 ((\v - v == v) :: (Maybe Double,Maybe Double) - Bool)

 myconfig = defaultConfig{configMaxTest=10,
 configEvery = \n args - show n ++ :\n
  ++ unlines args}

 I am relying on the default Arbitrary instances to generate pairs of
 maybe doubles. But to my surprise, all of the pairs have these patterns:

(Just _ Just _)
(Nothing, Nothing)

 I never see patterns:

(Just _, Nothing)
(Nothing, Just _)

 Why is this the case?

 Thanks,

 Tim






 ___
 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] ANN: precis-0.3.1 - Cabal package diff tool

2010-05-05 Thread Henning Thielemann


On Thu, 29 Apr 2010, Stephen Tetley wrote:


I've upload precis to Hackage - a diff tool for Cabal packages.


I have added a note to:
   https://www.haskell.org/haskellwiki/Package_versioning_policy
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Haskell and scripting

2010-05-05 Thread Niclas W
Limestraël limestrael at gmail.com writes:

 (*) functional language, because I want to keep the benefit of functional
 programming for scripting. So no Lua, no Python...

You might want to take another look at lua. It is pretty darn functional. Also
fast, small, and seems to be even easier to embed in haskell than in c.

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


Re: [Haskell-cafe] class Arbitrary in quickcheck

2010-05-05 Thread Ozgur Akgun
There is a typo, in my previous post, It should have been: prop_2 v1 v2 = v1
== v2
not: prop_2 v1 v2 = v2 == v2

Moreover, I realised that the (nice) function verboseCheck doesn't exist in
QuickCheck 2. However you can always do the following in ghci, to see
whether my suggestion works or not:

sample (arbitrary :: Gen (Maybe Double, Maybe Double) )


On 5 May 2010 09:01, Ozgur Akgun ozgurak...@gmail.com wrote:

 your quick check property (in a different way of writing) is the following:

 prop_1 :: Maybe Double - Bool
 prop_1 v = v == v

 but what you want is actually the following:

 prop_2 :: Maybe Double - Maybe Double - Bool
 prop_2 v1 v2 = v2 == v2

 if I understood the problem correctly, using prop_2 should solve it. just
 run 
 verboseCheckhttp://hackage.haskell.org/packages/archive/QuickCheck/1.1.0.0/doc/html/Test-QuickCheck.html#v:verboseCheckon
  these two and observe the results.

 Best,




 On 5 May 2010 08:47, Tim Docker t...@dockerz.net wrote:

 I've notice a behaviour of quickcheck that is unexpected to me. With
 this code:

 import Test.QuickCheck

 main = check myconfig
 ((\v - v == v) :: (Maybe Double,Maybe Double) - Bool)

 myconfig = defaultConfig{configMaxTest=10,
 configEvery = \n args - show n ++ :\n
  ++ unlines args}

 I am relying on the default Arbitrary instances to generate pairs of
 maybe doubles. But to my surprise, all of the pairs have these patterns:

(Just _ Just _)
(Nothing, Nothing)

 I never see patterns:

(Just _, Nothing)
(Nothing, Just _)

 Why is this the case?

 Thanks,

 Tim






 ___
 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


[Haskell-cafe] Re: Is anyone using Haddock's support for frames?

2010-05-05 Thread Tristan Allwood
+1 to keep it until equivalent functionality is made mainline

I've had tinyurl.com/haskelldoc aliased to the main frame page
(http://www.haskell.org/ghc/docs/6.12.2/html/libraries/frames.html) and
used it extensively on a daily basis for GHC libraries and GHC API
browsing.  Navigating the current non-framed, disparate, seperate
documetation feels painful and slow.  I would note though that the
frames pages arn't currently working on hackage:
e.g. 
http://hackage.haskell.org/packages/archive/text/0.7.1.0/doc/html/frames.html).

BTW, I would point out the two best documentation systems I've seen in
other languages (javadoc[1] and rubydock[2]) are frame based and (IMO)
very easy to navigate.

[1] http://java.sun.com/javase/6/docs/api/ 
[2] http://www.ruby-doc.org/core/

Cheers,

Tris


On Tue, May 04, 2010 at 08:19:45PM +0200, David Waern wrote:
 Hi
 
 Since version 2.4.0 Haddock has generated HTML output that uses frames
 (index-frames.html) in addition to the normal output. We'd like to
 deprecate this feature unless there is a significant amount of users.
 The reason is two-fold:
 
   * We probably want to replace the frames with something more modern
 (like a sidebar on the same page) in the future
 
   * We are rewriting the HTML backend and it would be nice to avoid
 unnecessary work
 
 So if you're using this feature and want to keep it, please speak up!
 
 cc:ing cvs-ghc@ in case they have any users of the frames due to the
 size of the GHC code base. (This might have been the the original
 motivation for the feature).
 
 Thanks,
 David
 
 ___
 Cvs-ghc mailing list
 cvs-...@haskell.org
 http://www.haskell.org/mailman/listinfo/cvs-ghc
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] nun.haskell.org http services down?

2010-05-05 Thread Roel van Dijk
I think it would be nice in general to be able to mirror at least
hackage.haskell.org. Something like rsync would be close to ideal for
this purpose.

Reasons I would like to mirror hackage:
1 - Provide alternative when the main hackage is down
2 - Access to the sources of all uploaded packages for analysis purposes
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] nun.haskell.org http services down?

2010-05-05 Thread Henning Thielemann


On Wed, 5 May 2010, Roel van Dijk wrote:


I think it would be nice in general to be able to mirror at least
hackage.haskell.org. Something like rsync would be close to ideal for
this purpose.

Reasons I would like to mirror hackage:
1 - Provide alternative when the main hackage is down
2 - Access to the sources of all uploaded packages for analysis purposes


It would be also interesting to have alternative upload servers. That's 
certainly more complicated, but I know that the AmiNet manages this 
problem, e.g.:

  http://de.aminet.net/
 The secondary upload servers queue the uploads and forward it to the main 
server, when it is available.

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


Re: [Haskell-cafe] Fwd: Error instaling Happstack on Windows - cabal bug?

2010-05-05 Thread Ivan Lazar Miljenovic
Stephen Tetley stephen.tet...@gmail.com writes:

 Hi all

 A cursory look at Happstack.Crypto.MD5 shows it uses -fvia-c:


 {-# LANGUAGE BangPatterns #-}
 {-# OPTIONS_GHC -funbox-strict-fields -fvia-c -optc-funroll-all-loops
 -optc-O3 #-}

I would hazard a guess that this is at an attempt to improve performance
(I wouldn't know if it actually does or not though).

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: precis-0.3.1 - Cabal package diff tool

2010-05-05 Thread Stephen Tetley
Hi Henning

Thanks.

I'm open to suggests for prettifying the output, or adding further
comparisons. While coding precis, I decided that trying to police
version numbers would be impractical so I decided to focus on
changes/diffs instead.

By the way - on the Package version policy page, Section 2 (Version
Numbers) takes a lot of reading to make sense of (and I'm notionally a
native English speaker). Maybe item 3 should state that D increases
rather than the nebulus other version components.

http://www.haskell.org/haskellwiki/Package_versioning_policy

Best wishes

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


Re: [Haskell-cafe] class Arbitrary in quickcheck

2010-05-05 Thread Tim Docker
On 5 May 2010 09:01, Ozgur Akgun ozgurak...@gmail.com wrote:
 your quick check property (in a different way of writing) is
 the following:
 
 prop_1 :: Maybe Double - Bool
 prop_1 v = v == v

I think you misunderstood me. The property was fabricated just for  
the example.

My question was why, when I generate random values for (Maybe t, Maybe  
t) using the Arbitrary type class, do I always see two Nothing values  
or two Just values, and never one of each?

Tim


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


Re: [Haskell-cafe] ANN: precis-0.3.1 - Cabal package diff tool

2010-05-05 Thread Henning Thielemann


On Wed, 5 May 2010, Stephen Tetley wrote:


I'm open to suggests for prettifying the output, or adding further
comparisons. While coding precis, I decided that trying to police
version numbers would be impractical so I decided to focus on
changes/diffs instead.


Sure, but it helps to get an approximation of the necessary version bumps, 
right?



By the way - on the Package version policy page, Section 2 (Version
Numbers) takes a lot of reading to make sense of (and I'm notionally a
native English speaker). Maybe item 3 should state that D increases
rather than the nebulus other version components.

http://www.haskell.org/haskellwiki/Package_versioning_policy


I have not written the body of that page. Since it is a wiki feel free to 
improve whatever you think must be improved.



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


[Long] Re: [Haskell-cafe] Re: Why cabal forces reinstallation of happstack-utils?

2010-05-05 Thread Maciej Piechotka
On Wed, 2010-05-05 at 12:13 +1000, Ivan Miljenovic wrote:
 On 5 May 2010 12:04, Maciej Piechotka uzytkown...@gmail.com wrote:
  1. I downloaded happstack-utile[1]
  2. Edited cabal file
  3. Installed it successfully linking with parsec 3.1
  4. I tried to run cabal install happstack --constraint 'parsec = 3'
  5. It complains that happstack-utile needs to be installed against
  parsec 2
 
  [1] Now it is HStringTemplate but problem is the same
 
 Did you try editing the HStringTemplate cabal file to remove its
 constraint against parsec = 3?
 

Yes. See point 2.

 Also, is there any reason why you're forcing that constraint through
 (yes, upstream should start using parec-3, but why use --constraint to
 try and force it yourself)?
 

Because it would download and rebuild packages on its own:
% cabal install happstack --dry-run -v
/usr/bin/ghc --numeric-version
looking for package tool: ghc-pkg near compiler in /usr/bin
found package tool in /usr/bin/ghc-pkg
/usr/bin/ghc-pkg --version
/usr/bin/ghc --supported-languages
Reading installed packages...
/usr/bin/ghc-pkg dump --global
/usr/bin/ghc-pkg dump --user
/usr/bin/ghc --print-libdir
Reading available packages...
Resolving dependencies...
selecting happstack-0.5.0 (hackage) and discarding HStringTemplate-0.2,
0.3,
0.3.1, 0.3.2, 0.4, 0.4.1, 0.4.2, happstack-0.2.1, 0.3.1, 0.3.2, 0.4.1,
happstack-data-0.1, 0.2.1, 0.3.1, 0.3.2, 0.3.3, 0.4.1,
happstack-ixset-0.1,
0.2.1, 0.3.1, 0.3.2, 0.4.1, happstack-server-0.1, 0.2.1, 0.3.1, 0.3.2,
0.3.3,
0.4.1, happstack-state-0.1, 0.2.1, 0.3.1, 0.3.2, 0.3.3, 0.3.4, 0.4.1,
happstack-util-0.1, 0.2.1, 0.3.1, 0.3.2, 0.4.1, harp-0.2.1, hsp-0.2,
0.4,
0.4.4, 0.4.5, 0.5.0, 0.5.1, hsx-0.4, 0.4.4, 0.4.5, 0.4.6, 0.4.8, 0.5.0,
0.5.1,
0.5.2, 0.5.5, 0.5.6, 0.6.0, 0.6.1 and 0.6.2
selecting happstack-data-0.5.0 (hackage) and discarding HaXml-1.19,
1.19.1,
1.19.2, 1.19.3, 1.19.4, 1.19.5, 1.19.6, 1.19.7, 1.20, 1.20.1, 1.20.2,
syb-with-class-0.1, 0.2, 0.3, 0.4, 0.5, 0.5.1, 0.6, text-0.1, 0.2, 0.3,
0.4,
0.5, 0.6, 0.7, 0.7.0.1, time-1.0, 1.1.2.0, 1.1.2.1, 1.1.2.2, 1.1.2.3,
1.1.2.4
and 1.1.3
selecting happstack-server-0.5.0 (hackage) and discarding sendfile-0.1,
0.2,
0.3, 0.3.1, 0.4, 0.5, utf8-string-0.1, 0.2, 0.3, 0.3.1, 0.3.1.1, 0.3.2
and
0.3.3
selecting happstack-state-0.5.0 (hackage)
selecting harp-0.4 (installed or hackage)
selecting hsp-0.5.2 (installed or hackage) and discarding HJScript-0.4,
0.4.4,
0.4.5, 0.4.6, 0.4.7, 0.4.8 and 0.4.9
selecting HJScript-0.5.0 (installed or hackage) and discarding
HJavaScript-0.4, 0.4.4 and 0.4.5
selecting hsx-0.7.0 (installed or hackage) and discarding
haskell-src-exts-0.2.1, 0.3.2, 0.3.3, 0.3.4, 0.3.5, 0.3.7, 0.3.9,
0.3.10,
0.3.11, 0.3.12, 0.4.1, 0.4.2, 0.4.3, 0.4.3.1, 0.4.4, 0.4.4.1, 0.4.5,
0.4.6,
0.4.8, 0.5.2, 0.5.3, 0.5.4, 0.5.5, 0.5.6, 0.5.7, 1.0.0, 1.0.1, 1.1.0,
1.1.1,
1.1.3, 1.1.3.1, 1.1.4, 1.2.0, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5
and
1.4.0
selecting sendfile-0.6.1 (hackage)
selecting syb-with-class-0.6.1 (installed or hackage) and discarding
template-haskell-2.2.0.0, 2.3.0.0 and 2.3.0.1
selecting syb-with-class-instances-text-0.0.1 (installed or hackage)
selecting text-0.7.1.0 (installed or hackage) and discarding
deepseq-1.0.0.0
selecting deepseq-1.1.0.0 (installed or hackage) and discarding
array-0.1.0.0,
containers-0.1.0.0 and 0.1.0.1
selecting ghc-prim-0.2.0.0 (installed)
selecting ffi-1.0 (installed)
selecting rts-1.0 (installed)
selecting zlib-0.5.2.0 (installed or hackage) and discarding zlib-0.2,
0.3,
0.4, 0.4.0.1, 0.4.0.2, 0.4.0.3, 0.4.0.4 and 0.5.0.0
selecting html-1.0.1.2 (installed or hackage) and discarding html-1.0
and
1.0.1.1
selecting xhtml-3000.2.0.1 (installed or hackage) and discarding
xhtml-3000.0.0, 3000.0.1, 3000.0.2.1, 3000.0.2.2, 3000.1.0.0 and
3000.2.0.0
selecting stm-2.1.1.2 (installed or hackage) and discarding stm-2.1,
2.1.1.0
and 2.1.2.0
selecting happstack-ixset-0.5.0.1 (hackage) and discarding
happstack-ixset-0.5.0
selecting happstack-util-0.5.0.1 (installed or hackage) and discarding
SMTPClient-0.1, 0.2, 0.3, 1.0, 1.0.1, happstack-util-0.5.0, network-2.0
and
2.1.0.0
selecting SMTPClient-1.0.2 (installed or hackage) and discarding
hsemail-1.0,
1.1, 1.2, 1.3, 1.4 and 1.5
selecting hsemail-1.6 (installed or hackage)
selecting unix-compat-0.1.2.1 (installed or hackage) and discarding
unix-compat-0.1, 0.1.1 and 0.1.2.0
selecting strict-concurrency-0.2.3 (installed or hackage) and discarding
strict-concurrency-0.1, 0.2, 0.2.1 and 0.2.2
selecting hslogger-1.0.10 (installed or hackage) and discarding
hslogger-1.0.2, 1.0.4, 1.0.5, 1.0.6, 1.0.7 and 1.0.9
selecting binary-0.5.0.2 (installed or hackage) and discarding
binary-0.2,
0.3, 0.4, 0.4.1, 0.4.2, 0.4.3, 0.4.3.1, 0.4.4, 0.5 and 0.5.0.1
selecting MaybeT-0.1.2 (hackage) and discarding MaybeT-0.1.0 and 0.1.1
selecting HaXml-1.13.3 (hackage) and discarding HaXml-1.13.2
selecting network-2.2.1.7 (installed or hackage) and discarding
network-2.2.0.0, 2.2.0.1, 2.2.1, 2.2.1.1, 2.2.1.2, 2.2.1.3, 2.2.1.4,
2.2.1.5
and 

Re: [Long] Re: [Haskell-cafe] Re: Why cabal forces reinstallation of happstack-utils?

2010-05-05 Thread Ivan Lazar Miljenovic
Maciej Piechotka uzytkown...@gmail.com writes:
 Also, I note that you seem to use the Gentoo Haskell overlay (as
 you've made bug reports about it) but you're also building packages by
 hand; this can also lead to problems (don't mix your packages kids!).
 

 Possibly but:
  - I'd like to have gtk2hs, haskell-platform and ghc on system level
 instead of compiling it on my own. With exception of darcs i'm not using
 anything else from there.
  - Haskell overlay don't have all packages I need sufficiently fast.
 Well - it don't have everything I need in the first place.

Well, we only update and include packages that _we_ know about and use;
if a package is out of date or you want a new one, pop in to
#gentoo-haskell and ask use.

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: ANNOUNCE: happstack 0.5.0

2010-05-05 Thread Jeremy Shaw


On May 4, 2010, at 11:20 PM, Michael Snoyman wrote:


Hey Jeremy,

I see below that you included the experimental WAI support. I'm  
excited to try it out, but I don't see it in happstack-server (maybe  
I'm blind). Could you point it out?


Hello,

I should have been more explicit about this, sorry about that. The  
experimental WAI support is only available via darcs, in the happstack- 
wai sub-directory.


darcs get http://patch-tag.com/r/mae/happstack
cd happstack/happstack-wai

You can browse here:

http://www.patch-tag.com/r/mae/happstack/snapshot/current/content/pretty/happstack-wai

The core is mostly there, though it is missing some of the Guards, and  
the FileServe module.


Probably less than a day to finish it off I guess. Would be nice to  
do that now that 0.5 is out.


The happstack-wai version would not be a drop-in replacement for  
happstack-server. There are some differences, such as the wai version  
supporting enumerators :) But, porting from happstack-server to  
happstack-wai should not require major changes.


What remains to be seen is if happstack-wai actually provides better  
performance than happstack-server.


alas, there is no happstack-wai specific demo at the moment. But, if  
there was, it would look a lot like a normal happstack-server app...


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


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-05 Thread Limestraël
How do you embed Lua in Haskell?

2010/5/5 Niclas W nicl...@gmail.com

 Limestraël limestrael at gmail.com writes:

  (*) functional language, because I want to keep the benefit of functional
  programming for scripting. So no Lua, no Python...

 You might want to take another look at lua. It is pretty darn functional.
 Also
 fast, small, and seems to be even easier to embed in haskell than in c.

 ___
 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] Re: Haskell and scripting

2010-05-05 Thread Ivan Lazar Miljenovic
Limestraël limestr...@gmail.com writes:

 How do you embed Lua in Haskell?

http://hackage.haskell.org/package/hslua

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] class Arbitrary in quickcheck

2010-05-05 Thread Ozgur Akgun
On 5 May 2010 11:38, Tim Docker t...@dockerz.net wrote:

 On 5 May 2010 09:01, Ozgur Akgun ozgurak...@gmail.com wrote:
  your quick check property (in a different way of writing) is
  the following:
 
  prop_1 :: Maybe Double - Bool
  prop_1 v = v == v

 I think you misunderstood me. The property was fabricated just for
 the example.


OK that's possible :)



 My question was why, when I generate random values for (Maybe t, Maybe
 t) using the Arbitrary type class, do I always see two Nothing values
 or two Just values, and never one of each?


Let me try to understand you then. What happens when you run the following
command in ghci?

sample (arbitrary :: Gen (Maybe Int, Maybe Int) )

Do you still always get (Just _, Just _) or (Nothing, Nothing) pairs, or do
you also get some (Nothing, Just _) or (Just _, Nothing) pairs?

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


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-05 Thread Limestraël
Thanks!

However, I don't forget that my goal is to get a system monitor
configuration language.

Lua may have some functional components, it remains imperative, I think a
more declarative language like Scheme would be more appropriate (and there
is also a scheme interpreter, haskeem).
What do you think about it?


2010/5/5 Ivan Lazar Miljenovic ivan.miljeno...@gmail.com

 Limestraël limestr...@gmail.com writes:

  How do you embed Lua in Haskell?

 http://hackage.haskell.org/package/hslua

 --
 Ivan Lazar Miljenovic
 ivan.miljeno...@gmail.com
 IvanMiljenovic.wordpress.com

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


Re[2]: [Haskell-cafe] Re: Haskell and scripting

2010-05-05 Thread Bulat Ziganshin
Hello Ivan,

Wednesday, May 5, 2010, 4:43:48 PM, you wrote:
 How do you embed Lua in Haskell?
 http://hackage.haskell.org/package/hslua

tutorial: http://haskell.org/haskellwiki/HsLua


-- 
Best regards,
 Bulatmailto:bulat.zigans...@gmail.com

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


Re: [Haskell-cafe] Re: ANNOUNCE: happstack 0.5.0

2010-05-05 Thread Michael Snoyman
On Wed, May 5, 2010 at 2:41 PM, Jeremy Shaw jer...@n-heptane.com wrote:


 On May 4, 2010, at 11:20 PM, Michael Snoyman wrote:

 Hey Jeremy,

 I see below that you included the experimental WAI support. I'm excited to
 try it out, but I don't see it in happstack-server (maybe I'm blind). Could
 you point it out?


 Hello,

 I should have been more explicit about this, sorry about that. The
 experimental WAI support is only available via darcs, in the happstack-wai
 sub-directory.

 darcs get http://patch-tag.com/r/mae/happstack
 cd happstack/happstack-wai

 You can browse here:


 http://www.patch-tag.com/r/mae/happstack/snapshot/current/content/pretty/happstack-wai

 The core is mostly there, though it is missing some of the Guards, and the
 FileServe module.

 Probably less than a day to finish it off I guess. Would be nice to do
 that now that 0.5 is out.

 The happstack-wai version would not be a drop-in replacement for
 happstack-server. There are some differences, such as the wai version
 supporting enumerators :) But, porting from happstack-server to
 happstack-wai should not require major changes.

 What remains to be seen is if happstack-wai actually provides better
 performance than happstack-server.

 alas, there is no happstack-wai specific demo at the moment. But, if there
 was, it would look a lot like a normal happstack-server app...

 - jeremy


It wouldn't look like a normal WAI app? If you want something like that,
Simon Hengel wrote a nice Hello World for WAI; it's available in the github
repo[1].

As far as performance goes, I can't imagine you'd see any significant
difference without an enumerator-biased test, but I could be wrong. If you
want to try something, I'd suggest outputting the contents of a file
(obviously without the sendfile syscall). If you want help writing a WAI
version, let me know, I'd be interested in the results of a comparison.

Michael

[1] http://github.com/snoyberg/wai/blob/master/README.lhs
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Why cabal forces reinstallation of happstack-utils?

2010-05-05 Thread Henning Thielemann
Maciej Piechotka schrieb:
 On Wed, 2010-05-05 at 01:09 +0200, Daniel Fischer wrote:
 On Mittwoch 05 Mai 2010 00:55:38, Maciej Piechotka wrote:
 I try to configure happstack with parsec 3.1. It seems to fail due to
 cabal:

 happstack-util.cabal says parsec  3, so --constraint=parsec  3 and the 
 given dependencies are incompatible, hence it can't be configured.

 Probably parsec  3 was specified because parsec-3.0 was significantly 
 slower than parsec-2.*.
 
 I updated local copy, as shown, but cabal wants to rebuild it anyway. My
 question was rather why the repo is considered at all when the package
 is installed.

Surprisingly using plain Cabal (runhaskell Setup configure; runhaskell
Setup build; runhaskell Setup install) often works in these cases.
Cabal-install is somehow too clever and if it cannot resolve the
dependencies it thinks this must be impossible. If it finds a package,
that it could not have installed by itself, it tries to install it by
itself.

First I thought that this due to cabal-install trying to find
appropriate flag assignments by itself. However, Duncan Coutts told me
that plain Cabal tries this as well. I have no idea, what the key
difference between cabal-install and plain Cabal is.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Anglohaskell preparations?

2010-05-05 Thread Philippa Cowderoy
Hi everyone. It's just over three months until the traditional time for 
Anglohaskell, so I wanted to ask: is anyone willing to step up and run 
it this year? We had a volunteer at last year's event, but I've 
forgotten who. It was also suggested that emails about the organisation 
and planning of the event be sent to the Hackathon mailing list, though 
it might be an idea to keep this thread on -cafe for now.


If the event's going to run, we really need to try for dates and a venue 
in the next month or so. It's been a great event in previous years, and 
I'd love for it to happen again!


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


Re: [Haskell-cafe] Re: ANNOUNCE: happstack 0.5.0

2010-05-05 Thread Jeremy Shaw


On May 5, 2010, at 8:01 AM, Michael Snoyman wrote:


alas, there is no happstack-wai specific demo at the moment. But, if  
there was, it would look a lot like a normal happstack-server app...


It wouldn't look like a normal WAI app? If you want something like  
that, Simon Hengel wrote a nice Hello World for WAI; it's available  
in the github repo[1].




Actually, I am wrong, I did have a little demo app:

http://www.patch-tag.com/r/mae/happstack/snapshot/current/content/pretty/happstack-wai/Main.hs

It looks exactly like a normal happstack app, and offers no clues that  
it is WAI based.


main :: IO ()
main = simpleHTTP 8000 $
   msum [ dir foo $ ok $ toResponse foo -- handles /foo
, dir bar $ ok $ toResponse bar -- handles /bar
, do nullDir-- handles /
 ok $ toResponse hello
, notFound $ toResponse Invalid URL -- handles anything  
else

]

In this demo, the routing  dispatching is handled by the filter  
combinators such as 'dir' and 'nullDir' (there are also ones like  
'path' which can be used for path components which represent  
'variable' components such as integers). The combinators are based  
around MonadPlus -- hence the use of msum to combine them. They are  
tried in the order presented until one matches completely and returns  
a 'Response'. Of course, we could use web-routes instead.


the functions like, 'ok' and 'notFound' take care of setting the  
response code.


The 'toResponse' function takes care of converting the values (in this  
case strings) to a 'Response', and setting the Content-type.


There are other features not shown here, such as looking up values  
submitted as POST data , via the query string, or as cookies. There is  
also stuff for dealing with exceptions, escaping early and returning a  
Response, ways to apply filters (such as gzip compression), ways to  
add on-the-fly validation (of html or other content types), and more!


It is this high-level interface that makes happstack-server  
interesting. Hence the interest in using WAI for the 'backend' stuff  
that isn't really all that visible in the first place.



As far as performance goes, I can't imagine you'd see any  
significant difference without an enumerator-biased test, but I  
could be wrong. If you want to try something, I'd suggest outputting  
the contents of a file (obviously without the sendfile syscall). If  
you want help writing a WAI version, let me know, I'd be interested  
in the results of a comparison.


As for 'performance', there is the raw speed. But also issues like  
stability and reliability. And bugs. Or fixes for real-world usage.  
For example, implementing cookie handling by the spec does not quite  
work. There are some workarounds needed to handle cookies issued by  
google. And webkit and chrome browsers have issues with double quotes  
around the domain. Of course, these are also the reasons, ultimately,  
to use WAI. Instead of everyone having to learn that cookies are  
broken, and fix them in every framework, we can just do the hacks  
once, and everyone wins.


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


Re: [Haskell-cafe] Re: Why cabal forces reinstallation of happstack-utils?

2010-05-05 Thread Daniel Fischer
On Wednesday 05 May 2010 15:45:38, Henning Thielemann wrote:
 Maciej Piechotka schrieb:
  On Wed, 2010-05-05 at 01:09 +0200, Daniel Fischer wrote:
  On Mittwoch 05 Mai 2010 00:55:38, Maciej Piechotka wrote:
  I try to configure happstack with parsec 3.1. It seems to fail due
  to cabal:
 
  happstack-util.cabal says parsec  3, so --constraint=parsec  3
  and the given dependencies are incompatible, hence it can't be
  configured.
 
  Probably parsec  3 was specified because parsec-3.0 was
  significantly slower than parsec-2.*.
 
  I updated local copy, as shown, but cabal wants to rebuild it anyway.
  My question was rather why the repo is considered at all when the
  package is installed.

Maciej, if you need to edit further .cabal files, you could make a minor-
minor version bump, x.y.z - x.y.z.1 e.g., maybe that would convince cabal-
install not to reinstall.


 Surprisingly using plain Cabal (runhaskell Setup configure; runhaskell
 Setup build; runhaskell Setup install) often works in these cases.

That's not surprising.
runhaskell ./Setup.hs configure
can only go by what the .cabal file in the current directory and ghc-pkg 
say. If you edit the .cabal file to install e.g. happstack-util-0.5.0 with 
parsec-3, the changed .cabal file and the ghc-pkg output are consistent, so 
Cabal sees no reason to reinstall.

cabal-install presumably looks at the downloaded index from Hackage (it 
must recursively follow the dependencies to see which of them must be 
installed before [and in which order]).
The happstack-util .cabal file there says parsec  3.
But ghc-pkg says
- there is no parsec  3 installed
or
- happstack-util-0.5.0 was built with parsec-3.*
(don't know which check comes first if both are made).
That is inconsistent with what cabal-install knows from other sources, 
hence it assumes it's broken.


 Cabal-install is somehow too clever and if it cannot resolve the
 dependencies it thinks this must be impossible. If it finds a package,
 that it could not have installed by itself, it tries to install it by
 itself.

 First I thought that this due to cabal-install trying to find
 appropriate flag assignments by itself. However, Duncan Coutts told me
 that plain Cabal tries this as well. I have no idea, what the key
 difference between cabal-install and plain Cabal is.

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


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-05 Thread Uwe Hollerbach
As the author of haskeem, I'm thrilled that you are considering it,
but to be honest I'm not quite sure it's embeddable in the way (I
think) you want. If you want to give it a try, though, I'd be more
than happy to try to help.

best, Uwe

On 5/5/10, Limestraël limestr...@gmail.com wrote:
 Thanks!

 However, I don't forget that my goal is to get a system monitor
 configuration language.

 Lua may have some functional components, it remains imperative, I think a
 more declarative language like Scheme would be more appropriate (and there
 is also a scheme interpreter, haskeem).
 What do you think about it?


 2010/5/5 Ivan Lazar Miljenovic ivan.miljeno...@gmail.com

 Limestraël limestr...@gmail.com writes:

  How do you embed Lua in Haskell?

 http://hackage.haskell.org/package/hslua

 --
 Ivan Lazar Miljenovic
 ivan.miljeno...@gmail.com
 IvanMiljenovic.wordpress.com


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


[Haskell-cafe] lhs2TeX - lhs2TeX.fmt missing

2010-05-05 Thread Ozgur Akgun
Hi all,

I am trying to get lhs2TeX to work. I installed the package using cabal, and
now I try to run it on a very simple *.lhs file.

But it blames me and says user error, cannot find lhs2TeX.fmt:

lhs2TeX: user error (File `lhs2TeX.fmt' not found in search path:

And, when I check the search path, there really is no lhs2TeX.fmt file.
Should I download it separately or something like that?

PS: Thanks for the great package to the authors!

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


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-05 Thread Yitzchak Gale
Maciej Piechotka wrote:
 After change of file you have to wait a long time as it compiles and
 links with yi.

But Yi is a far bigger application than what Limestraël is talking
about. One of my computers is very old and much
less powerful than yours (let's just say that it has far less than
1 Gb memory in total). On that machine, xmonad, still much
larger than Limestraël's app, recompiles its configuration file
almost instantaneously. And of course, even that
fast recompile only happens when I change the configuration,
which is almost never.

I would try the xmonad approach to scripting in Haskell.
It is much simpler to implement than any of the others,
and much neater if you find that it works well.

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


[Haskell-cafe] Benchmarks game updated to ghc 6.12.2

2010-05-05 Thread Isaac Gouy
Ketil Malde ketil at malde.org writes:

 As for code size, the programs are heavily tuned for speed. 

iirc there was a community effort 2 or 3 years ago, but now ghc has changed 
enough that the compiler and runtime parameters seem to need re-tuning.


 Is it an idea to go back a few steps to more idiomatic code?  Perhaps as a 
 separate track? 

There's always room for 2 or 3 Haskell programs per task - not necessarily The 
Good, the Bad and the Ugly - but you'll already find the cliched example of a 
faster more convoluted Haskell program and a more concise but slower Haskell 
program.

(Idiomatic code? Aren't there idioms for writing fast Haskell too?) 


 I also worry a bit that source code optimization for a specific
 compiler makes it more difficult to take advantage of compiler
 optimization improvements. 

These are tiny tiny programs - when those compiler optimization improvements 
arrive re-write the programs to take advantage of them ;-)


  

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


Re: [Haskell-cafe] Benchmarks game updated to ghc 6.12.2

2010-05-05 Thread Don Stewart
igouy2:
 Ketil Malde ketil at malde.org writes:
 
  As for code size, the programs are heavily tuned for speed. 
 
 iirc there was a community effort 2 or 3 years ago, but now ghc has
 changed enough that the compiler and runtime parameters seem to need
 re-tuning.

Even longer ago -- some of those 'optimized' programs date to 2005 if I
recall.

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


[Haskell-cafe] Re: Interest in a Mathematics AI strike force ?

2010-05-05 Thread Neal Alexander

Alp Mestanogullari wrote:

Hello -cafe,

When I started learning Haskell, I saw the AI page [1] which aimed at 
creating a sound, uniform and handy framework for AI programming in 
Haskell. I added my name on it and thought a bit about it. I even wrote 
a first version of HNN [2], a neural network library, quite early in my 
Haskell days.


I found that idea to be great but did not see any actual effort around 
this. So, I'm now thinking again about that and even enlarging it to 
mathematics  AI. Thus, I would like to have an idea of the number of 
people interested in being involved in such an effort. There are several 
tools out there on hackage but they aren't that much uniform and neither 
play nicely together. I'm pretty convinced this could be improved and as 
a Mathematics student I'm highly interested in that. If enough people 
are interested, we could for example set up a mailing list and a trac to 
organize the effort and then people could just discuss and write Haskell 
modules when time permits.


Any comment, idea, reaction, interest ?

[1] http://www.haskell.org/haskellwiki/AI
[2] http://www.haskell.org/haskellwiki/HNN

--
Alp Mestanogullari
http://alpmestan.wordpress.com/
http://alp.developpez.com/




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


Yea, I'm interested. Over the last several months I've been reading a 
few books on AI and have been trying to distill a Haskell library out of 
them:


The library is pretty primitive so far, but this is what i have laid out:

- Neural Networks (usable)
- Blackboard Architecture (work in progress)
- FSM (usable)
- Genetic Algorithms (usable)
- Goal Oriented Behaviors (work in progress)
- Goal Oriented Planning (work in progress)
- Markov Chains (work in progress)
- Steering (usable)
- Fuzzy Logic (usable)
- Decision Tree (work in progress)

At the moment I'm working on some constrained delaunay triangulation 
algorithms to use for spatial reasoning / path planning.



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


[Haskell-cafe] Would it be evil to add deriving Typeable to newtype Q?

2010-05-05 Thread Leonel Fonseca
Hi everybody,

Is it reasonable to add deriving Typeable to newtype Q?

In case you wonder why I want to do that, it is because I've constructed a Q
[Dec] inside a monad, I want to extract  it from the monad (via runIO) and
the monad has constraint Typeable over this parameter.

I've also tried to write the Typeable instance in my own module (not
Language.Haskell.TH.Syntax). But I've got no luck since the Q type
constructor is exported but the data constructor is not.

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


Re: [Haskell-cafe] Re: Interest in a Mathematics AI strike force ?

2010-05-05 Thread Alp Mestanogullari
On Wed, May 5, 2010 at 6:10 PM, Neal Alexander relapse@gmx.com wrote:

 Yea, I'm interested. Over the last several months I've been reading a few
 books on AI and have been trying to distill a Haskell library out of them:

 The library is pretty primitive so far, but this is what i have laid out:

 - Neural Networks (usable)
 - Blackboard Architecture (work in progress)
 - FSM (usable)
 - Genetic Algorithms (usable)
 - Goal Oriented Behaviors (work in progress)
 - Goal Oriented Planning (work in progress)
 - Markov Chains (work in progress)
 - Steering (usable)
 - Fuzzy Logic (usable)
 - Decision Tree (work in progress)

 At the moment I'm working on some constrained delaunay triangulation
 algorithms to use for spatial reasoning / path planning.


That looks awesome!

Would you have some time to drop by the #haskell-math IRC channel ?

I'm planning to ask for a mailing list and a wiki for the project because a
single mailing list thread won't be of help here. But for the moment most
discussions happen on #haskell-math.

Anyway, would you be willing to integrate your library in that project ?

Side note : we're currently discussing the minimal algebra framework we will
have to ship with the library, letting us implement general algorithms
instead of specific ones (why being restricted to integers when any group /
ring / field can be used ? etc).

-- 
Alp Mestanogullari
http://alpmestan.wordpress.com/
http://alp.developpez.com/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Interest in a Mathematics AI strike force ?

2010-05-05 Thread Ron Alford
On Wed, May 5, 2010 at 12:10 PM, Neal Alexander relapse@gmx.com wrote:
 - Goal Oriented Behaviors (work in progress)
 - Goal Oriented Planning (work in progress)

I have a library for PDDL parsing and representation[1] that I used in
a recent paper.  It's heavy complex types to deal with various
extensions to the language.  I'm currently updating it for another
project, so if you're interested, please let me know!

-Ron

[1] http://www.cs.umd.edu/projects/planning/data/alford09translating/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Interest in a Mathematics AI strike force ?

2010-05-05 Thread Alp Mestanogullari
That could be interesting. I guess we can discuss its integration, and how
it would be done. Thus, you may be interested in my next message, about the
mailing list and the repository. Thanks for your interest!

On Wed, May 5, 2010 at 8:03 PM, Ron Alford ronw...@volus.net wrote:

 On Wed, May 5, 2010 at 12:10 PM, Neal Alexander relapse@gmx.com
 wrote:
  - Goal Oriented Behaviors (work in progress)
  - Goal Oriented Planning (work in progress)

 I have a library for PDDL parsing and representation[1] that I used in
 a recent paper.  It's heavy complex types to deal with various
 extensions to the language.  I'm currently updating it for another
 project, so if you're interested, please let me know!

 -Ron

 [1] http://www.cs.umd.edu/projects/planning/data/alford09translating/
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe




-- 
Alp Mestanogullari
http://alpmestan.wordpress.com/
http://alp.developpez.com/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: lhs2TeX - lhs2TeX.fmt missing

2010-05-05 Thread Pierre-Etienne Meunier
By the way, if someone on this list has got too much time, he could write 
something that would fulfill the goals of literate programming -- à la web and 
cweb.
Knuth was able to make books with his source code. I believe that lhs2tex is 
great for classes about haskell or fp, but I never found it satisfying for 
programs with several modules, for instance.



El 05/05/2010, a las 12:42, Ozgur Akgun escribió:

 OK, I've found them!
 
 They were under /Users/username/.cabal/share/lhs2tex-1.15 and this path was 
 not in the search path of lhs2TeX.
 I'm using Snow Leoprad. This might be a bug I guess?
 
 Anyway, problem solved for me.
 
 Best,
 
 On 5 May 2010 16:03, Ozgur Akgun ozgurak...@gmail.com wrote:
 Hi all,
 
 I am trying to get lhs2TeX to work. I installed the package using cabal, and 
 now I try to run it on a very simple *.lhs file.
 
 But it blames me and says user error, cannot find lhs2TeX.fmt:
 
 lhs2TeX: user error (File `lhs2TeX.fmt' not found in search path:
 
 And, when I check the search path, there really is no lhs2TeX.fmt file. 
 Should I download it separately or something like that?
 
 PS: Thanks for the great package to the authors!
 
 Best,
 Ozgur Akgun
 
 
 
 -- 
 Ozgur Akgun
 ___
 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] Re: Interest in a Mathematics AI strike force ?

2010-05-05 Thread Alp Mestanogullari
Okay, people, if you're interested in this project, there are several things
you should / may want to do.

First, we now have a mailing list for discussing what should be part of that
project, how things will be organized, etc.
Please subscribe on this page :
http://projects.haskell.org/cgi-bin/mailman/listinfo/hasklab

We also have patch-tag project :
https://patch-tag.com/r/alpmestan/hasklab/home
If you want to participate:
- if you already have a patch-tag account, just contact me (via the mailing
list for example) for adding you to the project, so that you'll be able to
push to the repo
- if you don't have a patch-tag account, sign-up on
http://patch-tag.com/and then ask for being added to the project.
All the details about getting the code or whatever (there is none for the
moment, in the upcoming days most of the activity should be on the mailing
list) are listed on hasklab's patch-tag page.

Finally, we also have a patch-tag wiki, here :
https://patch-tag.com/r/alpmestan/hasklab/wiki/

I will edit it the wiki tonight to give some informations about what we
discussed, the priorities, etc.

Thanks all for your interest, please subscribe to the mailing list in order
to discuss about what people are willing to do, how we should to it, etc.

-- 
Alp Mestanogullari
http://alpmestan.wordpress.com/
http://alp.developpez.com/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell and scripting

2010-05-05 Thread Michael Lazarev
I'm still not always sure how things are done in Haskell, but I'd like
to propose another alternative, or, saying more correctly, I'd like to
question how real this alternative is. What if scripting would be done
with something like lambdabot, mueval or hint? Do scripts always need
to be compiled?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Is anyone using Haddock's support for frames?

2010-05-05 Thread Thomas Schilling
Ok, I think I should clarify.

I believe that the framed view with a long list of modules on the left
and the haddocks on the right is still useful.  What I don't mind
getting rid off is the third frame which shows the contents of the
mini_* files.  I would have preferred to have something similar in the
regular haddock (instead of the synopsis or the contents) make it less
obtrusive by using a small font and make it float: right.  That will
be possible with the new HTML backend so I'm all for removing the
mini_* stuff.

The long list of modules should ideally be grouped by package, but
that can be added later.  I don't think it took longer than a few days
to implement, so it shouldn't be much of an issue to port it over to a
new backend.

On 5 May 2010 10:34, Tristan Allwood t...@zonetora.co.uk wrote:
 +1 to keep it until equivalent functionality is made mainline

 I've had tinyurl.com/haskelldoc aliased to the main frame page
 (http://www.haskell.org/ghc/docs/6.12.2/html/libraries/frames.html) and
 used it extensively on a daily basis for GHC libraries and GHC API
 browsing.  Navigating the current non-framed, disparate, seperate
 documetation feels painful and slow.  I would note though that the
 frames pages arn't currently working on hackage:
 e.g. 
 http://hackage.haskell.org/packages/archive/text/0.7.1.0/doc/html/frames.html).

 BTW, I would point out the two best documentation systems I've seen in
 other languages (javadoc[1] and rubydock[2]) are frame based and (IMO)
 very easy to navigate.

 [1] http://java.sun.com/javase/6/docs/api/
 [2] http://www.ruby-doc.org/core/

 Cheers,

 Tris


 On Tue, May 04, 2010 at 08:19:45PM +0200, David Waern wrote:
 Hi

 Since version 2.4.0 Haddock has generated HTML output that uses frames
 (index-frames.html) in addition to the normal output. We'd like to
 deprecate this feature unless there is a significant amount of users.
 The reason is two-fold:

   * We probably want to replace the frames with something more modern
 (like a sidebar on the same page) in the future

   * We are rewriting the HTML backend and it would be nice to avoid
 unnecessary work

 So if you're using this feature and want to keep it, please speak up!

 cc:ing cvs-ghc@ in case they have any users of the frames due to the
 size of the GHC code base. (This might have been the the original
 motivation for the feature).

 Thanks,
 David

 ___
 Cvs-ghc mailing list
 cvs-...@haskell.org
 http://www.haskell.org/mailman/listinfo/cvs-ghc

 ___
 Cvs-ghc mailing list
 cvs-...@haskell.org
 http://www.haskell.org/mailman/listinfo/cvs-ghc




-- 
Push the envelope.  Watch it bend.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANN: Holumbus-Distribution 0.1.0 - distributed data structures

2010-05-05 Thread Stefan Schmidt
Hello,

after a long year, I've finally managed to upload the new version of
Holumbus-Distribution to Hackage.

Holumbus-Distribution offers distributed data structures like Chan, MVar
or functions. These data types can be used for inter-process
communication. With the help of this library it is possible to build
Erlang-Style mailboxes for an easy implementation of distributed systems
in Haskell.

You can find the library on Hackage at:

http://hackage.haskell.org/package/Holumbus-Distribution

And the project homepage at:

http://www.holumbus.org

(for the current documentation please refer to the example
programs in the source bundle, the Wiki will be updated soon)

The following data structures are implemented so far:

* distributed Chan (DChan)
  like the Chan datatype, but it allows the writing
  and reading from other programs

* distributed MVar (DMVar)
  like the MVar data type, but the content of the
  MVar is shared among multiple programs.

* distributed Functions (DFunction)
  an easy way to do remote procedure calls, just like
  haxr

* distributed Values (DValue)
  a variable which could only be written once and
  which could easily read by other programs

* distributed Streams and Ports (DStream, DPort)
  just like the DChan, but this time, you are only
  allowed to read from the channel from one program

This library was completely rewritten between version 0.0.1 and 0.1.0.
The old packages can be found under Holumbus.Network.* while the new
ones are located at Holumbus.Distribution.*. The old packages will be
removed in future versions (0.2.0).

This library itself is independent from other Holumbus libraries
although it contains some modules which are only to be used by the other
Holumbus libraries but this may change in the near future.

Regards,

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


Re: [Haskell-cafe] Haskell and scripting

2010-05-05 Thread Pierre-Etienne Meunier
Actually lambdabot and mueval use the GHC api, and hint is supposed to be a 
wrapper around it. But using the API directly is quite simple, and the scripts 
are indeed compiled.

I believe that the purpose of scripting an application is adding fun factor to 
it. How many haskell programmers are able to find fun in lua programming ?


El 05/05/2010, a las 14:23, Michael Lazarev escribió:

 I'm still not always sure how things are done in Haskell, but I'd like
 to propose another alternative, or, saying more correctly, I'd like to
 question how real this alternative is. What if scripting would be done
 with something like lambdabot, mueval or hint? Do scripts always need
 to be compiled?
 ___
 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] Re: lhs2TeX - lhs2TeX.fmt missing

2010-05-05 Thread Chris Eidhof
I've generated large LaTeX documents with several modules without too much 
hassle. The key was to use %include a lot, as well as conditionals. Lots of %if 
False around import statements.

-chris

On 5 mei 2010, at 20:18, Pierre-Etienne Meunier wrote:

 By the way, if someone on this list has got too much time, he could write 
 something that would fulfill the goals of literate programming -- à la web 
 and cweb.
 Knuth was able to make books with his source code. I believe that lhs2tex is 
 great for classes about haskell or fp, but I never found it satisfying for 
 programs with several modules, for instance.
 
 
 
 El 05/05/2010, a las 12:42, Ozgur Akgun escribió:
 
 OK, I've found them!
 
 They were under /Users/username/.cabal/share/lhs2tex-1.15 and this path 
 was not in the search path of lhs2TeX.
 I'm using Snow Leoprad. This might be a bug I guess?
 
 Anyway, problem solved for me.
 
 Best,
 
 On 5 May 2010 16:03, Ozgur Akgun ozgurak...@gmail.com wrote:
 Hi all,
 
 I am trying to get lhs2TeX to work. I installed the package using cabal, and 
 now I try to run it on a very simple *.lhs file.
 
 But it blames me and says user error, cannot find lhs2TeX.fmt:
 
 lhs2TeX: user error (File `lhs2TeX.fmt' not found in search path:
 
 And, when I check the search path, there really is no lhs2TeX.fmt file. 
 Should I download it separately or something like that?
 
 PS: Thanks for the great package to the authors!
 
 Best,
 Ozgur Akgun
 
 
 
 -- 
 Ozgur Akgun
 ___
 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


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-05 Thread Limestraël
Yes, the xmonad approach is very neat, but I see 2 major (IMO) drawbacks to
it:
1) The end-user has to have GHC, and all the necessary libraries to compile
the configuration
2) A scripting language should be simple and QUICK to learn : Haskell is
clean, powerful but its learning takes time

Uwe, I noticed kind of recently the haskeem package, I have not tried it yet
and I didn't know its usability. If you say it's not made for that, then I
believe you.


2010/5/5 Yitzchak Gale g...@sefer.org

 Maciej Piechotka wrote:
  After change of file you have to wait a long time as it compiles and
  links with yi.

 But Yi is a far bigger application than what Limestraël is talking
 about. One of my computers is very old and much
 less powerful than yours (let's just say that it has far less than
 1 Gb memory in total). On that machine, xmonad, still much
 larger than Limestraël's app, recompiles its configuration file
 almost instantaneously. And of course, even that
 fast recompile only happens when I change the configuration,
 which is almost never.

 I would try the xmonad approach to scripting in Haskell.
 It is much simpler to implement than any of the others,
 and much neater if you find that it works well.

 Regards,
 Yitz
 ___
 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] posting UTF8 data with Curl library

2010-05-05 Thread Eugeny N Dzhurinsky
Hello!

I need to submit data to HTTP server using UTF8 encoding. I found out that
libcurl for haskell can work with Data.ByteString - but it seems not able to
work with Data.ByteString.UTF8.

Can you please advice, how do I convert Data.ByteString.UTF8 into
Data.ByteString and visa versa?

Thank you in advance!

-- 
Eugene Dzhurinsky


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


Re: [Haskell-cafe] posting UTF8 data with Curl library

2010-05-05 Thread Daniel Fischer
On Wednesday 05 May 2010 23:05:10, Eugeny N Dzhurinsky wrote:
 Hello!

 I need to submit data to HTTP server using UTF8 encoding. I found out
 that libcurl for haskell can work with Data.ByteString - but it seems
 not able to work with Data.ByteString.UTF8.

 Can you please advice, how do I convert Data.ByteString.UTF8 into
 Data.ByteString and visa versa?

It's the same type, so you can encode it using Data.ByteString.UTF8 and 
send it over the network as a plain old ByteString.
On the receiving end, you read it as a plain ByteString and then interpret 
it as a utf-8 encoded ByteString.


 Thank you in advance!

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


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-05 Thread Kyle Murphy
Concerning your second point, I think just about any functional language
isn't going to be simple or quick to learn. It's simply not a way of
approaching problems that your average person (even your average programmer)
is used to dealing with. Things like fold and map, the work horses of
functional programming, are simply too foreign to most peoples imperative
way of approaching problems.

-R. Kyle Murphy
--
Curiosity was framed, Ignorance killed the cat.


On Wed, May 5, 2010 at 16:29, Limestraël limestr...@gmail.com wrote:

 Yes, the xmonad approach is very neat, but I see 2 major (IMO) drawbacks to
 it:
 1) The end-user has to have GHC, and all the necessary libraries to compile
 the configuration
 2) A scripting language should be simple and QUICK to learn : Haskell is
 clean, powerful but its learning takes time

 Uwe, I noticed kind of recently the haskeem package, I have not tried it
 yet and I didn't know its usability. If you say it's not made for that, then
 I believe you.


 2010/5/5 Yitzchak Gale g...@sefer.org

 Maciej Piechotka wrote:
  After change of file you have to wait a long time as it compiles and
  links with yi.

 But Yi is a far bigger application than what Limestraël is talking
 about. One of my computers is very old and much
 less powerful than yours (let's just say that it has far less than
 1 Gb memory in total). On that machine, xmonad, still much
 larger than Limestraël's app, recompiles its configuration file
 almost instantaneously. And of course, even that
 fast recompile only happens when I change the configuration,
 which is almost never.

 I would try the xmonad approach to scripting in Haskell.
 It is much simpler to implement than any of the others,
 and much neater if you find that it works well.

 Regards,
 Yitz
 ___
 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


Re: [Haskell-cafe] Haskell and the Software design process

2010-05-05 Thread Adam Vogt
* On Sunday, May 02 2010, Alexander Dunlap wrote:

Of course, there are situations where it is really awkward to not use
partial functions, basically because you *know* that an invariant is
satisfied and there is no sane course of action if it isn't. To take a
contrived example:

f ys = let xs = (1:ys) in last xs

uses the partial function last. Rewriting it in the non-partial style gives

f ys = case (1:ys) of
  [] - Nothing
  xs - Just (last xs)

but what possible meaning could a caller of the function ascribe to a
Nothing result? It just means that there is a bug in f, which is
what an error would tell you anyway. Of course, this particular
function could easily be rewritten in such a way to be total, but I
believe there are more complex examples where it is awkward/impossible
to do so.

You're just showing how difficult it is to reason about when the use of
partial functions is safe: undefined), with your `non-partial style'
version, you still leave open the case of (Just undefined), since we
cannot convince ourselves that last only fails on empty lists here...

One case where Maybe or Either might be less preferable to an exception
is for the output of a lexer (ex. alex does this) because it means you
can get some tokens without without forcing the whole input, and do some
IO based on the results even if there is a mistake in either reading the
input from disk or lexing it.

But I think this situation of (ab)using lazy IO and exceptions is an
oversimplification, and you can find appropriate alternatives such as
iteratee which are more explicit about what is going on.

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


Re: [Haskell-cafe] Haskell XML Parsers

2010-05-05 Thread Neil Mitchell
Hi,

You might want to take a look at TagSoup
(http://community.haskell.org/~ndm/tagsoup) - it parses XML/HTML
lazily returning a stream of tags. It doesn't do nesting, but it does
have good memory usage.

Thanks, Neil

On Fri, Apr 30, 2010 at 11:35 AM, R Senington sc06...@leeds.ac.uk wrote:
 Dear all,

 I have been looking at using XML for a little program I have been writing. 
 The file I am currently trying to load is about 9MB, and I have now tried to 
 use
 HaXml and HST. Without any of my own code, just a simple call to the basic 
 parsers, they both use huge amount of memory.
 HST is the worst and about 7GB and climbing. HaXml uses 1.3Gb.

 The code I am using is
 HST
 xml - readFile file_name_here;k-runX (parseXmlDocument True) xml;print k

 and for HaXml
 x-readFile file_name_here
 let (Document _ _ e _) = xmlParse t x
 let t = myFilter $ CElem e
 print $ length t


 I have seen on previous posts to the cafe that other people have run into 
 this problem with HST. Is this a general problem with XML in Haskell (I know 
 that XML parsing is a slow and bulky process but this seems excessive)? Is 
 there a known solution? Does anyone have any advice?

 Cheers

 RS
 ___
 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] Re: Haskell and scripting

2010-05-05 Thread Limestraël
I do agree, but you will not object if I say that scheme is quicker to learn
than Haskell.
Most of all, I think Haskell is far too rigorous to serve scripting purposes
for my app. Quick and dirty is clearly not the Haskell way.
And is think its the very intrinsic nature of scripting to be done fast.

Nevertheless, I'm not a bigot ^^, if you people think Lua is an appropriate
language for what I'm trying to do, and if it is convenient to use with
Haskell, then I'm willing to give it a go.


2010/5/5 Kyle Murphy orc...@gmail.com

 Concerning your second point, I think just about any functional language
 isn't going to be simple or quick to learn. It's simply not a way of
 approaching problems that your average person (even your average programmer)
 is used to dealing with. Things like fold and map, the work horses of
 functional programming, are simply too foreign to most peoples imperative
 way of approaching problems.


 -R. Kyle Murphy
 --
 Curiosity was framed, Ignorance killed the cat.


 On Wed, May 5, 2010 at 16:29, Limestraël limestr...@gmail.com wrote:

 Yes, the xmonad approach is very neat, but I see 2 major (IMO) drawbacks
 to it:
 1) The end-user has to have GHC, and all the necessary libraries to
 compile the configuration
 2) A scripting language should be simple and QUICK to learn : Haskell is
 clean, powerful but its learning takes time

 Uwe, I noticed kind of recently the haskeem package, I have not tried it
 yet and I didn't know its usability. If you say it's not made for that, then
 I believe you.


 2010/5/5 Yitzchak Gale g...@sefer.org

 Maciej Piechotka wrote:
  After change of file you have to wait a long time as it compiles and
  links with yi.

 But Yi is a far bigger application than what Limestraël is talking
 about. One of my computers is very old and much
 less powerful than yours (let's just say that it has far less than
 1 Gb memory in total). On that machine, xmonad, still much
 larger than Limestraël's app, recompiles its configuration file
 almost instantaneously. And of course, even that
 fast recompile only happens when I change the configuration,
 which is almost never.

 I would try the xmonad approach to scripting in Haskell.
 It is much simpler to implement than any of the others,
 and much neater if you find that it works well.

 Regards,
 Yitz
 ___
 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


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-05 Thread Gwern Branwen
On Wed, May 5, 2010 at 4:29 PM, Limestraël limestr...@gmail.com wrote:
 Yes, the xmonad approach is very neat, but I see 2 major (IMO) drawbacks to
 it:
 1) The end-user has to have GHC, and all the necessary libraries to compile
 the configuration
 2) A scripting language should be simple and QUICK to learn : Haskell is
 clean, powerful but its learning takes time

For basic customization, many XMonad users (judging by questions on
#xmonad) have little to no Haskell experience and get by. Further,
it's easier to step down the power than to increase it; because we use
Haskell, it's possible to have simpler configuration options like
xmonad-light*

* http://braincrater.wordpress.com/2008/08/28/announcing-xmonad-light/
isn't a very good explanation of xmonad-light, but I don't know of any
others

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


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-05 Thread Limestraël
Well, it is clear that, for me, the dyre approach is clearly the simplest to
implement, since everything is in Haskell.
Maybe I could start with it, and see if it suits me... (Sorry, I know, ^^ I
keep changing my mind...)


2010/5/5 Gwern Branwen gwe...@gmail.com

 On Wed, May 5, 2010 at 4:29 PM, Limestraël limestr...@gmail.com wrote:
  Yes, the xmonad approach is very neat, but I see 2 major (IMO) drawbacks
 to
  it:
  1) The end-user has to have GHC, and all the necessary libraries to
 compile
  the configuration
  2) A scripting language should be simple and QUICK to learn : Haskell is
  clean, powerful but its learning takes time

 For basic customization, many XMonad users (judging by questions on
 #xmonad) have little to no Haskell experience and get by. Further,
 it's easier to step down the power than to increase it; because we use
 Haskell, it's possible to have simpler configuration options like
 xmonad-light*

 * http://braincrater.wordpress.com/2008/08/28/announcing-xmonad-light/
 isn't a very good explanation of xmonad-light, but I don't know of any
 others

 --
 gwern

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


Re: [Haskell-cafe] IO (Either a Error) question

2010-05-05 Thread Ryan Ingram
ErrorT is just a newtype wrapper, changing the order/application of
the type variables.

newtype ErrorT e m a = ErrorT (m (Either e a))
runErrorT (ErrorT action) = action

This gives the bijection:

ErrorT :: m (Either e a) - ErrorT e m a
runErrorT :: ErrorT e m a - m (Either e a)

We can now redefine = for this new type to handle plumbing the error:

instance (Error e, Monad m) = Monad (ErrorT e m) where
return a = ErrorT (return (Right a))
m = f = ErrorT $ do
ea - runErrorT m
case ea of
Left e - return (Left e)
Right a - runErrorT (f a)
fail s = ErrorT (return $ Left $ strMsg s)

On Sun, May 2, 2010 at 1:50 AM, Eugene Dzhurinsky b...@redwerk.com wrote:
  :t ErrorT
 ErrorT :: m (Either e a) - ErrorT e m a

 At this point I am lost. I'm not sure that I do understand this type
 transformation correctly. So we have some sort of monadic type m, error type e
 and resut of type a. If m = IO, e - Error, a - String, than

 ErrorT :: IO (Either Error String) - ErrorT Error IO String

Yep.

 I can think that can be written as

 ErrorT :: IO (Either Error String) - ErrorT Error (IO String)

 Am I correct?

Nope.

At the type level:

ErrorT :: * - (* - *) - * - *
That is, the to make the ErrorT concrete (kind *), you need
   a concrete type (e :: *)
   a type that takes a parameter (m :: * - *)
   and finally, a parameter (a :: *)

(IO String) :: *
whereas
IO :: * - *
String :: *

The reason for this is because ErrorT is inserting Either in the proper place:
   ErrorT :: m (Either e a) - ErrorT e m a

There's no way for ErrorT to do anything at the type level with (IO
String).  (Although if you go into crazy type system extensions, you
could use GADTs to make a type that worked like that.  Probably not
useful, though!)

Now we have (ErrorT e m) :: * - *
which means it is eligible to be an instance of Monad, Functor, etc.

 So, if you can make your Error type an instance of this class, you can do 
 this:
 runCalc = runErrorT (ErrorT (func1 p) = ErrorT . func2)

 Sorry, I don't understand how does it work. Can you please explain the type
 transformations involved here?

Sorry, I typoed a bit here.
runCalc p = runErrorT (ErrorT (func1 p) = ErrorT . func2)

Lets just do some inference:

func1 :: Int - IO (Either Error String)
p :: Int
func1 p :: IO (Either Error String)
ErrorT (func1 p) :: ErrorT Error IO String

func2 :: String - IO (Either Error [String])
(ErrorT . func2) :: String - ErrorT Error IO String

(=) :: forall m a b. Monad m = m a - (a - m b) - m b
IO is an instance of Monad
If you make Error into an instance of Control.Monad.Error.Error
then (ErrorT Error IO) is an instance of Monad

So one instance of the type of (=):
(=) :: ErrorT Error IO String - (String - ErrorT Error IO
[String]) - ErrorT Error IO [String]
(func1 p = ErrorT . func2) :: ErrorT Error IO [String]

runErrorT (func1 p = ErrorT . func2) :: IO (Either Error [String])

And finally:
runCalc :: Int - IO (Either Error [String])

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


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-05 Thread Daniel Fischer
On Wednesday 05 May 2010 23:36:26, Limestraël wrote:
 but you will not object if I say that scheme is quicker to learn
 than Haskell.

Well, I do object. Learning Haskell went like a breeze (not to perfection, 
but well enough). Only Python was nearly as easy and quick to learn.
Learning Lisp dialects is much harder (to a large part because of the 
parentheses, which makes them near impossible to parse).
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-05 Thread Gregory Crosswhite

On May 5, 2010, at 3:09 PM, Daniel Fischer wrote:

 Learning Lisp dialects is much harder (to a large part because of the 
 parentheses, which makes them near impossible to parse).

On the contrary, the whole point of parentheses is that it makes Lisp *easier* 
to parse... for computers.  :-)

Cheers,
Greg

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


[Haskell-cafe] darcs to mercurial migration

2010-05-05 Thread Günther Schmidt

Hello,

I'm switching from darcs to mercurial with some of my projects.

I'd like to retain as much of the history as possible, what tools are 
there available for this?


Günther


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


Re: [Haskell-cafe] darcs to mercurial migration

2010-05-05 Thread Erik de Castro Lopo
Günther Schmidt wrote:

 Hello,
 
 I'm switching from darcs to mercurial with some of my projects.
 
 I'd like to retain as much of the history as possible, what tools are 
 there available for this?

The cannonical revision control conversion tool is called tailor:

http://progetti.arstecnica.it/tailor/

I haven't used it myself but have heard that it has some problems.
Obviously you shouldn't delete your old tree until you are 100%
satisfied that the new one is intact.

Erik
-- 
--
Erik de Castro Lopo
http://www.mega-nerd.com/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: class Arbitrary in quickcheck

2010-05-05 Thread Tim Docker

On May 5, 10:57 pm, Ozgur Akgun ozgurak...@gmail.com wrote:
 Let me try to understand you then. What happens when you run the following
 command in ghci?

 sample (arbitrary :: Gen (Maybe Int, Maybe Int) )

 Do you still always get (Just _, Just _) or (Nothing, Nothing) pairs, or do
 you also get some (Nothing, Just _) or (Just _, Nothing) pairs?

Well, I couldn't run the above code, as sample isn't part of
quickcheck-1.2.
But this made me wonder whether it's a  version issue. This seems to
be the case. If I run this with quickcheck 2.1:

 import Test.QuickCheck

 main = quickCheckWith stdArgs{maxSuccess=10} f

 f :: (Maybe Int,Maybe Int) - Bool
 f (Just _,Just _) = True
 f (Nothing,Nothing) = True
 f _ = False

I see a failure almost instantly. This is what I want... I don't
expect all
of the generated pairs to have the same constructor in each field.

However, running this with quickcheck 1.2:

 import Test.QuickCheck

 main = quickCheckWith stdArgs{maxSuccess=10} f

 f :: (Maybe Int,Maybe Int) - Bool
 f (Just _,Just _) = True
 f (Nothing,Nothing) = True
 f _ = False

I see no failures... all of the generatd pairs have the same
constructor in each
field.

So the good news is that quickcheck 2.1 behaves as I expected. I'm
still curious
as to the behaviour of the older version.

Tim




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


Re: [Haskell-cafe] Haskell XML Parsers

2010-05-05 Thread Gregory Collins
R Senington sc06...@leeds.ac.uk writes:

 Dear all,

 I have been looking at using XML for a little program I have been writing. The
 file I am currently trying to load is about 9MB, and I have now tried to use
 HaXml and HST. Without any of my own code, just a simple call to the basic
 parsers, they both use huge amount of memory.
 HST is the worst and about 7GB and climbing. HaXml uses 1.3Gb.

If your needs are reasonably basic, you could consider trying:

  http://hackage.haskell.org/package/hexpat

which is an FFI binding to expat.

G
-- 
Gregory Collins g...@gregorycollins.net
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Would it be evil to add deriving Typeable to newtype Q?

2010-05-05 Thread Ivan Miljenovic
On 6 May 2010 02:17, Leonel Fonseca leone...@gmail.com wrote:
 Is it reasonable to add deriving Typeable to newtype Q?

With GeneralizedNewtypeDeriving you mean?  If so, then I don't see why
it would be a problem.

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Interest in a Mathematics AI strike force ?

2010-05-05 Thread Ivan Miljenovic
Well, based on what you want your priorites to be, I might bow out
then (at least until you start wanting to have graph-centric
operations in there, then I might pitch in).

On 6 May 2010 04:23, Alp Mestanogullari a...@mestan.fr wrote:
 We also have patch-tag project
 : https://patch-tag.com/r/alpmestan/hasklab/home

Any particular reason for using patch-tag rather than
code.haskell.org?  For the wiki?

My main objection to patch-tag is that projects are tied to the user
who created them; as such, if you later on decide to leave the project
then the entire thing has to be cloned and everyone's URLs will need
changing (for homepage, etc.).  This applies to github, etc. as well;
I don't feel that they are ideal hosting sites for multi-user projects
specifically because of this.

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: lhs2TeX - lhs2TeX.fmt missing

2010-05-05 Thread Ivan Miljenovic
On 6 May 2010 04:18, Pierre-Etienne Meunier
pierreetienne.meun...@gmail.com wrote:
 By the way, if someone on this list has got too much time, he could write
 something that would fulfill the goals of literate programming -- à la web
 and cweb.
 Knuth was able to make books with his source code. I believe that lhs2tex is
 great for classes about haskell or fp, but I never found it satisfying for
 programs with several modules, for instance.

I think the main difference between cweb and literate haskell is that
the former allows documentation _anywhere_, whereas with literate
haskell you can't suddenly cut out of a code block to have a
discussion on what the next line means (instead you need to have an
explicit comment).  Unless GHC[i] starts stripping out all non-code
from literate haskell files and joining all the code blocks together,
I'm not sure if this situation can be remedied.

 El 05/05/2010, a las 12:42, Ozgur Akgun escribió:

 OK, I've found them!

 They were under /Users/username/.cabal/share/lhs2tex-1.15 and this path
 was not in the search path of lhs2TeX.
 I'm using Snow Leoprad. This might be a bug I guess?

Not quite; the lhs2tex documentation says you need to put those .fmt,
.sty, etc. files in a texmf directory.

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-05 Thread Ivan Miljenovic
On 6 May 2010 08:25, Gregory Crosswhite gcr...@phys.washington.edu wrote:

 On May 5, 2010, at 3:09 PM, Daniel Fischer wrote:

 Learning Lisp dialects is much harder (to a large part because of the
 parentheses, which makes them near impossible to parse).

 On the contrary, the whole point of parentheses is that it makes Lisp 
 *easier* to parse... for computers.  :-)

With the added advantage of making it easier for text editors to do
automatic indentation properly for precisely the same reason (this is
probably the only flaw with Haskell's indentation-centric coding
style).

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] darcs to mercurial migration

2010-05-05 Thread Ivan Miljenovic
2010/5/6 Günther Schmidt gue.schm...@web.de:
 I'm switching from darcs to mercurial with some of my projects.

Out of curiosity, why?

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Interest in a Mathematics AI strike force ?

2010-05-05 Thread Alp Mestanogullari
On Thu, May 6, 2010 at 2:19 AM, Ivan Miljenovic
ivan.miljeno...@gmail.comwrote:

 Well, based on what you want your priorites to be, I might bow out
 then (at least until you start wanting to have graph-centric
 operations in there, then I might pitch in).


Well, we do now want it to be graph-centric, but graphs definitely play a
role here! We may want to implement algorithms relying on graphs.


 On 6 May 2010 04:23, Alp Mestanogullari a...@mestan.fr wrote:

Any particular reason for using patch-tag rather than
 code.haskell.org?  For the wiki?


Yeah I thought about your objection, but the two main reasons are the gitit
wiki (way handier for maths stuffs than trac's) and the easy handling of new
contributors and project management -- it is way more manual on c.h.o for
example, whereas everything is automated on patch-tag. The user-tied aspect
is a bit annoying but should be fine ; i will definitely do mathematics and
haskell for a while heh.

-- 
Alp Mestanogullari
http://alpmestan.wordpress.com/
http://alp.developpez.com/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Interest in a Mathematics AI strike force ?

2010-05-05 Thread Ivan Miljenovic
On 6 May 2010 11:17, Alp Mestanogullari a...@mestan.fr wrote:
 On Thu, May 6, 2010 at 2:19 AM, Ivan Miljenovic ivan.miljeno...@gmail.com
 wrote:

 Well, based on what you want your priorites to be, I might bow out
 then (at least until you start wanting to have graph-centric
 operations in there, then I might pitch in).

 Well, we do now want it to be graph-centric, but graphs definitely play a
 role here! We may want to implement algorithms relying on graphs.

OK, how about we do it this way: I'm currently involved in working on
FGL with Louis Wasserman and Thomas Bereknyei and so can't really get
involved with your strikeforce atm, but if you have an queries or
want something done contact me and I'll see what I can do.

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Set Operations In Haskell's Type System

2010-05-05 Thread John Creighton


On May 4, 9:46 am, Bartek Ćwikłowski paczesi...@gmail.com wrote:
 hello,

 2010/5/4 John Creighton johns2...@gmail.com:

  I will continue to try to solve the problem on my own but at the
  moment I'm able to get IsSuperSet to work but not the classes Isa,
  Child and IsSubSet to work. Unlike set theory IsSubSet is not the same
  as switching the order arguments in IsSuperSet because the searching
  is done in the opposite direction. In one case we are searching the
  parents and each child only has one parent. In the other Case we are
  searching the children and each parent could have multiple children).

 Since Subset is the opposite of Superset, you can search in the
 easier (up) direction, so it really is as easy as reversing the
 order of arguments.

 It's not possible to write class/type-level function Child a b | a -
 b, because functions (classes with fun-deps) must be deterministic. If
 you want to enumerate all children (based on Parent class instances),
 it's also impossible in this setup,

That's the approach I finally ended up taking. It seems to work so far
but I haven't tried using my child
function to build a subset or an isa function. My code is rather ugly
but it's the best I came up with. The
following are examples of the enumerations:


instance Parrent' () d Z Cat Feline --
instance Parrent' () d Z Feline Animal --

Z: means the first child
S Z: would be the second child instance
d is a type variable letting the relationship be bidirectional:
() is a dumby argument which is used in the case where their is no
instance.

It is used as follows:

instance (Parrent'' q d z anyChild anyParrent)=Parrent' q d z
anyChild anyParrent

instance (ItsAnOrphan ~ anyParrent)=Parrent'' q P1 n anyChild
anyParrent
instance (HasNoChildern ~ anyChild)=Parrent'' q N1 Z anyChild
anyParrent
instance (HasNoMoreChildern ~ anyChild)=Parrent'' q N1 (S n) anyChild
anyParrent

N1 is short for S Z
P1 is short for P Z (Negative numbers, P stands for previous)

 it's probably possible with Oleg's
 second-order typeclass programming[1].

 [1]http://okmij.org/ftp/Haskell/types.html#poly2


 But what are you actually trying to achieve? I can't thing of anything
 useful that would require walking down the hierarchy tree (and
 backtracking) and it has to be done at the type level.


Well, I need it for my Isa relationship defined so that

a isa d if their exists a b and c such that the following
conditions hold:

a isa subset of b,
b isa c
c is a subset of d

Thus we know d, but we need to search backwards to find c.

Anyway, I don't have the code for isa or subset yet but here is my
code for child (some more testing warranted):
Any hints on making it cleaner or more readable would be appreciated.

-

{-# LANGUAGE EmptyDataDecls,
 MultiParamTypeClasses,
 ScopedTypeVariables,
 FunctionalDependencies,
 OverlappingInstances,
 FlexibleInstances,
 UndecidableInstances,
 TypeFamilies #-}

{-# LANGUAGE TypeOperators #-} --10
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeSynonymInstances #-}
u=undefined
bla = child Z Animal
bla2 = child (u::P1) Animal
bla3 = child (u::Z) Cat
bla4 = child (u::P1) Cat
bla5 = parrent Cat
bla6 = parrent Feline
bla7 = parrent Animal
--20
---Instance SubType Relations

data ItsAnOrphan = ItsAnOrphan
instance (Show ItsAnOrphan) where show _ = ItsAnOrphan

data HasNoMoreChildern = HasNoMoreChildern
instance (Show HasNoMoreChildern) where show _ = HasNoMoreChildern

data HasNoChildern = HasNoChildern
instance (Show HasNoChildern) where show _ = HasNoChildern


--30
class Parrent' () P1 Z a b =Parrent a b| a-b where -- Specific Cases
parrent :: a-b --
instance Parrent' () P1 Z a b = Parrent a b where
parrent _ = undefined::b
class Parrent' q d n a b | q d n a- b, q d n b -a
class Parrent'' q d n a b | q d n a - b,q d n b - a
--class Parrent''' q n a b | q n b - a

instance Parrent' () d Z Cat Feline --
instance Parrent' () d Z Feline Animal --
instance (Parrent'' q d z anyChild anyParrent)=Parrent' q d z
anyChild anyParrent

instance (ItsAnOrphan ~ anyParrent)=Parrent'' q P1 n anyChild
anyParrent
instance (HasNoChildern ~ anyChild)=Parrent'' q N1 Z anyChild
anyParrent
instance (HasNoMoreChildern ~ anyChild)=Parrent'' q N1 (S n) anyChild
anyParrent




class Child n a b|n a-b  where  -- a2 is the parrent of b
   child :: n-a-b
   child _ _ = undefined::b
instance (
 Parrent' () N1 n b2 a,
 Child' b2 n a b --b2==b or b2=HasNoChildern or
b2==HasNoMoreChildern
 )=
 Child n a b
class Child' b2 n a b | b2 n a - b --a2==a or a2=HasNoChildern or
a2==HasNoMoreChildern
class Child'' q b2 n a b|q b2 n a b -b
class Child''' q b2 n a b|q b2 n a b -b

instance Child' HasNoChildern Z a HasNoChildern
instance Child' HasNoMoreChildern (S n) a HasNoMoreChildern

Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-05 Thread Pierre-Etienne Meunier
Fifty years ago someone came up with this idea of lisp and parentheses. By now 
in year 2010, I have never heard of any programmer who never made jokes about 
it. Now imagine the discussions in 2060 :

- ahah, you're still programming with monads. lol
- no but theyre ok for dirty scripting.
- all these =, significative indentation, You're from the past dude.
- Wtf !!? haskell's easy to compile.
- So what ?

... good luck limestraël ;-)



El 05/05/2010, a las 18:25, Gregory Crosswhite escribió:

 
 On May 5, 2010, at 3:09 PM, Daniel Fischer wrote:
 
 Learning Lisp dialects is much harder (to a large part because of the 
 parentheses, which makes them near impossible to parse).
 
 On the contrary, the whole point of parentheses is that it makes Lisp 
 *easier* to parse... for computers.  :-)
 
 Cheers,
 Greg
 
 ___
 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] Re: Interest in a Mathematics AI strike force ?

2010-05-05 Thread Alp Mestanogullari
We won't hesitate. Anyway, a part of your work will benefit HNN ;-)
(and potential a potential Bayesian network library, e.g)

Good luck to you for the work on graphs guys!

On Thu, May 6, 2010 at 3:20 AM, Ivan Miljenovic
ivan.miljeno...@gmail.comwrote:

 On 6 May 2010 11:17, Alp Mestanogullari a...@mestan.fr wrote:
  On Thu, May 6, 2010 at 2:19 AM, Ivan Miljenovic 
 ivan.miljeno...@gmail.com
  wrote:
 
  Well, based on what you want your priorites to be, I might bow out
  then (at least until you start wanting to have graph-centric
  operations in there, then I might pitch in).
 
  Well, we do now want it to be graph-centric, but graphs definitely play a
  role here! We may want to implement algorithms relying on graphs.

 OK, how about we do it this way: I'm currently involved in working on
 FGL with Louis Wasserman and Thomas Bereknyei and so can't really get
 involved with your strikeforce atm, but if you have an queries or
 want something done contact me and I'll see what I can do.

 --
 Ivan Lazar Miljenovic
 ivan.miljeno...@gmail.com
 IvanMiljenovic.wordpress.com




-- 
Alp Mestanogullari
http://alpmestan.wordpress.com/
http://alp.developpez.com/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Would it be evil to add deriving Typeable to newtype Q?

2010-05-05 Thread Ivan Miljenovic
Re-CC'ing -cafe:

On 6 May 2010 12:54, Leonel Fonseca leone...@gmail.com wrote:
 I wasn't aware of GeneralizedNewtypeDeriving.
  I just edited the source file Language.Haskell.TH.Syntax
 and left:

 newtype Q a = Q { unQ :: forall m. Quasi m = m a }
    deriving Typeable

Hang on, is Q something actually in the template-haskell library?  In
that case, you can't just do deriving (Typeable) .

However, you might be able to generate the Typeable instance using
DrIFT (see http://hackage.haskell.org/package/DrIFT-cabalized for a
cabal-install-able package).

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] macosx-app for wxHaskell

2010-05-05 Thread Bill Atkins
In order to run apps built with wxHaskell on OS X, you're supposed to wrap
the binary using a script called macosx-app (
http://www.haskell.org/haskellwiki/WxHaskell/MacOS_X).

Unfortunately, after running cabal install wx this file is not in
~/.cabal - it's also not in the wxHaskell source.

Does anyone know where I can find it?

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


Re: [Haskell-cafe] macosx-app for wxHaskell

2010-05-05 Thread Ivan Miljenovic
On 6 May 2010 13:25, Bill Atkins watk...@alum.rpi.edu wrote:
 In order to run apps built with wxHaskell on OS X, you're supposed to wrap
 the binary using a script called macosx-app
 (http://www.haskell.org/haskellwiki/WxHaskell/MacOS_X).
 Unfortunately, after running cabal install wx this file is not in
 ~/.cabal - it's also not in the wxHaskell source.
 Does anyone know where I can find it?

This thread looks relevant:
http://www.mail-archive.com/wxhaskell-us...@lists.sourceforge.net/msg00826.html

However, it seems that macosx-app has disappeared with the
cabalisation of wxhaskell :s

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] forall (What does it do)

2010-05-05 Thread John Creighton
I've seen forall used in a few places related to Haskell. I know their
is a type extension call explicit forall but by the way it is
documnted in some places, the documentation makes it sound like it
does nothing usefull.

However on Page 27 of Haskell's overlooked object system:


We define an existential envelope for shape data.
data OpaqueShape = forall x. Shape x = HideShape x
“Opaque shapes are (still) shapes.” Hence, a Shape instance:
nstance Shape OpaqueShape
where
   readShape f (HideShape x) = readShape f x
   writeShape f (HideShape x) = HideShape $ writeShape f x
   draw (HideShape x) = draw x
When building the scribble list, we place shapes in the envelope.
let scribble = [ HideShape (rectangle 10 20 5 6)
, HideShape (circle 15 25 8)


It seems that forall can be used as a form of up casting. That is if
we have a parametric type we can treat the parametric types as
homogeneous:

The paper did not seem to regard this feature too highly:

By contrast, the explicit constraint for the existential envelope cannot be 
eliminated.
Admittedly, the loss of type inference is a nuance in this specific example. In
general, however, this weakness of existentials is quite annoying. It is 
intellectually
dissatisfying since type inference is one of the added values of an (extended) 
Hindley/
Milner type system, when compared to mainstream OO languages. Worse than
that, the kind of constraints in the example are not necessary in mainstream OO
languages (without type inference), because these constraints deal with 
subtyping,
which is normally implicit.
We do not use existentials in OOHaskell
http://homepages.cwi.nl/~ralf/OOHaskell/paper.pdf

but can't we just use the read shape function above if we want to be
able to infer based on types. I understand that haskers tend to like
things well typed but surely their are times when we would like to be
able to flatten the type of our data somewhat.

On another note, I also wonder how forall relates to type families. I
know their are certain restrictions on where we can use type families
in haskell. I wonder if we can get around these somewhat using forall.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] mixing map and mapM ?

2010-05-05 Thread briand

I was doing the following:


do status - mapM PF.getFileStatus filenames
   let times = map PF.modificationTime status
   let sorted = sortBy (\(_, t1) (_,t2) - compare t1 t2) (zip filenames times)

and I thought, surely I can combine the status and times definitions into one 
line, only I can't.

Hint ?

Thanks,

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


Re: [Haskell-cafe] mixing map and mapM ?

2010-05-05 Thread Ivan Miljenovic
On 6 May 2010 15:01,  bri...@aracnet.com wrote:

 I was doing the following:


 do status - mapM PF.getFileStatus filenames
   let times = map PF.modificationTime status
   let sorted = sortBy (\(_, t1) (_,t2) - compare t1 t2) (zip filenames times)

times - mapM (liftM PF.modificationTime . PF.getFileStatus) filenames

However, I'd be tempted to leave it as is (and hope/assume that fusion
does its magic).

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] mixing map and mapM ?

2010-05-05 Thread briand
On Thu, 6 May 2010 15:07:30 +1000
Ivan Miljenovic ivan.miljeno...@gmail.com wrote:

 On 6 May 2010 15:01,  bri...@aracnet.com wrote:
 
  I was doing the following:
 
 
  do status - mapM PF.getFileStatus filenames
    let times = map PF.modificationTime status
    let sorted = sortBy (\(_, t1) (_,t2) - compare t1 t2) (zip
  filenames times)
 
 times - mapM (liftM PF.modificationTime . PF.getFileStatus) filenames
 
 However, I'd be tempted to leave it as is (and hope/assume that fusion
 does its magic).
 

well now it's obvious :-)  I did have liftM in there, but just couldn't
quite figure out how to tie things together.

to be completely clear : liftM takes modificationTime from

 Status - EpochTime 

to

 IO Status - IO EpochTime

so now it can operate on the results of getFileStatus, which 
returns `IO Status`.

mapM gathers the [IO EpochTime] into `IO [EpochTime]` and then - gives
[EpochTime].

It's a little more clear in the verbose form, isn't it ?

Thanks !

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


Re: [Haskell-cafe] mixing map and mapM ?

2010-05-05 Thread Ivan Miljenovic
On 6 May 2010 15:20,  bri...@aracnet.com wrote:
 well now it's obvious :-)  I did have liftM in there, but just couldn't
 quite figure out how to tie things together.

 to be completely clear : liftM takes modificationTime from

  Status - EpochTime

 to

  IO Status - IO EpochTime

You can see it that way, yes (of course, liftM works on all monads,
not just IO).

 so now it can operate on the results of getFileStatus, which
 returns `IO Status`.

Operate directly on the returned values; you could always use
something like (return . modificationTime) = getFileStatus file as
well.

 mapM gathers the [IO EpochTime] into `IO [EpochTime]` and then - gives
 [EpochTime].

No, it's the sequence function that does that (but mapM f = sequence . map f).

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Database connection pool

2010-05-05 Thread Michael Snoyman
Hi all,

I would like to pool my database connections in an application I'm writing,
and so far haven't found any prior art on the subject (besides this[1]). I
was wondering if:

* There's a package somewhere that does this
* Others have implemented it and have suggestions
* There's some big gotchas

The stackoverflow that I linked to gives one approach to this that seems
valid. My original thought on an implementation was to use a Chan. That way:

* When a connection is released, is goes to the end of the pool, so
connections get used evenly (not sure if this actually matters in practice).
* If a process dies and for some reason doesn't return its connection, there
shouldn't be a problem. Of course, I'd use bracket, so such a situation
should never arise anyway.
* Keep the coding against MVar to a minimum to avoid normal multi-threaded
pitfalls.

I'm using HDBC in this case, but I don't think I'll be using any
HDBC-specific code.

Thanks,
Michael

[1]
http://stackoverflow.com/questions/1141677/concurrent-db-connection-pool-in-haskell
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe