Re: [Haskell-cafe] Suppressing HLint on pattern match of files

2013-10-10 Thread Graham Berks
Ah good point :) Wonder if I can change it on cabal file somehow.

Thanks



On 10 October 2013 at 14:05:45, Dag Odenhall (dag.odenh...@gmail.com) wrote:

Is that actually from HLint though? I think that comes from GHC with  
-Wall and can be disabled with  
-fno-warn-missing-signatures.



On Thu, Oct 10, 2013 at 7:50 AM, Graham Berks  wrote:
Hi, would like to disable 'Top-level binding with no type signature'

In my test modules that are prefixed with Test.

Is this possible ??

Thanks




___
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] Suppressing HLint on pattern match of files

2013-10-09 Thread Graham Berks
Hi, would like to disable 'Top-level binding with no type signature'

In my test modules that are prefixed with Test.

Is this possible ??

Thanks



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


[Haskell-cafe] Accessing resource files in tests

2013-05-08 Thread Graham Berks
Hi, whats the recommended way to access a resource file for a test within cabal.

I have a text file containing data that I use in a test and want to be able to 
access it in a root path independent manner.

Thanks 

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


[Haskell-cafe] Test access resources files in cabal-dev

2013-05-08 Thread Graham Berks
Hi, whats the recommended way to access a resource file for a test within 
cabal. 

I have a text file containing data that I use in a test and want to be able to 
access it in a root path independent manner.

Thanks 

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


[Haskell-cafe] Request for input on "Programming in Haskell"

2013-05-07 Thread Graham Hutton

Have you taught a course using Hutton's textbook on
Programming in Haskell?  If so, please read on!

As part of the national assessment of universities in
the UK that takes place every 5-6 years, I'm producing
a case study on the impact of the book on student and
professional training.  The case study will include a
number of quotes from academic and industrial users
who have used the book for teaching purposes.

If you have taught a course using the book any time
from January 2008 onwards, and would be willing to
provide a short quote (2-3 sentences) for the case
study, that would be very much appreciated.  It doesn't
matter if you are no longer teaching the course or are
not currently using the book.  If you are interested,
drop me an email and I'll explain what's involved.

Many thanks,

Graham Hutton

--  
Prof Graham Hutton
Functional Programming Lab
School of Computer Science
University of Nottingham, UK
http://www.cs.nott.ac.uk/~gmh


This message and any attachment are intended solely for the addressee and may 
contain confidential information. If you have received this message in error, 
please send it back to me, and immediately delete it.   Please do not use, copy 
or disclose the information contained in this message or in any attachment.  
Any views or opinions expressed by the author of this email do not necessarily 
reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.

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


[Haskell-cafe] Question about updating GHC on MacOS

2013-03-07 Thread Graham Klyne

Hi,

I have Haskell Platform with GHC[i] 7.4.2 installed on a MacOS system.  There's 
a problem with the handling of certain Markdown constructs in literate Haskell 
(lines starting with '#') that I understand is fixed in 7.6.2.


Therefore, I'd like to be able to update my GHC installation to 7.6.2.  But I 
haven't yet been able to find any instructions about how to upgrade an existing 
GHC installation.  Am I missing something?


#g
--

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


[Haskell-cafe] PhD Studentship in Nottingham

2013-02-21 Thread Graham Hutton
Dear all,

The School of Computer Science at the University of Nottingham
is currently advertising a PhD position on applying functional
programming techniques to optimisation problems:

   http://www.cs.nott.ac.uk/~ajp/PhD-opportunities.htm

This would be a great position for someone who is interested
in applying FP ideas to real-world problems.  The closing
date for applications is 28th February 2013.  If you have
any queries about the position, please contact Andrew
Parkes .

Best wishes,

Graham

--  
Prof Graham Hutton
Functional Programming Lab
School of Computer Science
University of Nottingham, UK
http://www.cs.nott.ac.uk/~gmh


This message and any attachment are intended solely for the addressee and may 
contain confidential information. If you have received this message in error, 
please send it back to me, and immediately delete it.   Please do not use, copy 
or disclose the information contained in this message or in any attachment.  
Any views or opinions expressed by the author of this email do not necessarily 
reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.

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


[Haskell-cafe] PhD studentships in Nottingham

2013-01-16 Thread Graham Hutton
Dear all,

The School of Computer Science in Nottingham is advertising
a number of PhD studentships.  Applicants in the area of
the Functional Programming Lab (fp.cs.nott.ac.uk) would
be very welcome.  If you are interested in applying, please
contact a potential academic supervisor in the FP lab prior
to submitting your application.  Note that I'm not available
to supervise new students myself this coming academic year.

Graham Hutton
University of Nottingham

+---+

  Fully-Funded PhD Studentships

   School of Computer Science
  University of Nottingham, UK

Applications are invited for a number of fully-funded PhD
studentships in the School of Computer Science at the
University of Nottingham, starting on 1st October 2013.

The topics for the studentships are open, but will relate to
the research interests of existing members of staff within
the School.  Applicants should have discussed their interest
and obtained the support of a named potential supervisor before
applying.  The studentships are for three years and include a
maintenance grant of 13,726 UK pounds per year and tuition
fees for UK students.  The positions are open to students of
any nationality, but non-UK students will require additional
funding to cover tuition fees, which is awarded by the
University on a competitive basis.

Applicants will normally require a first-class Undergraduate or
Masters degree in Computer Science or a related discipline.

Informal enquiries may be addressed to Christine Fletcher
.

To apply, please submit the following items by email to the
above address: (1) a brief covering letter that describes your
reasons for wishing to pursue a PhD, any ideas you have regarding
possible areas or topics, and the name of a potential supervisor;
(2) a copy of your CV, including your actual or expected degree
class(es), and results of all University examinations; (3) an
example of your technical writing, such as a project report or
dissertation; (4) contact details for two academic referees.

*Closing date for applications:* 8th February 2013

+---+

--  
Prof Graham Hutton
Functional Programming Lab
School of Computer Science
University of Nottingham, UK
http://www.cs.nott.ac.uk/~gmh


This message and any attachment are intended solely for the addressee and may 
contain confidential information. If you have received this message in error, 
please send it back to me, and immediately delete it.   Please do not use, copy 
or disclose the information contained in this message or in any attachment.  
Any views or opinions expressed by the author of this email do not necessarily 
reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.

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


Re: [Haskell-cafe] HTF & Quickcheck

2012-12-18 Thread graham
Thanks, how does using /= not cause test failures ? Just the sample rate
will be high enough ?

On Tue, Dec 18, 2012, at 06:04 PM, Simon Hengel wrote:
> On Tue, Dec 18, 2012 at 05:25:41PM +, gra...@fatlazycat.com wrote:
> > Are there any libraries that define various common generators ?
> > 
> > What would be the cleanest way to define two positive integers below
> > 1000 that are different ? Seems relatively easy with conditionals.
> 
> You can still use (==>) to ensure that two numbers are different.  I
> would use something like this:
> 
> newtype Small = Small Int
>   deriving Show
> 
> instance Arbitrary Small where
>   arbitrary = Small . (`mod` 1000) <$> arbitrary
> 
> prop_foo (Small x) (Small y) = x /= y ==> ...
> 
> Cheers,
> Simon

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


Re: [Haskell-cafe] HTF & Quickcheck

2012-12-18 Thread graham
Are there any libraries that define various common generators ?

What would be the cleanest way to define two positive integers below
1000 that are different ? Seems relatively easy with conditionals.

Thanks

On Tue, Dec 18, 2012, at 07:01 AM, gra...@fatlazycat.com wrote:
> So what use are conditional properties meant to be used for ??
> 
> If you just want 2 integers that are not equal, it would seem a lot
> simpler to do this as a conditional rather than constructing some pair
> in an arbitrary instance ?!?
> 
> Thanks
> 
> On Mon, Dec 17, 2012, at 11:20 PM, Simon Hengel wrote:
> > On Mon, Dec 17, 2012 at 06:04:15PM +0200, Roman Cheplyaka wrote:
> > > Unfortunately, I don't know the answer to your question.
> > > 
> > > However, if you don't find a solution, I suggest using SmallCheck
> > > instead of QuickCheck — it works better when you have many unsuitable
> > > cases.
> > > https://github.com/feuerbach/smallcheck/wiki/Comparison-with-QuickCheck
> > > 
> > > As far as I know, SmallCheck is not supported by HTF, but it is
> > > supported by test-framework.
> > 
> > test-framework also sometimes thinks a "Gave up!" is not a fail, which I
> > think is a bug.  But I gave up on trying to get that fixed [1], e.g.
> > this (admittedly contrived) property is still a pass with
> > test-framework:
> > 
> > defaultMain [testProperty "foo" $ \x -> x == 23 ==> True]
> > 
> > Cheers,
> > Simon
> > 
> > [1] https://github.com/batterseapower/test-framework/issues/16

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


Re: [Haskell-cafe] HTF & Quickcheck

2012-12-17 Thread graham
So what use are conditional properties meant to be used for ??

If you just want 2 integers that are not equal, it would seem a lot
simpler to do this as a conditional rather than constructing some pair
in an arbitrary instance ?!?

Thanks

On Mon, Dec 17, 2012, at 11:20 PM, Simon Hengel wrote:
> On Mon, Dec 17, 2012 at 06:04:15PM +0200, Roman Cheplyaka wrote:
> > Unfortunately, I don't know the answer to your question.
> > 
> > However, if you don't find a solution, I suggest using SmallCheck
> > instead of QuickCheck — it works better when you have many unsuitable
> > cases.
> > https://github.com/feuerbach/smallcheck/wiki/Comparison-with-QuickCheck
> > 
> > As far as I know, SmallCheck is not supported by HTF, but it is
> > supported by test-framework.
> 
> test-framework also sometimes thinks a "Gave up!" is not a fail, which I
> think is a bug.  But I gave up on trying to get that fixed [1], e.g.
> this (admittedly contrived) property is still a pass with
> test-framework:
> 
> defaultMain [testProperty "foo" $ \x -> x == 23 ==> True]
> 
> Cheers,
> Simon
> 
> [1] https://github.com/batterseapower/test-framework/issues/16

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


[Haskell-cafe] HTF & Quickcheck

2012-12-17 Thread graham
Getting test failures, I believe, due to using conditional properties
within quickckeck etc

[TEST] RecFunSpec:map (test/RecFunSpec.hs:48)
Gave up! Passed only 20 tests.
*** Failed! (2ms)

Is there a way for HTF/Quickcheck to specify these are not failed i.e.
only fail if there is an actual error ?

Thanks

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


[Haskell-cafe] QuickCheck Generators

2012-11-20 Thread graham
I have 

data Tweet = Tweet {
user :: String,
text :: String,
retweets :: Double
} deriving (Show)

data TweetSet = NoTweets | SomeTweets Tweet TweetSet TweetSet

and trying to create some generators for testing, with

instance Arbitrary Tweet where
  arbitrary = liftM3 Tweet arbitrary arbitrary arbitrary 
  
instance Arbitrary TweetSet where
  arbitrary = sized set'
where set' 0 = return NoTweets
  set' n | n>0 = oneof[return NoTweets, liftM3 SomeTweets
  arbitrary subTweets subTweets]
where subTweets = set' (n `div` 2) 

but wondering how I would go about generating a random TweetSet that
contains a known random Tweet I later have reference to and I would also
assume the known Tweet to be placed randomly.

Then I could test a contains function.

Thanks

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


Re: [Haskell-cafe] Quickcheck

2012-11-13 Thread graham
Thanks, that handy and works for my test.



Any idea why the implication does not ???





On Tue, Nov 13, 2012, at 09:59 PM, Ozgur Akgun wrote:

hi,



On 13 November 2012 21:52, <[1]gra...@fatlazycat.com> wrote:

prop_something x y = ...do blah with positive integers

  ==> x > 0 && y > 0


quickcheck provides a few nice new types for such cases. try:



prop_something (Positive x) (Positive y) = ...



this way qc only generates positive numbers, instead of generating and
discarding some.

hth,

--
Ozgur Akgun

References

1. mailto:gra...@fatlazycat.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Quickcheck

2012-11-13 Thread graham
Thanks, will try them both. With regards to the implication I assume
it's just regarded as one property test ?

To get two values greater than zero I have something like

prop_something x y = ...do blah with positive integers
  ==> x > 0 && y > 0

But my test fails as it appears to be injecting a negative number and
the test fails. But the implication does not cause the failed test to be
ignored.

Must be missing something ???

Thanks

On Mon, Nov 12, 2012, at 10:00 PM, Iustin Pop wrote:
> On Mon, Nov 12, 2012 at 10:14:30PM +0100, Simon Hengel wrote:
> > On Mon, Nov 12, 2012 at 07:21:06PM +, gra...@fatlazycat.com wrote:
> > > Hi, 
> > > 
> > > Trying to find some good docs on QuickCheck, if anyone has one ?
> > > 
> > > Been scanning what I can find, but a question.
> > > 
> > > What would be the best way to generate two different/distinct integers ?
> > 
> > I would use Quickcheck's implication operator here:
> > 
> > quickCheck $ \x y -> x /= (y :: Int) ==> ...
> 
> That's good, but it only eliminates test cases after they have been
> generated. A slightly better (IMHO) version is to generate "correct"
> values in the first place:
> 
> prop_Test :: Property
> prop_Test =
> forAll (arbitrary::Gen Int) $ \x ->
> forAll (arbitrary `suchThat` (/= x)) $ \y ->
> …
> 
> regards,
> iustin

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


[Haskell-cafe] Quickcheck

2012-11-12 Thread graham
Hi, 

Trying to find some good docs on QuickCheck, if anyone has one ?

Been scanning what I can find, but a question.

What would be the best way to generate two different/distinct integers ?

Use arbitrary ( if so do you have an example ) or a conditional on the
property.

Though I read the later can reduce passing test count.

Thanks
Graham

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


[Haskell-cafe] Online haskell course

2012-10-24 Thread graham
Anyone know of a similar course to the coursera scala one for haskell ?

https://www.coursera.org/course/progfun

Quite interesting online course that has graded assignments.

Anything similar or anyone considering doing something similar for
haskell ?

Thanks
Graham

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


Re: [Haskell-cafe] Handcranked install of ghc / cabal-install and warning from ghc-pkg check

2012-05-09 Thread Graham Berks
or should I say cabal  

On Wednesday, 9 May 2012 at 21:57, Graham Berks wrote:

> Is there something I have todo to tell ghc about haddock etc ? 
> 
> On Tuesday, 8 May 2012 at 19:13, Graham Berks wrote:
> 
> > Have installed 7.4.1 ghc and 0.14.0 cabal-install and then did alex, happy 
> > & haddock.
> > 
> > When I do a ghc-pkg check I get 
> > 
> > $ ghc-pkg check
> > Warning: haddock-interfaces: 
> > /usr/local/Cellar/cabal-install/0.14.0/share/doc/random-1.0.1.1/html/random.haddock
> >  doesn't exist or isn't a file
> > Warning: haddock-html: 
> > /usr/local/Cellar/cabal-install/0.14.0/share/doc/random-1.0.1.1/html 
> > doesn't exist or isn't a directory
> > Warning: haddock-interfaces: 
> > /usr/local/Cellar/cabal-install/0.14.0/share/doc/zlib-0.5.3.3/html/zlib.haddock
> >  doesn't exist or isn't a file
> > Warning: haddock-html: 
> > /usr/local/Cellar/cabal-install/0.14.0/share/doc/zlib-0.5.3.3/html doesn't 
> > exist or isn't a directory
> > Warning: haddock-interfaces: 
> > /usr/local/Cellar/cabal-install/0.14.0/share/doc/HTTP-4000.2.3/html/HTTP.haddock
> >  doesn't exist or isn't a file
> > Warning: haddock-html: 
> > /usr/local/Cellar/cabal-install/0.14.0/share/doc/HTTP-4000.2.3/html doesn't 
> > exist or isn't a directory
> > Warning: haddock-interfaces: 
> > /usr/local/Cellar/cabal-install/0.14.0/share/doc/network-2.3.0.11/html/network.haddock
> >  doesn't exist or isn't a file
> > Warning: haddock-html: 
> > /usr/local/Cellar/cabal-install/0.14.0/share/doc/network-2.3.0.11/html 
> > doesn't exist or isn't a directory
> > Warning: haddock-interfaces: 
> > /usr/local/Cellar/cabal-install/0.14.0/share/doc/parsec-3.1.2/html/parsec.haddock
> >  doesn't exist or isn't a file
> > Warning: haddock-html: 
> > /usr/local/Cellar/cabal-install/0.14.0/share/doc/parsec-3.1.2/html doesn't 
> > exist or isn't a directory
> > Warning: haddock-interfaces: 
> > /usr/local/Cellar/cabal-install/0.14.0/share/doc/text-0.11.2.0/html/text.haddock
> >  doesn't exist or isn't a file
> > Warning: haddock-html: 
> > /usr/local/Cellar/cabal-install/0.14.0/share/doc/text-0.11.2.0/html doesn't 
> > exist or isn't a directory
> > Warning: haddock-interfaces: 
> > /usr/local/Cellar/cabal-install/0.14.0/share/doc/mtl-2.1/html/mtl.haddock 
> > doesn't exist or isn't a file
> > Warning: haddock-html: 
> > /usr/local/Cellar/cabal-install/0.14.0/share/doc/mtl-2.1/html doesn't exist 
> > or isn't a directory
> > Warning: haddock-interfaces: 
> > /usr/local/Cellar/cabal-install/0.14.0/share/doc/transformers-0.3.0.0/html/transformers.haddock
> >  doesn't exist or isn't a file
> > Warning: haddock-html: 
> > /usr/local/Cellar/cabal-install/0.14.0/share/doc/transformers-0.3.0.0/html 
> > doesn't exist or isn't a directory
> > Warning: haddock-interfaces: 
> > /usr/local/share/doc/haddock-2.10.0/html/haddock.haddock doesn't exist or 
> > isn't a file
> > Warning: haddock-html: /usr/local/share/doc/haddock-2.10.0/html doesn't 
> > exist or isn't a directory
> > Warning: haddock-interfaces: 
> > /usr/local/share/doc/xhtml-3000.2.0.5/html/xhtml.haddock doesn't exist or 
> > isn't a file
> > Warning: haddock-html: /usr/local/share/doc/xhtml-3000.2.0.5/html doesn't 
> > exist or isn't a directory
> > Warning: haddock-interfaces: 
> > /usr/local/share/doc/ghc-paths-0.1.0.8/html/ghc-paths.haddock doesn't exist 
> > or isn't a file
> > Warning: haddock-html: /usr/local/share/doc/ghc-paths-0.1.0.8/html doesn't 
> > exist or isn't a directory
> > Warning: haddock-interfaces: 
> > /usr/local/share/doc/mtl-2.1.1/html/mtl.haddock doesn't exist or isn't a 
> > file
> > Warning: haddock-html: /usr/local/share/doc/mtl-2.1.1/html doesn't exist or 
> > isn't a directory
> > Warning: haddock-interfaces: 
> > /usr/local/share/doc/transformers-0.3.0.0/html/transformers.haddock doesn't 
> > exist or isn't a file
> > Warning: haddock-html: /usr/local/share/doc/transformers-0.3.0.0/html 
> > doesn't exist or isn't a directory
> > Warning: haddock-interfaces: 
> > /usr/local/share/doc/QuickCheck-2.4.2/html/QuickCheck.haddock doesn't exist 
> > or isn't a file
> > Warning: haddock-html: /usr/local/share/doc/QuickCheck-2.4.2/html doesn't 
> > exist or isn't a directory
> > Warning: haddock-interfaces: 
> > /usr/local/share/doc/random-1.0.1.1/html/random.haddock doesn't exist or 
> > isn't a file
> > Warning: haddock-html: /usr/local/share/doc/random-1.0.1.1/html doesn't 
> > exist or isn't a directory
> > 
> > 
> > Any suggestions to fix this ? 
> > 
> > Thanks 
> 

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


Re: [Haskell-cafe] Handcranked install of ghc / cabal-install and warning from ghc-pkg check

2012-05-09 Thread Graham Berks
Is there something I have todo to tell ghc about haddock etc ? 


On Tuesday, 8 May 2012 at 19:13, Graham Berks wrote:

> Have installed 7.4.1 ghc and 0.14.0 cabal-install and then did alex, happy & 
> haddock.
> 
> When I do a ghc-pkg check I get 
> 
> $ ghc-pkg check
> Warning: haddock-interfaces: 
> /usr/local/Cellar/cabal-install/0.14.0/share/doc/random-1.0.1.1/html/random.haddock
>  doesn't exist or isn't a file
> Warning: haddock-html: 
> /usr/local/Cellar/cabal-install/0.14.0/share/doc/random-1.0.1.1/html doesn't 
> exist or isn't a directory
> Warning: haddock-interfaces: 
> /usr/local/Cellar/cabal-install/0.14.0/share/doc/zlib-0.5.3.3/html/zlib.haddock
>  doesn't exist or isn't a file
> Warning: haddock-html: 
> /usr/local/Cellar/cabal-install/0.14.0/share/doc/zlib-0.5.3.3/html doesn't 
> exist or isn't a directory
> Warning: haddock-interfaces: 
> /usr/local/Cellar/cabal-install/0.14.0/share/doc/HTTP-4000.2.3/html/HTTP.haddock
>  doesn't exist or isn't a file
> Warning: haddock-html: 
> /usr/local/Cellar/cabal-install/0.14.0/share/doc/HTTP-4000.2.3/html doesn't 
> exist or isn't a directory
> Warning: haddock-interfaces: 
> /usr/local/Cellar/cabal-install/0.14.0/share/doc/network-2.3.0.11/html/network.haddock
>  doesn't exist or isn't a file
> Warning: haddock-html: 
> /usr/local/Cellar/cabal-install/0.14.0/share/doc/network-2.3.0.11/html 
> doesn't exist or isn't a directory
> Warning: haddock-interfaces: 
> /usr/local/Cellar/cabal-install/0.14.0/share/doc/parsec-3.1.2/html/parsec.haddock
>  doesn't exist or isn't a file
> Warning: haddock-html: 
> /usr/local/Cellar/cabal-install/0.14.0/share/doc/parsec-3.1.2/html doesn't 
> exist or isn't a directory
> Warning: haddock-interfaces: 
> /usr/local/Cellar/cabal-install/0.14.0/share/doc/text-0.11.2.0/html/text.haddock
>  doesn't exist or isn't a file
> Warning: haddock-html: 
> /usr/local/Cellar/cabal-install/0.14.0/share/doc/text-0.11.2.0/html doesn't 
> exist or isn't a directory
> Warning: haddock-interfaces: 
> /usr/local/Cellar/cabal-install/0.14.0/share/doc/mtl-2.1/html/mtl.haddock 
> doesn't exist or isn't a file
> Warning: haddock-html: 
> /usr/local/Cellar/cabal-install/0.14.0/share/doc/mtl-2.1/html doesn't exist 
> or isn't a directory
> Warning: haddock-interfaces: 
> /usr/local/Cellar/cabal-install/0.14.0/share/doc/transformers-0.3.0.0/html/transformers.haddock
>  doesn't exist or isn't a file
> Warning: haddock-html: 
> /usr/local/Cellar/cabal-install/0.14.0/share/doc/transformers-0.3.0.0/html 
> doesn't exist or isn't a directory
> Warning: haddock-interfaces: 
> /usr/local/share/doc/haddock-2.10.0/html/haddock.haddock doesn't exist or 
> isn't a file
> Warning: haddock-html: /usr/local/share/doc/haddock-2.10.0/html doesn't exist 
> or isn't a directory
> Warning: haddock-interfaces: 
> /usr/local/share/doc/xhtml-3000.2.0.5/html/xhtml.haddock doesn't exist or 
> isn't a file
> Warning: haddock-html: /usr/local/share/doc/xhtml-3000.2.0.5/html doesn't 
> exist or isn't a directory
> Warning: haddock-interfaces: 
> /usr/local/share/doc/ghc-paths-0.1.0.8/html/ghc-paths.haddock doesn't exist 
> or isn't a file
> Warning: haddock-html: /usr/local/share/doc/ghc-paths-0.1.0.8/html doesn't 
> exist or isn't a directory
> Warning: haddock-interfaces: /usr/local/share/doc/mtl-2.1.1/html/mtl.haddock 
> doesn't exist or isn't a file
> Warning: haddock-html: /usr/local/share/doc/mtl-2.1.1/html doesn't exist or 
> isn't a directory
> Warning: haddock-interfaces: 
> /usr/local/share/doc/transformers-0.3.0.0/html/transformers.haddock doesn't 
> exist or isn't a file
> Warning: haddock-html: /usr/local/share/doc/transformers-0.3.0.0/html doesn't 
> exist or isn't a directory
> Warning: haddock-interfaces: 
> /usr/local/share/doc/QuickCheck-2.4.2/html/QuickCheck.haddock doesn't exist 
> or isn't a file
> Warning: haddock-html: /usr/local/share/doc/QuickCheck-2.4.2/html doesn't 
> exist or isn't a directory
> Warning: haddock-interfaces: 
> /usr/local/share/doc/random-1.0.1.1/html/random.haddock doesn't exist or 
> isn't a file
> Warning: haddock-html: /usr/local/share/doc/random-1.0.1.1/html doesn't exist 
> or isn't a directory
> 
> 
> Any suggestions to fix this ? 
> 
> Thanks 

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


Re: [Haskell-cafe] cabal issue

2012-05-09 Thread Graham Berks
Have solved the issue with help from JP Moresmau.

Used the command 

cabal install --dry-run --verbose=3 --global build wrapper

And this gave enough detailed info to enable me to remove the conflict and 
resolve the issue.

Thanks goes to JP !


On Wednesday, 9 May 2012 at 09:55, Graham Berks wrote:

> Given that I have the dependant packages already installed when I do 
> 
> $ cabal install --dry-run --global buildwrapper Resolving dependencies... In 
> order, the following would be installed: mtl-2.1.1 (new version) 
> aeson-0.6.0.2 (reinstall) changes: mtl-2.0.1.0 -> 2.1.1 parsec-3.1.2 
> (reinstall) changes: mtl-2.0.1.0 -> 2.1.1 regex-base-0.93.2 (reinstall) 
> changes: mtl-2.0.1.0 -> 2.1.1 regex-tdfa-1.1.8 (reinstall) changes: 
> mtl-2.0.1.0 -> 2.1.1 buildwrapper-0.5.2 (new package)
> 
> And that build wrapper doesn't have a defined dependency version number for 
> MTL 
> can someone tell me why cabal is trying to install a new version of MTL ?
> 
> Thanks 

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


[Haskell-cafe] cabal issue

2012-05-09 Thread Graham Berks
Given that I have the dependant packages already installed when I do 

$ cabal install --dry-run --global buildwrapper Resolving dependencies... In 
order, the following would be installed: mtl-2.1.1 (new version) aeson-0.6.0.2 
(reinstall) changes: mtl-2.0.1.0 -> 2.1.1 parsec-3.1.2 (reinstall) changes: 
mtl-2.0.1.0 -> 2.1.1 regex-base-0.93.2 (reinstall) changes: mtl-2.0.1.0 -> 
2.1.1 regex-tdfa-1.1.8 (reinstall) changes: mtl-2.0.1.0 -> 2.1.1 
buildwrapper-0.5.2 (new package)

And that build wrapper doesn't have a defined dependency version number for MTL 
can someone tell me why cabal is trying to install a new version of MTL ?

Thanks 

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


[Haskell-cafe] Handcranked install of ghc / cabal-install and warning from ghc-pkg check

2012-05-08 Thread Graham Berks
Have installed 7.4.1 ghc and 0.14.0 cabal-install and then did alex, happy & 
haddock.

When I do a ghc-pkg check I get 

$ ghc-pkg check
Warning: haddock-interfaces: 
/usr/local/Cellar/cabal-install/0.14.0/share/doc/random-1.0.1.1/html/random.haddock
 doesn't exist or isn't a file
Warning: haddock-html: 
/usr/local/Cellar/cabal-install/0.14.0/share/doc/random-1.0.1.1/html doesn't 
exist or isn't a directory
Warning: haddock-interfaces: 
/usr/local/Cellar/cabal-install/0.14.0/share/doc/zlib-0.5.3.3/html/zlib.haddock 
doesn't exist or isn't a file
Warning: haddock-html: 
/usr/local/Cellar/cabal-install/0.14.0/share/doc/zlib-0.5.3.3/html doesn't 
exist or isn't a directory
Warning: haddock-interfaces: 
/usr/local/Cellar/cabal-install/0.14.0/share/doc/HTTP-4000.2.3/html/HTTP.haddock
 doesn't exist or isn't a file
Warning: haddock-html: 
/usr/local/Cellar/cabal-install/0.14.0/share/doc/HTTP-4000.2.3/html doesn't 
exist or isn't a directory
Warning: haddock-interfaces: 
/usr/local/Cellar/cabal-install/0.14.0/share/doc/network-2.3.0.11/html/network.haddock
 doesn't exist or isn't a file
Warning: haddock-html: 
/usr/local/Cellar/cabal-install/0.14.0/share/doc/network-2.3.0.11/html doesn't 
exist or isn't a directory
Warning: haddock-interfaces: 
/usr/local/Cellar/cabal-install/0.14.0/share/doc/parsec-3.1.2/html/parsec.haddock
 doesn't exist or isn't a file
Warning: haddock-html: 
/usr/local/Cellar/cabal-install/0.14.0/share/doc/parsec-3.1.2/html doesn't 
exist or isn't a directory
Warning: haddock-interfaces: 
/usr/local/Cellar/cabal-install/0.14.0/share/doc/text-0.11.2.0/html/text.haddock
 doesn't exist or isn't a file
Warning: haddock-html: 
/usr/local/Cellar/cabal-install/0.14.0/share/doc/text-0.11.2.0/html doesn't 
exist or isn't a directory
Warning: haddock-interfaces: 
/usr/local/Cellar/cabal-install/0.14.0/share/doc/mtl-2.1/html/mtl.haddock 
doesn't exist or isn't a file
Warning: haddock-html: 
/usr/local/Cellar/cabal-install/0.14.0/share/doc/mtl-2.1/html doesn't exist or 
isn't a directory
Warning: haddock-interfaces: 
/usr/local/Cellar/cabal-install/0.14.0/share/doc/transformers-0.3.0.0/html/transformers.haddock
 doesn't exist or isn't a file
Warning: haddock-html: 
/usr/local/Cellar/cabal-install/0.14.0/share/doc/transformers-0.3.0.0/html 
doesn't exist or isn't a directory
Warning: haddock-interfaces: 
/usr/local/share/doc/haddock-2.10.0/html/haddock.haddock doesn't exist or isn't 
a file
Warning: haddock-html: /usr/local/share/doc/haddock-2.10.0/html doesn't exist 
or isn't a directory
Warning: haddock-interfaces: 
/usr/local/share/doc/xhtml-3000.2.0.5/html/xhtml.haddock doesn't exist or isn't 
a file
Warning: haddock-html: /usr/local/share/doc/xhtml-3000.2.0.5/html doesn't exist 
or isn't a directory
Warning: haddock-interfaces: 
/usr/local/share/doc/ghc-paths-0.1.0.8/html/ghc-paths.haddock doesn't exist or 
isn't a file
Warning: haddock-html: /usr/local/share/doc/ghc-paths-0.1.0.8/html doesn't 
exist or isn't a directory
Warning: haddock-interfaces: /usr/local/share/doc/mtl-2.1.1/html/mtl.haddock 
doesn't exist or isn't a file
Warning: haddock-html: /usr/local/share/doc/mtl-2.1.1/html doesn't exist or 
isn't a directory
Warning: haddock-interfaces: 
/usr/local/share/doc/transformers-0.3.0.0/html/transformers.haddock doesn't 
exist or isn't a file
Warning: haddock-html: /usr/local/share/doc/transformers-0.3.0.0/html doesn't 
exist or isn't a directory
Warning: haddock-interfaces: 
/usr/local/share/doc/QuickCheck-2.4.2/html/QuickCheck.haddock doesn't exist or 
isn't a file
Warning: haddock-html: /usr/local/share/doc/QuickCheck-2.4.2/html doesn't exist 
or isn't a directory
Warning: haddock-interfaces: 
/usr/local/share/doc/random-1.0.1.1/html/random.haddock doesn't exist or isn't 
a file
Warning: haddock-html: /usr/local/share/doc/random-1.0.1.1/html doesn't exist 
or isn't a directory


Any suggestions to fix this ? 

Thanks 

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


[Haskell-cafe] library conflicts and how to resolve them

2012-05-06 Thread Graham Berks
Attempting  

$ cabal install persistent
Resolving dependencies...
In order, the following would be installed:
aeson-0.6.0.2 (reinstall) changes: mtl-2.1.1 -> 2.0.1.0
persistent-0.9.0.3 (new package)
cabal: The following packages are likely to be broken by the reinstalls:
buildwrapper-0.5.2
Use --force-reinstalls if you want to install anyway.


Any ideas what is going on ? I believe aeson-0.6.0.2  is already installed.
And as far as I can tell the build of aeson-0.6.0.2 doesn't require that 
specific version of mtl.

Am I missing something ? Is there a way to force ghc to ignore this ??

Thanks 

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


[Haskell-cafe] Issues with installing packages

2012-05-05 Thread Graham Berks
New to haskell and having issues resolving packages, have the following output 
below and can't seem to resolve it. 

Text seems to have diff hash dependancies when I try and instal a diff version 
of 0.11.2.0 etc

Any ideas on what todo ??

Thanks

$ ghc-pkg check
There are problems in package scion-browser-0.2.8:
  dependency "text-0.11.2.0-2b6cea8526e93af24bb0154400fd64a6" doesn't exist
There are problems in package persistent-template-0.9.0.1:
  dependency "text-0.11.2.0-2b6cea8526e93af24bb0154400fd64a6" doesn't exist
There are problems in package persistent-sqlite-0.9.0.1:
  dependency "text-0.11.2.0-2b6cea8526e93af24bb0154400fd64a6" doesn't exist
There are problems in package persistent-0.9.0.3:
  dependency "text-0.11.2.0-2b6cea8526e93af24bb0154400fd64a6" doesn't exist
There are problems in package aeson-0.6.0.2:
  dependency "text-0.11.2.0-2b6cea8526e93af24bb0154400fd64a6" doesn't exist
There are problems in package path-pieces-0.1.1:
  dependency "text-0.11.2.0-2b6cea8526e93af24bb0154400fd64a6" doesn't exist
There are problems in package hashable-1.1.2.3:
  dependency "text-0.11.2.0-2b6cea8526e93af24bb0154400fd64a6" doesn't exist
There are problems in package conduit-0.4.1.1:
  dependency "text-0.11.2.0-2b6cea8526e93af24bb0154400fd64a6" doesn't exist
There are problems in package blaze-html-0.4.3.4:
  dependency "text-0.11.2.0-2b6cea8526e93af24bb0154400fd64a6" doesn't exist
There are problems in package blaze-builder-0.3.1.0:
  dependency "text-0.11.2.0-2b6cea8526e93af24bb0154400fd64a6" doesn't exist
There are problems in package attoparsec-0.10.1.1:
  dependency "text-0.11.2.0-2b6cea8526e93af24bb0154400fd64a6" doesn't exist
There are problems in package buildwrapper-0.5.2:
  dependency "aeson-0.6.0.2-f5264d3642c44cd43d87b542486e49c9" doesn't exist
  dependency "attoparsec-0.10.1.1-d3ad0453e3127b6c51ccb14a5cb6f38d" doesn't 
exist
  dependency "unordered-containers-0.2.1.0-9b5d4d7fe2d79561a684ee5184ea5fd0" 
doesn't exist
There are problems in package hoogle-4.2.11:
  dependency "blaze-builder-0.3.1.0-adf48413bb3bfeef99ef5e18de097dbd" doesn't 
exist
  dependency "conduit-0.4.1.1-6c1a48d4c94e05132c53b85e7ca48cd9" doesn't exist
  dependency "parsec-3.1.1-d3c0b4413115a5e82a1a5cf9b0b35fee" doesn't exist
There are problems in package warp-1.2.0.1:
  dependency "blaze-builder-0.3.1.0-adf48413bb3bfeef99ef5e18de097dbd" doesn't 
exist
  dependency "conduit-0.4.1.1-6c1a48d4c94e05132c53b85e7ca48cd9" doesn't exist
There are problems in package wai-1.2.0.1:
  dependency "blaze-builder-0.3.1.0-adf48413bb3bfeef99ef5e18de097dbd" doesn't 
exist
  dependency "conduit-0.4.1.1-6c1a48d4c94e05132c53b85e7ca48cd9" doesn't exist
There are problems in package network-conduit-0.4.0:
  dependency "conduit-0.4.1.1-6c1a48d4c94e05132c53b85e7ca48cd9" doesn't exist
There are problems in package blaze-builder-conduit-0.4.0.1:
  dependency "blaze-builder-0.3.1.0-adf48413bb3bfeef99ef5e18de097dbd" doesn't 
exist
  dependency "conduit-0.4.1.1-6c1a48d4c94e05132c53b85e7ca48cd9" doesn't exist
There are problems in package network-2.3.0.5:
  dependency "parsec-3.1.1-d3c0b4413115a5e82a1a5cf9b0b35fee" doesn't exist
There are problems in package http-types-0.6.10:
  dependency "blaze-builder-0.3.1.0-adf48413bb3bfeef99ef5e18de097dbd" doesn't 
exist
There are problems in package case-insensitive-0.4.0.1:
  dependency "hashable-1.1.2.3-037c817e51d5d10d89306e9472e2e0bd" doesn't exist
There are problems in package test-framework-th-0.2.2:
  dependency "test-framework-0.6-7d2482720de09487769f301ebc001970" doesn't exist
There are problems in package test-framework-quickcheck2-0.2.12.1:
  dependency "test-framework-0.6-7d2482720de09487769f301ebc001970" doesn't exist
There are problems in package test-framework-quickcheck-0.2.8:
  dependency "test-framework-0.6-7d2482720de09487769f301ebc001970" doesn't exist
There are problems in package test-framework-hunit-0.2.7:
  dependency "test-framework-0.6-7d2482720de09487769f301ebc001970" doesn't exist

The following packages are broken, either because they have a problem
listed above, or because they depend on a broken package.
scion-browser-0.2.8
persistent-template-0.9.0.1
persistent-sqlite-0.9.0.1
persistent-0.9.0.3
aeson-0.6.0.2
path-pieces-0.1.1
hashable-1.1.2.3
conduit-0.4.1.1
blaze-html-0.4.3.4
blaze-builder-0.3.1.0
attoparsec-0.10.1.1
buildwrapper-0.5.2
hoogle-4.2.11
warp-1.2.0.1
wai-1.2.0.1
network-conduit-0.4.0
blaze-builder-conduit-0.4.0.1
network-2.3.0.5
http-types-0.6.10
case-insensitive-0.4.0.1
test-framework-th-0.2.2
test-framework-quickcheck2-0.2.12.1
test-framework-quickcheck-0.2.8
test-framework-hunit-0.2.7
unordered-containers-0.2.1.0
pool-conduit-0.1.0.1
resource-pool-0.2.1.0
simple-sendfile-0.2.3
cgi-3001.1.7.4
haskell-platform-2011.4.0.0
HTTP-4000.1.2


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


[Haskell-cafe] Update of haskell cafe on google groups

2012-04-28 Thread Graham Berks
Has this stopped working ? 

Seems a bit out of date ?

Thanks 

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


[Haskell-cafe] Automatic discovery of tests

2012-04-28 Thread Graham Berks
Hi, trying to learn haskell and the associated build env.
I come from a java/scala world so trying to understand the how to invoke tests.

Have a cabal file that invokes a main function to execute a test.
But wondering if there is any automatic discovery of tests as per junit.

I have seen test-framework-th but to me that implies putting a 
testGroupGenerator into each module. Am i correct about that and if so is there 
an example of calling multiple modules tests ?

Or is there a better way just to invoke specific functions prefixed with case_ 
prop_ etc in the entire src/test directory of the cabal build ?

Thanks 

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


Re: [Haskell-cafe] building ghc on arch linux ARM?

2012-04-09 Thread Graham Klyne

On 09/04/2012 00:45, Joey Hess wrote:

Thomas DuBuisson wrote:

On Sun, Apr 8, 2012 at 4:03 PM, Francesco Mazzoli  wrote:

No, it is not possible to build GHC without GHC. Building GHC on ARM is
going to be extremely tricky (I'm not sure anyone has ever done it).


I used to use an unregistered build of GHC built by someone in the
Debian community - it worked well enough.


It ships with Debian, along with the full Haskell Platform built for ARM
and lots of other libraries. Other than speed, it's fine.


Hmmm... I wonder if it will squeeze onto a Raspberry Pi :)

#g
--


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


Re: [Haskell-cafe] Why so many strings in Network.URI, System.Posix and similar libraries?

2012-03-14 Thread Graham Klyne

Hi,

I only just noticed this discussion.  Essentially, I think you have arrived at 
the right conclusion regarding URIs.


For more background, the IRI document makes interesting reading in this context: 
http://tools.ietf.org/html/rfc3987; esp. sections 2, 2.1.


The IRI is defined in terms of Unicode characters, which themselves may be 
described/referenced in terms of their code points, but the character encoding 
is not prescribed.


In practice, I think systems are increasingly using UTF-8 for transmitting IRIs 
and URIs, and using either UTF-8 or UTF-16 for internal storage.  There is still 
a legacy of ISO-8859-1 being defined asthe default charset for HTML (cf. 
http://www.w3.org/International/O-HTTP-charset for further discussiomn).


#g
--

On 14/03/2012 06:43, Jason Dusek wrote:

2012/3/12 Jeremy Shaw:

On Sun, Mar 11, 2012 at 1:33 PM, Jason Dusek  wrote:

Well, to quote one example from RFC 3986:

  2.1.  Percent-Encoding

   A percent-encoding mechanism is used to represent a data octet in a
   component when that octet's corresponding character is outside the
   allowed set or is being used as a delimiter of, or within, the
   component.


Right. This describes how to convert an octet into a sequence of characters,
since the only thing that can appear in a URI is sequences of characters.


The syntax of URIs is a mechanism for describing data octets,
not Unicode code points. It is at variance to describe URIs in
terms of Unicode code points.



Not sure what you mean by this. As the RFC says, a URI is defined entirely
by the identity of the characters that are used. There is definitely no
single, correct byte sequence for representing a URI. If I give you a
sequence of bytes and tell you it is a URI, the only way to decode it is to
first know what encoding the byte sequence represents.. ascii, utf-16, etc.
Once you have decoded the byte sequence into a sequence of characters, only
then can you parse the URI.


Mr. Shaw,

Thanks for taking the time to explain all this. It's really
helped me to understand a lot of parts of the URI spec a lot
better. I have deprecated my module in the latest release

   http://hackage.haskell.org/package/URLb-0.0.1

because a URL parser working on bytes instead of characters
stands out to me now as a confused idea.

--
Jason Dusek
pgp  ///  solidsnack  1FD4C6C1 FED18A2B

___
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] ghc: could not execute: opt

2012-03-03 Thread Graham Berks
Hi, trying out haskell.

Have osx 10.7 and ghc 7.0.4 via homebrew

When attempting to compile a program via cabal i get

ghc: could not execute: opt

I assume I have something missing / not configured with my env.

Can someone point me in the direction ?

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


[Haskell-cafe] PhD studentship in Nottingham (closing date 10th February)

2012-02-02 Thread Graham Hutton
Dear all,

I am currently advertising a PhD Studentship in Functional
Programming at the University of Nottingham in the UK:

   http://www.nottingham.ac.uk/jobs/currentvacancies/ref/SCI1088

The closing date is *** Friday 10th February 2012 ***.   If
you would like to apply, please follow the instructions in
the advert, rather than clicking on "apply online".

Many thanks,

Graham Hutton

--  
Prof Graham Hutton
Functional Programming Lab
School of Computer Science
University of Nottingham, UK
http://www.cs.nott.ac.uk/~gmh


This message and any attachment are intended solely for the addressee and may 
contain confidential information. If you have received this message in error, 
please send it back to me, and immediately delete it.   Please do not use, copy 
or disclose the information contained in this message or in any attachment.  
Any views or opinions expressed by the author of this email do not necessarily 
reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] PhD studentship in Nottingham

2012-01-09 Thread Graham Hutton
Dear all,

I am currently advertising a PhD Studentship in Functional
Programming at the University of Nottingham in the UK:

  http://www.nottingham.ac.uk/jobs/currentvacancies/ref/SCI1088

If you are interested in applying yourself, please drop me
a note by email.  If you know of any good candidates who
may be interested in applying, or there is a local mailing
list for advertising such things, I'd be much obliged if
you could pass on the above link.

Many thanks,

Graham Hutton

--  
Prof Graham Hutton
Functional Programming Lab
School of Computer Science
University of Nottingham, UK
http://www.cs.nott.ac.uk/~gmh


This message and any attachment are intended solely for the addressee and may 
contain confidential information. If you have received this message in error, 
please send it back to me, and immediately delete it.   Please do not use, copy 
or disclose the information contained in this message or in any attachment.  
Any views or opinions expressed by the author of this email do not necessarily 
reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] PhD studentship in Nottingham

2012-01-09 Thread Graham Hutton
Dear all,

I am currently advertising a PhD Studentship in Functional
Programming at the University of Nottingham in the UK:

   http://www.nottingham.ac.uk/jobs/currentvacancies/ref/SCI1088

If you are interested in applying yourself, please drop me
a note by email.  If you know of any good candidates who
may be interested in applying, or there is a local mailing
list for advertising such things, I'd be much obliged if
you could pass on the above link.

Many thanks,

Graham Hutton

--  
Prof Graham Hutton
Functional Programming Lab
School of Computer Science
University of Nottingham, UK
http://www.cs.nott.ac.uk/~gmh


This message and any attachment are intended solely for the addressee and may 
contain confidential information. If you have received this message in error, 
please send it back to me, and immediately delete it.   Please do not use, copy 
or disclose the information contained in this message or in any attachment.  
Any views or opinions expressed by the author of this email do not necessarily 
reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Two new lectureships (assistant professorships) in Nottingham

2011-10-25 Thread Graham Hutton
Dear all,

We are currently seeking two new Lecturers (Assistant Professors)
in Computer Science at the University of Nottingham, UK.  These
posts are available from 1st January 2012 on a fixed-term basis
for three years.  Applications from within the area of functional
programming would be most welcome.  For further details, see:

   http://www.nottingham.ac.uk/jobs/currentvacancies/ref/CE05936S

The deadline for applications is 9th November 2011.

Best wishes,

Graham Hutton

--  
Prof Graham Hutton
Functional Programming Lab
School of Computer Science
University of Nottingham, UK
http://www.cs.nott.ac.uk/~gmh


This message and any attachment are intended solely for the addressee and may 
contain confidential information. If you have received this message in error, 
please send it back to me, and immediately delete it.   Please do not use, copy 
or disclose the information contained in this message or in any attachment.  
Any views or opinions expressed by the author of this email do not necessarily 
reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] PhD studentship in Functional Programming

2011-06-22 Thread Graham Hutton
Dear all,

Just a quick reminder that the deadline for receiving applications
for this PhD studentship position is this Friday (24th June.)

Best wishes,

Graham

> +--+
> 
>  PhD Studentship in Functional Programming
> 
> School of Computer Science
>University of Nottingham, UK
> 
> Applications are invited for a fully-funded PhD studentship in
> the Functional Programming Lab in the School of Computer Science
> at the University of Nottingham, starting on 1st October 2011,
> under the supervision of Prof Graham Hutton.
> 
> The suggested topic for the studentship is to develop a practical
> implementation of the worker/wrapper transformation, a simple but
> powerful unifying paradigm for program optimisation, but other
> ideas for possible topics are welcome too.  The studentship is
> for three and a half years, and includes a maintenance grant
> of 13,590 UK pounds per year, and tuition fees.
> 
> Applicants for the position will require a first-class Honours
> degree (or equivalent) in Computer Science and/or Mathematics,
> some experience in functional programming, and an aptitude for
> mathematical subjects.Additional desirable attributes include
> a Masters degree, and/or some experience in programming language
> semantics, implementation and optimisation.  Due to the nature
> of the funding, the position is only open to UK citizens, or EU
> citizens who have resided in the UK for the last three years.
> 
> The successful applicant will work under the supervision of Prof
> Graham Hutton in the FP Lab in Nottingham, a leading centre for
> research on functional programming.  The group currently comprises
> 5 academic staff, 1 research fellow, and 10 PhD students.
> 
> In order to apply, please submit the following to Prof Graham
> Hutton (graham.hut...@nottingham.ac.uk) by 24th June 2011: an
> up-to-date copy of your CV (including the results of all your
> University examinations to date) along with a brief covering
> letter that describes your experience in functional programming,
> your reasons for wishing to pursue a PhD in this area, and any
> ideas you have regarding possible research directions.
> 
> Closing date for applications: 24th June 2011.
> 
> +--+
> 
> --  
> Graham Hutton
> Functional Programming Lab
> School of Computer Science
> University of Nottingham, UK
> http://www.cs.nott.ac.uk/~gmh

This message and any attachment are intended solely for the addressee and may 
contain confidential information. If you have received this message in error, 
please send it back to me, and immediately delete it.   Please do not use, copy 
or disclose the information contained in this message or in any attachment.  
Any views or opinions expressed by the author of this email do not necessarily 
reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] PhD studentship in Nottingham

2011-05-31 Thread Graham Hutton
Dear all,

I are currently advertising a PhD studentship in functional
programming -- the advert is copied below, and attached.  If
you know of any good candidates who many be interested in this,
or there is a local mailing list for advertising such things,
I would be much obliged if you could pass on the advert.

Best wishes,

Graham

+--+

 PhD Studentship in Functional Programming

School of Computer Science
   University of Nottingham, UK

Applications are invited for a fully-funded PhD studentship in
the Functional Programming Lab in the School of Computer Science
at the University of Nottingham, starting on 1st October 2011,
under the supervision of Prof Graham Hutton.

The suggested topic for the studentship is to develop a practical
implementation of the worker/wrapper transformation, a simple but
powerful unifying paradigm for program optimisation, but other
ideas for possible topics are welcome too.  The studentship is
for three and a half years, and includes a maintenance grant
of 13,590 UK pounds per year, and tuition fees.

Applicants for the position will require a first-class Honours
degree (or equivalent) in Computer Science and/or Mathematics,
some experience in functional programming, and an aptitude for
mathematical subjects.Additional desirable attributes include
a Masters degree, and/or some experience in programming language
semantics, implementation and optimisation.  Due to the nature
of the funding, the position is only open to UK citizens, or EU
citizens who have resided in the UK for the last three years.

The successful applicant will work under the supervision of Prof
Graham Hutton in the FP Lab in Nottingham, a leading centre for
research on functional programming.  The group currently comprises
5 academic staff, 1 research fellow, and 10 PhD students.

In order to apply, please submit the following to Prof Graham
Hutton (graham.hut...@nottingham.ac.uk) by 24th June 2011: an
up-to-date copy of your CV (including the results of all your
University examinations to date) along with a brief covering
letter that describes your experience in functional programming,
your reasons for wishing to pursue a PhD in this area, and any
ideas you have regarding possible research directions.

Closing date for applications: 24th June 2011.

+--+


--  
Graham Hutton
Functional Programming Lab
School of Computer Science
University of Nottingham, UK
http://www.cs.nott.ac.uk/~gmh


This message and any attachment are intended solely for the addressee and may 
contain confidential information. If you have received this message in error, 
please send it back to me, and immediately delete it.   Please do not use, copy 
or disclose the information contained in this message or in any attachment.  
Any views or opinions expressed by the author of this email do not necessarily 
reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.

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


Re: [Haskell-cafe] ANNOUNCE: swish 0.3.0.0

2011-04-07 Thread Graham Klyne

Excellent, thanks for running with this!

I have an RDF/XML parser (based on a fork of HaXML) that I'd like to integrate 
at some time, and it's remotely possible that I might have a little time to work 
on this in the coming months..


#g
--

Doug Burke wrote:

I am pleased to announce an update of the swish package to version
0.3.0.0 [1]. It is mainly meant to be a maintenance upgrade over the
existing version on Hackage [2] by Vasili I. Galchin, but does 
add additional functionality in that it now supports the NTriples
format and the N3 parser and formatter has been updated to better 
match the current specification.


For those not aware of what Swish actually is, it is an experiment
by Graham Klyne in writing a "Semantic Web" framework in Haskell [3].

I note that the wonderful machinery behind Hackage has already
processed the documentation so you can read more about it at [1]
as well as the very-sparsely-documented Wiki at [4].

[1] http://hackage.haskell.org/package/swish-0.3.0.0
[2] http://hackage.haskell.org/package/swish-0.2.1
[3] http://www.ninebynine.org/Software/swish-0.2.1.html
[4] https://bitbucket.org/doug_burke/swish/wiki/Home

Thanks for reading this far,
Doug



  




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


Re: [Haskell-cafe] RE: [Haskell] Proposal: Form a haskell.org committee

2010-09-06 Thread Graham Klyne

Simon Peyton-Jones wrote:

| As membership of "the Haskell community" is not well-defined, and voting
| would potentially be open to abuse if anyone were able to vote, we
| propose that the committee should choose their replacements from open
| nominations.

I agree with the problem, and I think your proposed solution may do for now, 
but it's obviously not a robust solution.  I trust you five, but in three years 
time you may all have stood down!

A possible solution would be to have an "electoral college" of people entitled 
to vote. It should be easy to become a member of the college: any track record of 
contributions to the Haskell community, including constructive contributions to Haskell 
Cafe, would be enough.  Then the college can elect the committee.

It's debatable whether this is worth the bother at this point.  Maybe it would 
be enough to document on the committee page that we don't regard the nomination 
process as robust, and if any concern arises we will consider something more 
substantial.


FWIW, the IETF faces the same situation, and addresses it through a Nominating
Committee (NomCom) mechanism, which for the most part has worked well for many
years (http://tools.ietf.org/html/rfc3777).

#g




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


Re: [Haskell-cafe] Code that writes code

2010-08-20 Thread Graham Klyne

Maybe not helpful to you at this stage, but...

An alternative to generating source code is to factor out the common
"boilerplate" elements into separate functions, suitably parameterized, and to
use higher order functions to stitch these together.

An example of this kind of approach, which is handled by code generation in some
other languages (e.g. lex, yacc, etc), is the Parsec combinator-based parsing
library (http://www.haskell.org/haskellwiki/Parsec) - instead of generating
code, the syntax "rules" are written directly using Haskell functions and
assemble the common underlying repeated logic dynamically, behind the scenes.

I adopted a development of this approach for a programme with a built-in
scripting language that I implemented some time ago:  the scripting language was
parsed using Parsec, not into a syntax tree, but directly into a dynamically
assembled function that could be applied to some data to perform the scripted
function (http://www.ninebynine.org/RDFNotes/Swish/Intro.html).

What I'm trying to point out here that, rather than go through the step of
generating source code and feeding it back into a Haskell compiler, it may be
possible to use higher order functions to directly assemble the required logic
within a single program.  For me, this is one of the great power-features of
functional programming, which I now tend to use where possible in other
languages that support functions as first class values.

#g
--

Andrew Coppin wrote:
I'm working on a small Haskell package. One module in particular 
contains so much boilerplate that rather than write the code myself, I 
wrote a small Haskell program that autogenerates it for me.


What's the best way to package this for Cabal? Just stick the generated 
file in there? Or is there some (easy) way to tell Cabal how to recreate 
this file itself?





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


Re: [Haskell-cafe] Shootout update

2010-03-30 Thread Graham Klyne

Simon Marlow wrote:

We really need to tune the flags for these benchmarks properly.


Do I sense the hidden hand of Goodharts law? :)

-- http://en.wikipedia.org/wiki/Goodhart's_law

#g





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


[Haskell-cafe] jQuery is a monad

2010-02-28 Thread Graham Klyne

Nice blog post:

http://importantshock.wordpress.com/2009/01/18/jquery-is-a-monad/

#g

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


Re: [Haskell-cafe] install-dirs on Mac OS X

2009-12-25 Thread Graham Klyne

Mark Lentczner wrote:

[*] The Apple guidelines for the /Library and ~/Library files are 
here:http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPFileSystem/Articles/LibraryDirectory.html#//apple_ref/doc/uid/20002282-BAJHCHJI


Thanks for the link.  I followed through to a couple of other links that broadly 
support your position:


[1] 
http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPFileSystem/Articles/LibraryDirectory.html


[2] 
http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPFileSystem/Articles/Domains.html


But, on reading [1], I also see "Although an application can use this directory 
[/Library] to store internal data or temporary files, it is not intended for 
storage of the application bundle itself or for user data files. Application 
bundles belong in an appropriate /Applications directory, while user data 
belongs in the user’s home directory."


This makes me question whether /Application might be the appropriate place?

I'm pleased to see this issue is getting some serious consideration:  I haven't 
actually used Haskell for a while, and since I last did I've switched to using a 
Mac for much ogf my development, so when I return to the Haskell fold it will be 
nice to have the system play nicely with the host environment.


#g

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


Re: [Haskell-cafe] ANN: Semantic Web

2009-07-22 Thread Graham Klyne
I'd like to thank Vasili for resurrecting this project, which I thought had 
all-but-died for lack of nurture (the day job, etc.).  It's really nice to know 
that, when (I hope!) the day comes that I want to pick up my Haskell work again, 
it won't have completely been left behind by the many exciting developments in 
the Haskell platform.


When I have just a little time, I'd like to help move the code into a suitable 
open repository.


Many thanks!

#g
--


Vasili I. Galchin wrote:
I. Swish-0.2.1(Semantic Web Inference uSing Haskell) is a semantic web 
toolkit designed and implemented by Graham Klyne - g...@ninebynine.org 
<mailto:g...@ninebynine.org>:


   1) http://www.ninebynine.org/RDFNotes/Swish/Intro.html

   2) http://www.ninebynine.org/Software/swish-0.2.1.html
  
   I am personally very excited about Graham's work and the role of 
Haskell in his toolkit!



II.) My role

 I "cabalized" Swish-0.2.1, brought namespace issues up to 6.8.2 
standards and fixed many compiler warnings. There are still numerous 
warnings mostly related to lack of function type signatures.  
Swish-0.2.1 however does build and the tests that Graham wrote do run 
ok. Currently Swish-0.2.1 is currently hosted on Hackage but will most 
likely move to another site in the future. The downloader will find that 
there are TBDs in the swish.cabal file and other places. Please be patient.


Kind regards, Vasili


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


Re: [Haskell-cafe] List spine traversal

2009-06-29 Thread Graham Fawcett
On Sun, Jun 28, 2009 at 10:05 PM, Tony Morris wrote:
> Is there a canonical function for traversing the spine of a list?
>
> I could use e.g. (seq . length) but this feels dirty, so I have foldl'
> (const . const $ ()) () which still doesn't feel right. What's the
> typical means of doing this?

You can also use the combinators in Control.Parallel.Strategies.
'seqList r0' will force the spine, but you also can swap in
different strategies to force evaluation on the elements as well.

Prelude Control.Parallel.Strategies> let b = [ [1..n] | n <- [1..5] ]
Prelude Control.Parallel.Strategies> :print b
b = (_t1::[[Integer]])

Prelude Control.Parallel.Strategies> seqList r0 b
()
Prelude Control.Parallel.Strategies> :print b
b = [(_t2::[Integer]),(_t3::[Integer]),(_t4::[Integer]),
 (_t5::[Integer]),(_t6::[Integer])]

Prelude Control.Parallel.Strategies> seqList rwhnf b
()
Prelude Control.Parallel.Strategies> :print b
b = [(1 : (_t7::[Integer])),(1 : (_t8::[Integer])),
 (1 : (_t9::[Integer])),(1 : (_t10::[Integer])),
 (1 : (_t11::[Integer]))]

Prelude Control.Parallel.Strategies> seqList rnf b
()
Prelude Control.Parallel.Strategies> :print b
b = [[1],[1,2],[1,2,3],[1,2,3,4],[1,2,3,4,5]]

I'm a newbie, but I believe that a typical usage would be
something like:

let myList  = someExpression `using` seqList r0

where 'using' ensures traversal of the expression's spine.

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


[Haskell-cafe] A question about laziness and foreign resources (and libxml2)

2009-04-29 Thread Graham Fawcett
Hi folks,

I'm having trouble reasoning about laziness and FFI resources. I've
written a little C wrapper function to augment Text.XML.LibXML; given
a Ptr Node, it will return the node's tag-name:

  foreign import ccall unsafe _getName :: Ptr Node -> IO CString

Given LibXML's 'withNode' function, I can write:

  withNode :: Node -> (Ptr Node -> IO a) -> IO a
  getName1 :: Node -> IO String
  getName1 n = withNode n $ \n' -> _getName n' >>= peekCString

But I'm tempted to write this instead:

  getName2 n = withNode n return >>= _getName >>= peekCString

In a strict language, I'd observe that the (Ptr Node) in getName2 was
escaping the lexical scope of the withNode call, and so getName2 would
be unsafe (since it might get GC'd upon leaving that scope). But in
Haskell, I can't reason out whether that's the case.

Is 'withNode n return' a risky proposition? Is lexical scope indeed
the right test here? If not, how might you reason about the safety of
this code?

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


Re: [Haskell-cafe] csv one-liner

2008-09-30 Thread Graham Fawcett
2008/9/30 wman <[EMAIL PROTECTED]>:
> Thanks a lot, I've had a hunch it was possible to get rid of those those
> liftM's. I turned it into:
>
> (writeFile "output.csv") . printCSV . (map updateLine) . (either (error
> "Chyba pri cteni CSV.") id) =<< parseCSVFromFile "input.csv"
>
> and am sincerely hoping he will try to decypher it's meaning ;-)))

It looks like you've added some good error-czeching code here. :-;

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


Re: [Haskell-cafe] csv one-liner

2008-09-30 Thread Graham Fawcett
2008/9/30 wman <[EMAIL PROTECTED]>:
> I got asked how to do one particular thing in excel, which led to discssion
> with "our local MSOffice expert".
> During the discussion I stated that's it too much of a PITA and that I'd
> rather write a script.
> Long story short, I promised him a one-liner to "show the power and beauty
> of Haskell".
>
> I got the csv package from hackage, modified the parseCSVFromFile so it's
> returns IO CSV rather than IO (Either ParseError CSV), and finished with
> following code
>
> (writeFile "output.csv") =<< (liftM printCSV $ liftM (map updateLine) $
> parseCSVFromFile "input.csv")
>
> Is there room for improvement ?
> Could it still be made into one-liner without modifying the csv module (and
> without resorting to
> case parseCSVFromFile "input.csv" of { Left _ -> []; Right x -> x}
> kind of tricks) ?

How about:

parseCSVFromFile "in.csv" >>= return . either (const "error!")
printCSV >>= writeFile "out.csv"

using Data.Either (either) ?

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


Re: [Haskell-cafe] pure Haskell database

2008-09-30 Thread Graham Fawcett
On Tue, Sep 30, 2008 at 9:18 AM, Manlio Perillo
<[EMAIL PROTECTED]> wrote:
> Graham Fawcett ha scritto:
>>
>> On Thu, Sep 25, 2008 at 5:09 PM, Manlio Perillo
>> <[EMAIL PROTECTED]> wrote:
>>>
>>> Graham Fawcett ha scritto:
>>>>
>>>> If you're on Intel/Itanium, I believe there's a CMPXCHG instruction
>>>> that will do atomic compare-and-set on a memory address, and I'm not
>>>> sure you could get much faster than that. :-)
>>>
>>> I have an early draft of this type of database (written in D).
>>> Operations on integers use CMPXCHG, and for other operations a simple
>>> spin
>>> lock (implemented following the implementation in Nginx) is used.
>>
>> And I thought I was being original. :-)
>>
>>> The problem is that it is a simple shared array!
>>
>> I'm guessing you've also ruled out sparse arrays? If not, what
>> complexity is acceptable on your lookup function?
>>
>
> Never though about sparse array, what is the advantage?
> For the complexity, the same of a good hash map.

Almost certainly worse complexity than a hash map; but the overhead
could be much smaller. If (for example) you only needed a small number
of key/value pairs (say, hundreds of thousands), you could implement
your "database" trivially, e.g. a NULL-terminated array of key/value
structs in shared memory. (Though having separate arrays for keys and
values might help cache locality and boost performance). Lookup might
be O(n) but with a small-ish N and with such a low overhead, it could
perform very, very well.

Of course, you know what your requirements are, and I don't. :-) But I
think if one needed a "shared map, size N, of integers to incrementing
registers" where N wasn't enormous, then this might be attractive.

Cheers,
Graham

> By the way, for the moment I think I will use Data.Map, serializing it to a
> file, since only one process will update it, and the other processes needs
> not to read an up-to-date snapshot.
> The only thing that needs to be taken care of, is to write the file
> atomically, but this is easy.
>
>
>
> Thanks   Manlio Perillo
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] pure Haskell database

2008-09-30 Thread Graham Fawcett
On Tue, Sep 30, 2008 at 9:18 AM, Manlio Perillo
<[EMAIL PROTECTED]> wrote:
> Graham Fawcett ha scritto:
>>
>> On Thu, Sep 25, 2008 at 5:09 PM, Manlio Perillo
>> <[EMAIL PROTECTED]> wrote:
>>>
>>> Graham Fawcett ha scritto:
>>>>
>>>> If you're on Intel/Itanium, I believe there's a CMPXCHG instruction
>>>> that will do atomic compare-and-set on a memory address, and I'm not
>>>> sure you could get much faster than that. :-)
>>>
>>> I have an early draft of this type of database (written in D).
>>> Operations on integers use CMPXCHG, and for other operations a simple
>>> spin
>>> lock (implemented following the implementation in Nginx) is used.
>>
>> And I thought I was being original. :-)
>>
>>> The problem is that it is a simple shared array!
>>
>> I'm guessing you've also ruled out sparse arrays? If not, what
>> complexity is acceptable on your lookup function?
>>
>
> Never though about sparse array, what is the advantage?
> For the complexity, the same of a good hash map.

Almost certainly worse complexity than a hash map; but the overhead
could be much smaller. If (for example) you only needed a small number
of key/value pairs (say, hundreds of thousands), you could implement
your "database" trivially, e.g. a NULL-terminated array of key/value
structs in shared memory. (Though having separate arrays for keys and
values might help cache locality and boost performance). Lookup might
be O(n) but with a small-ish N and with such a low overhead, it could
perform very, very well.

Of course, you know what your requirements are, and I don't. :-) But I
think if one needed a "shared map, size N, of integers to incrementing
registers" where N wasn't enormous, then this might be attractive.

Cheers,
Graham

> By the way, for the moment I think I will use Data.Map, serializing it to a
> file, since only one process will update it, and the other processes needs
> not to read an up-to-date snapshot.
> The only thing that needs to be taken care of, is to write the file
> atomically, but this is easy.
>
>
>
> Thanks   Manlio Perillo
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] pure Haskell database

2008-09-25 Thread Graham Fawcett
On Thu, Sep 25, 2008 at 5:09 PM, Manlio Perillo
<[EMAIL PROTECTED]> wrote:
> Graham Fawcett ha scritto:
>> If you're on Intel/Itanium, I believe there's a CMPXCHG instruction
>> that will do atomic compare-and-set on a memory address, and I'm not
>> sure you could get much faster than that. :-)
>
> I have an early draft of this type of database (written in D).
> Operations on integers use CMPXCHG, and for other operations a simple spin
> lock (implemented following the implementation in Nginx) is used.

And I thought I was being original. :-)

> The problem is that it is a simple shared array!

I'm guessing you've also ruled out sparse arrays? If not, what
complexity is acceptable on your lookup function?

Graham

(sorry if this heading off-topic for the list.)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] pure Haskell database

2008-09-25 Thread Graham Fawcett
On Wed, Sep 24, 2008 at 5:17 PM, Manlio Perillo
<[EMAIL PROTECTED]> wrote:
> Hi.
>
> I need a simple, concurrent safe, database, written in Haskell.
> A database with the interface of Data.Map would be great, since what I need
> to to is atomically increment some integer values, and I would like to avoid
> to use SQLite.

If that's the entire requirement, and you're looking for something
really fast, perhaps you could use a shared-memory region between the
processes (your keys would map to addresses in shared memory), and use
a compare-and-set algorithm to handle the atomic increments.

If you're on Intel/Itanium, I believe there's a CMPXCHG instruction
that will do atomic compare-and-set on a memory address, and I'm not
sure you could get much faster than that. :-)

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


Re: Re[4]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Graham Fawcett
On Mon, Sep 22, 2008 at 1:12 PM, Bulat Ziganshin
<[EMAIL PROTECTED]> wrote:
> Hello Simon,
>
> Monday, September 22, 2008, 9:03:52 PM, you wrote:
>
>> With bytestrings, unboxed arrays, light-weight threads and other
>> tricks, we can usually replace all those ugly low-level programs with
>> nice high-level haskell ones
>
> i don't think that these 3 libs allows to write high-level
> high-performance code in *most* cases. just for example, try to write wc
> without using "words".

To a newbie, that's a cryptic statement. Are you saying that these
libs aren't needed to make a high-performance "wc", and that the
Prelude functions are sufficient? (I note too that there is
Data.ByteString.Char8.words, but I assume you are talking about the
Prelude function.)

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


Re: [Haskell-cafe] Short circuiting and the Maybe monad

2008-05-15 Thread Graham Fawcett
On Wed, May 14, 2008 at 1:38 AM, Janis Voigtlaender
<[EMAIL PROTECTED]> wrote:
> Graham Fawcett wrote:
>>
>> Yes, but that's still a 'quick' short-circuiting. In your example, if
>> 'n' is Nothing, then the 'f >>= g >>= h' thunks will not be forced
>> (thanks to lazy evaluation), regardless of associativity. Tracing
>> verifies this:
>
> No, it doesn't. What your tracing verifies is that the f, g, and h will
> not be evaluated. It doesn't verify that the 'f >>= g >>= h' part of the
> expression causes no evaluation overhead. Because that is not true.

I didn't mean to suggest that. I confess to using 'the f >>= g >>= h
thunks' as a shorthand for the thunks for f, g and h, and not for the
binding expressions. I did write later in my message that there would
be evaluation overhead, but that I suspected it would be negligible
(an imprecise and hand-waving statement, to be sure).

> Consider the following:
>
>> import Debug.Trace
>
>> data Maybe' a = Nothing' | Just' a  deriving Show
>
>> instance Monad Maybe' where
>>return = Just'
>>Nothing' >>= _ = trace "match" Nothing'
>>Just' a  >>= k = k a

Neat, I've never seen a bind operator used in a pattern. Thanks for
this example.

>> talk s = Just' . (trace s)
>> f = talk "--f"
>> g = talk "--g"
>> h = talk "--h"
>
>> foo n = n >>= f >>= g >>= h
>
> Now:
>
> *Main> foo Nothing'
> match
> match
> match
> Nothing'
>
> So you get three pattern-matches on Nothing', where with the associative
> variant
>
>> foo' n = n >>= \a -> f a >>= \b -> g b >>= h
>
> you get only one:
>
> *Main> foo' Nothing'
> match
> Nothing'
>
> For a way to obtain such improvements automatically, and without
> touching the code, you may want to look into
>
> http://wwwtcs.inf.tu-dresden.de/~voigt/mpc08.pdf

Much appreciated, Janis, I look forward to reading the paper.

Graham

>
> Ciao, Janis.
>
> --
> Dr. Janis Voigtlaender
> http://wwwtcs.inf.tu-dresden.de/~voigt/
> mailto:[EMAIL PROTECTED]
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Short circuiting and the Maybe monad

2008-05-13 Thread Graham Fawcett
On Mon, May 12, 2008 at 6:09 PM, John Hamilton <[EMAIL PROTECTED]> wrote:
> I'm trying to understand how short circuiting works with the Maybe monad.
>  Take the expression n >>= f >>= g >>= h, which can be written as
>  (((n >>= f) >>= g) >>= h) because >>= is left associative.  If n is
>  Nothing, this implies that (n >>= f) is Nothing, and so on, each nested
>  sub-expression easily evaluating to Nothing, but without there being a
>  quick way to short circuit at the beginning.

Yes, but that's still a 'quick' short-circuiting. In your example, if
'n' is Nothing, then the 'f >>= g >>= h' thunks will not be forced
(thanks to lazy evaluation), regardless of associativity. Tracing
verifies this:

  > import Debug.Trace

  > talk s = Just . (trace s)
  > f = talk "--f"
  > g = talk "--g"
  > h = talk "--h"

  > foo n = n >>= f >>= g >>= h

  *Main> foo (Just 3)
  Just --h
  --g
  --f
  3
  *Main> foo Nothing
  Nothing

I suspect the cost of creating and discarding those unused thunks is
negligible, so in effect the associativity of the bind operator is
irrelevant here.

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


Re: Cryptographic hash uniquness (was [Haskell-cafe] Simple network client)

2008-05-11 Thread Graham Klyne
This is a very late response ... but I did some calculations as part of some 
work I did a while ago:

  http://www.ietf.org/rfc/rfc2938.txt
(See appendix A "The birthday paradox")

#g
--

Peter Verswyvelen wrote:

winds up having a write cache, which is mutable in practice.  The
interesting thing is that the block's location is the cryptographic
hash of its contents, which leads to all sorts of neat properties (as
well as requiring immutability).


That's interesting.  When I developed a version control system for a customer, 
I also used a cryptographic hash as the database key of file+content in 
question, but I was afraid I might have clashes (two files with different 
content generating the same hash)... My intuition told me that the odds of two 
cryptographic hashes (on meaningful content) colliding was much less than the 
earth being destroyed by an asteroid... But this is just intuition... What does 
computer science tell us about this?

Thank you,
Peter


--
Graham Klyne
Contact info: http://www.ninebynine.org/#Contact

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


Re: [Haskell-cafe] Re: Writing an 'expect'-like program with runInteractiveCommand

2008-05-02 Thread Graham Fawcett
On Fri, May 2, 2008 at 12:16 AM, Donn Cave <[EMAIL PROTECTED]> wrote:
> Graham Fawcett wrote:
>
>
> > I would like to communicate with an external, line-oriented process,
> > which takes a sequence of one-line commands, each returning an
> > arbitrary number of lines, and waits for another command after each
> > response.  So, something like:
> > sendCmd :: (Handle, Handle) -> String -> IO [String]
>  You may need to make some compromises to get this within the realm
>  of the possible, if I understand your objective.
>  - There is no way (at least on UNIX) to know when a read has been posted
>on the other end of your pipe/socket/pty/whatever...

Yes, and I should have realized this. After my post, I tried writing
the same program in another language, and ran into the same problems.

Thanks very much for the response. I'm going to play with your
example, and see if I can make it work in this case (and if not, I
will still learn from studying it!).

In case it's of interest, I see that E.W. Karlsen wrote a series of
articles (ten years ago!) on using Haskell to manage asynchronous
processes, and included an "expect-like" tool in his UniForM
Workbench:

http://www.informatik.uni-bremen.de/~ewk/WB.html

By the way, what I'm trying to do is to interact with a Berkeley XML
database; there's no existing Haskell wrapper for its API, and for
this particular task the cost of writing one is too high. I was going
to interact with the 'dbxml' command-line utility as a poor-man's FFI.
Given the issues you've raised, instead I might use a language that
has an existing DBXML interface, and call that from Haskell (e.g.
Python via MissingPy).

Thanks again,

Graham


>  So you can't tell in this
>way when the external process has sent the last of the arbitrary number
> of
>lines and is now waiting for another command.  If you have another way to
>know, or it doesn't really matter, then fine.
>
>  - The vast majority of `line-oriented' software are actually going to block
> buffer
>their output when writing to a pipe, because that's what C I/O does.  If
> you're
>lucky, the program you're dealing with here will flush its output before
> it reads,
>but if it doesn't, you're hosed - there isn't any way to talk to this
> program
>   `interactively' on a pipe.  In this case, you need a pseudotty device, a
> sort of
>pipe that supports tty device ioctls.
>
>  - Buffering on your side of the I/O is of course also worse than useless.
>
>  I see the GHC 6.8 library supports pseudottys, so for general amusement
>  I submit below a small demonstration program.  Unfortunately it doesn't
>  entirely work.  The pseudotty works, but I'm unable to turn off ECHO on the
>  slave.  So each master line yields two slave lines, and my program expects
>  only one and gets behind on that account.  So the command has to include
>  its own "stty -echo".  The commented lines attempt to turn of ECHO, but on
>  MacOS X that causes the program to fail mysteriously.
>
> Donn Cave, [EMAIL PROTECTED]
>  --
>  import System.Posix.Terminal (TerminalMode(..), TerminalState(..),
> withoutMode, getTerminalAttributes, setTerminalAttributes,
> openPseudoTerminal, getSlaveTerminalName)
>  import System (getArgs)
>  import System.Posix.Types (Fd, ProcessID)
>  import System.Posix.Process (forkProcess, executeFile)
>  import System.Posix.IO (stdInput, stdOutput, closeFd, dupTo, fdWrite,
> fdRead)
>
>  pchild :: Fd -> IO () -> IO ()
>  pchild slaveFd exec = do
> dupTo slaveFd stdInput
> dupTo slaveFd stdOutput
> closeFd slaveFd
> exec
>
>  ptyOpen :: IO () -> IO (ProcessID, Fd)
>  ptyOpen exec = do
> (master, slave) <- openPseudoTerminal
> -- tc <- getTerminalAttributes slave
> -- let tc = withoutMode tc EchoLF
> -- setTerminalAttributes slave tc WhenDrained
> pid <- forkProcess (pchild slave exec)
> closeFd slave
> return (pid, master)
>
>  ioact p0 p1 m0 m1 = do
> (d, n) <- fdRead m0 512
> fdWrite p1 d
> (e, n) <- fdRead p0 512
> fdWrite m1 e
> ioact p0 p1 m0 m1
>
>  main = do
> (cmd:args) <- getArgs
> (pid, fd) <- ptyOpen (executeFile cmd True args Nothing)
> ioact fd fd stdInput stdOutput
>
>  ___
>  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] Writing an 'expect'-like program with runInteractiveCommand

2008-05-01 Thread Graham Fawcett
Hi folks,

I would like to communicate with an external, line-oriented process,
which takes a sequence of one-line commands, each returning an
arbitrary number of lines, and waits for another command after each
response.  So, something like:

sendCmd :: (Handle, Handle) -> String -> IO [String]
...

main = do
  handles <- connectToExternalProcess
  sendCmd handles "do something"
  resp <- sendCmd "get results" -- needs strict I/O, before "quit"?
  sendCmd "quit"
  mapM_ putStrLn resp

I've tried using runInteractiveCommand, and several combinations of
hFlush, hWaitForInput, etc., but I can't find a combination that
actually works.

I know this is a sketchy description, but can anyone offer some sample
code, or point me toward a program that has similar behaviour?

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


[Haskell-cafe] Re: searching via zipper over a tree

2008-04-24 Thread Graham Fawcett
On Thu, Apr 24, 2008 at 12:44 AM, Graham Fawcett
<[EMAIL PROTECTED]> wrote:
>  I'm studying zippers (and by extension, the State monad), and have
>  written a function for finding the first node-location in a 'zippered'
>  tree that satisfies a predicate:
>
>  http://paste.lisp.org/display/59636
>
>  (The code uses Krasimir Angelov's Data.Tree.Zipper.) My code works,
>  but I suspect that I'm working too hard. I would appreciate any
>  comments!

I did figure out an easier way: lazily walk every location in the
tree, and take the first matching location.

http://paste.lisp.org/display/59636#1
Much cleaner (though comments are still welcome.)

Haskell seems to have a high 'commute factor' -- many solutions appear
not at the keyboard, but while driving home...

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


[Haskell-cafe] searching via zipper over a tree

2008-04-23 Thread Graham Fawcett
Hi folks,

I'm studying zippers (and by extension, the State monad), and have
written a function for finding the first node-location in a 'zippered'
tree that satisfies a predicate:

http://paste.lisp.org/display/59636

(The code uses Krasimir Angelov's Data.Tree.Zipper.) My code works,
but I suspect that I'm working too hard. I would appreciate any
comments!

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


Re: [Haskell-cafe] zipper for rose trees? (Data.Tree)

2008-04-23 Thread Graham Fawcett
On Wed, Apr 23, 2008 at 4:40 PM, Krasimir Angelov <[EMAIL PROTECTED]>
wrote:

> Hi Graham,
>
> There is one implementation here:
>
> http://code.haskell.org/yi/Data/Tree/
>
> I wrote it for Yi but it is quite general. It is a pity that we don't
> have it in the standard libraries. It is not completely tested but it
> seems to work for me.



Thank very much, Krasimir! I agree, it would be a good addition to the
standard library.

I've added a link to your implementation from the Zipper page in the Haskell
wiki.

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


[Haskell-cafe] zipper for rose trees? (Data.Tree)

2008-04-23 Thread Graham Fawcett
Hi folks,

Is there a common zipper implementation for the "Tree a" datatype, defined
in Data.Tree?  The wiki gives examples for binary trees and B-trees, but not
for these.

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


Re: [Haskell-cafe] Re: Shim: finding modules

2008-04-17 Thread Graham Fawcett
2008/4/17 Gour <[EMAIL PROTECTED]>:
> >>>>> "Graham" == Graham Fawcett <[EMAIL PROTECTED]> writes:
>
>  Graham> Equally glad that it's being supported! Thank you.
>
>  Where one can found it?
>
>  Few days ago I was told on #haskell that shim is dead :-/

The original, I believe:
http://mapcar.org/haskell/shim/

Mark Weber's fork is here (discussed April 8 on haskell-cafe):
http://mawercer.de/~publicrepos/shim/

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


Re: [Haskell-cafe] Shim: finding modules

2008-04-17 Thread Graham Fawcett
On Thu, Apr 17, 2008 at 10:41 AM, Marc Weber <[EMAIL PROTECTED]> wrote:
> > I'd like to be able to tell Shim that 'App' is the root of my project,
>  > and to locate modules from that root. Is this possible?
>  If adding the cabal file does'nt work contact me and we'll try to
>  reslove this issue.

It did work, but thanks for the offer of help.

> Are you willing to test new versions/ extensions? Are you already using 
> ghc-6.8 ?

Yes, and I don't need ghc-6 support. I'm not sure how much I can help,
but I would be a willing tester (on Emacs, particularly).

>  Anyway it's nice to see that shim is beeing used.

Equally glad that it's being supported! Thank you.

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


Re: [Haskell-cafe] export question (GHC.Handle)

2008-04-17 Thread Graham Fawcett
On Thu, Apr 17, 2008 at 10:38 AM, Bertram Felgenhauer
<[EMAIL PROTECTED]> wrote:
>
> Graham Fawcett wrote:
>  > I notice in the source for GHC.Handle that certain functions (e.g.
>  > fdToHandle_stat) are in the export list, but are not actually exported
>  > (at least, it seems you cannot import them). What mechanism causes
>  > these functions to be "hidden", and are they still accessible in some
>  > way?
>
>  which ghc version are you using, and which sources are you looking at?
>
> import GHC.Handle (fdToHandle_stat)
>
>  works fine in ghc 6.8.2. In the base library shipped with ghc 6.6.1,
>  it wasn't exported (or even defined).

Ah, I was looking at GHC 6.8.2 sources, but I may have been running
6.6.1. PEBKAC, sorry for the noise.

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


Re: [Haskell-cafe] Shim: finding modules

2008-04-17 Thread Graham Fawcett
On Thu, Apr 17, 2008 at 4:26 AM, pepe <[EMAIL PROTECTED]> wrote:
>
>  On 16/04/2008, at 22:15, Graham Fawcett wrote:

> > I'd like to be able to tell Shim that 'App' is the root of my project,
> > and to locate modules from that root. Is this possible?
>
>  Shim already does this. All it requires is that your project is a Cabal
> project. Shim will locate the Cabal descriptor and auto configure itself
> from there. Does that solve your problem ?

It does! Thanks very much.

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


[Haskell-cafe] export question (GHC.Handle)

2008-04-16 Thread Graham Fawcett
I notice in the source for GHC.Handle that certain functions (e.g.
fdToHandle_stat) are in the export list, but are not actually exported
(at least, it seems you cannot import them). What mechanism causes
these functions to be "hidden", and are they still accessible in some
way?

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


Re: [Haskell-cafe] Hoogle

2008-04-16 Thread Graham Fawcett
On Wed, Apr 16, 2008 at 5:30 PM, John Goerzen <[EMAIL PROTECTED]> wrote:
> On Wed April 16 2008 3:54:45 pm Galchin, Vasili wrote:
>  > hi Antoine,
>  >
>  >I already found this link. Thanks in any case. I want to O_CREATE a
>  > file, i.e. do a openFd creating a new file. O_CREATE should be the
>  > FileMode, but I don't see in the link below.
>
>  Indeed.  It seems there is no way to pass O_CREAT to openFile.  there is
>  createFile, but that's really a different call.  Sigh.

In openFile, in GHC 6.8.2 at least, O_CREAT is passed for WriteMode
and ReadWriteMode -- see output_flags in GHC/Handle.hs.

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


[Haskell-cafe] Shim: finding modules

2008-04-16 Thread Graham Fawcett
Hi folks, I'm a newbie, so please forgive any terminological mistakes.

I've been using Shim in Emacs with great success, but there's one
issue I've encountered, and I don't know if it's configuration problem
or something fundamental. Consider a module 'App' and submodules
'App.Front' and 'App.Back'. When editing code in App that depends on
the submodules, Shim works well at resolving the location of the
submodules, and validates my code. But when editing App.Front, which
depends on App.Back, Shim fails to validate -- my working directory is
App.Front, and Shim doesn't seem able to find the location of
App.Back.

I'd like to be able to tell Shim that 'App' is the root of my project,
and to locate modules from that root. Is this possible?

On a related note, it seems that Shim is moribund (though others have
forked it, mostly for Vim support?). Given its utility, I'm surprised
by this. Do you have other support tools that serve a similar role? (I
know of haskell-mode, but the GHC API integration seems to be the
feature that sets Shim apart.)

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


[Haskell-cafe] Two Lectureships in Nottingham

2008-03-18 Thread Graham Hutton
Dear all,

We are advertising two new Lectureships (Assistant Professorships)
in Computer Science at the University of Nottingham in England.
Applications in the area of functional programming are particularly
welcome.  Further details are available from:

   http://jobs.nottingham.ac.uk/vacancies.aspx?cat=160#j2797

The closing date for applications is 28th March 2008.

Best wishes,

Graham Hutton

+-+
| Dr Graham Hutton Email : [EMAIL PROTECTED]  |
| School of Computer Science  |
| University of Nottingham Web   : www.cs.nott.ac.uk/~gmh |
| Jubilee Campus, Wollaton Road   |
| Nottingham NG8 1BB, UK   Phone : +44 (0)115 951 4220|
+-+

This message has been checked for viruses but the contents of an attachment
may still contain software viruses, which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.

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


[Haskell-cafe] Two Lectureships in Nottingham

2008-02-07 Thread Graham Hutton
Dear all,

We are advertising two new Lectureships (Assistant Professorships)
in Computer Science at the University of Nottingham in England.
Applications in the area of functional programming are particularly
welcome.  Further details are available from:

   http://jobs.nottingham.ac.uk/vacancies.aspx?cat=160#j2797

The closing date for applications is 22nd Feburary 2008

Best wishes,

Graham Hutton

+-+
| Dr Graham Hutton Email : [EMAIL PROTECTED]  |
| School of Computer Science  |
| University of Nottingham Web   : www.cs.nott.ac.uk/~gmh |
| Jubilee Campus, Wollaton Road   |
| Nottingham NG8 1BB, UK   Phone : +44 (0)115 951 4220|
+-+

This message has been checked for viruses but the contents of an attachment
may still contain software viruses, which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.

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


Re: [Haskell-cafe] ANNOUNCE: HStringTemplate -- An Elegant, Functional, Nifty Templating Engine for Haskell

2008-01-16 Thread Graham Fawcett
On Jan 14, 2008 2:47 AM, Sterling Clover <[EMAIL PROTECTED]> wrote:
> HStringTemplate is a port of Terrence Parr's lovely StringTemplate
> (http://www.stringtemplate.org) engine to Haskell.

This is very cool.

Your docs describe a function, cacheSTGroup:

cacheSTGroup :: Int -> STGen a -> STGen a
Given an integral amount of seconds and a group, returns a group
cached for that span of time. Does not cache "misses."

How does this work without breaking referential transparency?
Shouldn't it be in the IO monad if it is time-dependent?

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


Re: [Haskell-cafe] Why purely in haskell?

2008-01-09 Thread Graham Fawcett
On Jan 9, 2008 6:20 PM, Don Stewart <[EMAIL PROTECTED]> wrote:
> anton:
> > Oh dear - I'm going to have to rethink the paper I was working on,
> > provisionally titled "In defense of arbitrary untracked effects in high
> > assurance software."  ;)
>
> That would be an awesome paper :)

Hear, hear!

Anton, if you're looking for a co-author, and you're willing to tackle
the high-assurance parts, I have years of experience with arbitrary
untracked effects. ;-)

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


Re: [Haskell-cafe] New slogan for haskell.org

2007-11-27 Thread Graham Fawcett
On Nov 27, 2007 11:14 AM, Henning Thielemann
<[EMAIL PROTECTED]> wrote:
> I think this is true, but for me it means, that we do not need another
> advertisement at Haskell.org, but facts. I also expect that people
> visiting the site already know about static typing and have categorized
> themselves into static typing lovers or haters. They will also have heard
> about polymorphism (just like object-orientation :-). So they only need to
> find out about the words, they do not know.

For what it's worth, the Python community went through a contentious
debate when it was decided to release a new -- dare I say
"corporate-friendly"? -- Web site a few years ago. Experienced users
didn't want some marketroid to plough across their tried-and-true
navigation pathways. But it was done; and once the site was up, the
debate quickly ended, and everyone simply got back to work. Having a
front-page that was welcoming to outsiders (for several values of
"outside") turned out not to be very disruptive at all. Experienced
users quickly find what they are looking for, as long as the
navigation is reasonable.

I offer this as a cautionary tale, before the debate heats up.

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


Re: [Haskell-cafe] Network.HTTP problem

2007-11-17 Thread Graham Fawcett
On Nov 17, 2007 4:52 PM, Radosław Grzanka <[EMAIL PROTECTED]> wrote:
> > > Also:
> > > $ ./get http://digg.com/rss/indexvideos_animation.xml
>
> However this one still seems to hang and eventually ends with :
> get: recv: resource vanished (Connection reset by peer)


It's not a Haskell problem. It looks like Digg expects a User-Agent
request header. Modify get.hs like this:

request uri = Request{ rqURI = uri,
   rqMethod = GET,
   rqHeaders = [Header HdrUserAgent "haskell-get-example"],
   rqBody = "" }

and see what happens.

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


Re: [Haskell-cafe] Chart plotting libraries

2007-11-15 Thread Graham Fawcett
On Nov 15, 2007 10:33 AM, David Roundy <[EMAIL PROTECTED]> wrote:
> Chart has rather a complicated API.  I've written a simpler API (but
> somewhat less flexible), if anyone's interested (Tim wasn't).  My API is
> closer in complexity (of use) to matlab's plotting.

I'd be interested, for one.

Cheers,
Graham

Graham Fawcett
Centre for Teaching and Learning
University of Windsor
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] type/class question: toString

2007-11-08 Thread Graham Fawcett
On Nov 7, 2007 4:34 PM, Nicholas Messenger <[EMAIL PROTECTED]> wrote:
> If you're willing to have an extra Typeable constraint, this does what you 
> want:
>
> > import Data.Typeable (Typeable, cast)
> > import Data.Maybe (fromMaybe)
> >
> > toString :: (Show a, Typeable a) => a -> String
> > toString x = fromMaybe (show x) (cast x)


Nice! Thank you for introducing me to the Typeable class (and by
extension, Dynamic) -- I hadn't realized there was library support for
dynamic types.

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


Re: [Haskell-cafe] type/class question: toString

2007-11-06 Thread Graham Fawcett
On Nov 6, 2007 3:29 PM, Graham Fawcett <[EMAIL PROTECTED]> wrote:
> On Nov 6, 2007 2:21 PM, Jeff Polakow <[EMAIL PROTECTED]> wrote:
> >   Have you tried using -fglasgow-exts? That should enable all ghc
> > extensions.

If anyone's interested, I had best results when I added the flag
-fallow-incoherent-instances. Without it, I could not handle numbers
without declaring their types, e.g. 'toString (33 :: Int)' would work,
but 'toString 33' would lead to:

Ambiguous type variable `t' in the constraints:
  `ToString t'
arising from use of `toString'
at /home/graham/tmp/ToString.hs:13:15-25
  `Num t'
arising from the literal `33'
at /home/graham/tmp/ToString.hs:13:24-25
Probable fix: add a type signature that fixes these type variable(s)

Here's the code I ended up with.

{-# OPTIONS -fglasgow-exts -fallow-overlapping-instances #-}
{-# OPTIONS -fallow-incoherent-instances -fallow-undecidable-instances #-}

module ToString (ToString(..)) where

class Show a => ToString a  where toString :: a -> String
instance ToString Stringwhere toString s = s
instance (Show a) => ToString a where toString s = show s


Thanks to all who responded; I learned a lot from this.

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


Re: [Haskell-cafe] type/class question: toString

2007-11-06 Thread Graham Fawcett
On Nov 6, 2007 2:21 PM, Jeff Polakow <[EMAIL PROTECTED]> wrote:
>   Have you tried using -fglasgow-exts? That should enable all ghc
> extensions.

Ah thanks, that does it.
G
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] type/class question: toString

2007-11-06 Thread Graham Fawcett
On Nov 6, 2007 12:03 PM, Thomas Schilling <[EMAIL PROTECTED]> wrote:
> On Tue, 2007-11-06 at 09:18 -0500, Graham Fawcett wrote:
> > Hi folks,
> > Is there a way to declare a 'toString' function, such that
> > toString x |  = x
> > toString x |  = show x
> I think the simpler solution (for your particular problem) is to tag
> strings that should be printed as-is:
>
> newtype Literal = Literal String
> instance Show Literal where show (Literal x) = x
> lit :: String -> Literal
> lit = Literal

I almost replied to ask, "doesn't that solve a different problem?" But
I see that in practice, it leads to a similar result, and without
type-system trickery.

The type-system trickery is still devilishly interesting, though. ;-)

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


Re: [Haskell-cafe] type/class question: toString

2007-11-06 Thread Graham Fawcett
On Nov 6, 2007 12:15 PM, David Benbennick <[EMAIL PROTECTED]> wrote:
> In ghc 6.8.1, the error messages are more helpful:
>
> foo.hs:5:0:
> Illegal instance declaration for `MyShow String'
> (All instance types must be of the form (T t1 ... tn)
>  where T is not a synonym.
>  Use -XTypeSynonymInstances if you want to disable this.)
> In the instance declaration for `MyShow String'


Thanks for the tip. I might give 6.8.1 a try; I still cannot get it to
work in 6.6.1. The problem may exist between the keyboard and the
chair.

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


Re: [Haskell-cafe] type/class question: toString

2007-11-06 Thread Graham Fawcett
On Nov 6, 2007 10:30 AM, Bayley, Alistair
<[EMAIL PROTECTED]> wrote:
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of Graham Fawcett
> > Is there a way to declare a 'toString' function, such that
> > toString x |  = x
> > toString x |  = show x
> I'm assuming you're not fond of the way the print function handles
> Strings?

More a curiosity about the flexibility of the type system -- but yes,
I could see cases where such a thing could be useful.

> With GHC you can do this:
> > {-# OPTIONS -fallow-overlapping-instances #-}
> > {-# OPTIONS -fallow-undecidable-instances #-}
> >
> > class Show a => MyShow a where show_ :: a -> String
> > instance MyShow String where show_ s = s
> > instance (Show a) => MyShow a where show_ s = show s

This doesn't want to compile for me:

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.6.1

$ ghc ToString.hs   # your code, verbatim

ToString.hs:5:0:
Illegal instance declaration for `MyShow String'
(The instance type must be of form (T a b c)
 where T is not a synonym, and a,b,c are distinct type variables)
In the instance declaration for `MyShow String'

ToString.hs:6:0:
Illegal instance declaration for `MyShow a'
(The instance type must be of form (T a b c)
 where T is not a synonym, and a,b,c are distinct type variables)
In the instance declaration for `MyShow a'

I'll read up on those two GHC options, and try to figure it out myself
(but hints are welcome).

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


[Haskell-cafe] type/class question: toString

2007-11-06 Thread Graham Fawcett
Hi folks,

Is there a way to declare a 'toString' function, such that

toString x |  = x
toString x |  = show x

Perhaps, in the type system, there's a way to declare a ToString
class, and somehow "inherit" all instances of Show as ToString
instances?

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


Re: [Haskell-cafe] ghc -e with standard input

2007-11-05 Thread Graham Fawcett
On Nov 5, 2007 1:46 PM, Maurí­cio <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Is there a way to run 'ghc -e' taking input
> from standard input? I would like to use it
> in a pipe.

It seems to me that you can use getContents, et. al., as you would
from any other Haskell program:

$ echo hello there mauricio | ghc -e "print =<< (Control.Monad.liftM
(reverse . words)) getContents"
["mauricio","there","hello"]

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


Re: [Haskell-cafe] lazily traversing a foreign data structure

2007-10-26 Thread Graham Fawcett
On 10/26/07, Brent Yorgey <[EMAIL PROTECTED]> wrote:
>In the end it looks to me like you're probably better off
> just implementing traverse directly as you have done, although perhaps
> someone will find a better way.

Beginner's luck. ;-) I see the unfold similarity, but yes, it doesn't
seem a good fit here.

> I will note, however, that the last few lines of traverse can be written
> more simply as:
> Just v -> liftM (v:) . valve . traverse $ (\db -> nextKey db v)
> or even
> Just v -> liftM (v:) . valve . traverse . flip nextKey $ v
>
> Perhaps that's going too far for your taste...

Not at all -- it's terse but the data flow is clear.

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


Re: [Haskell-cafe] lazily traversing a foreign data structure

2007-10-26 Thread Graham Fawcett
On 10/25/07, Derek Elkins <[EMAIL PROTECTED]> wrote:
> On Thu, 2007-10-25 at 11:30 -0400, Graham Fawcett wrote:
> > I'm writing a Gnu DBM module as an exercise for learning Haskell and
> > its FFI. I'm wondering how I might write a function that returns the
> > database keys as a lazy list.
> Just use unsafeInterleaveIO in the obvious definition to read all the
> keys.  That said, it's not called unsafeInterleaveIO for no reason.

I got it to work, using unsafeInterleaveIO. Thanks! But I suspect I
might be working too hard to get the result. Is anyone willing to
critique my code?

Given firstKey and nextKey:

  firstKey :: DbP -> IO (Maybe String)
  nextKey :: DbP -> String -> IO (Maybe String)

I wrote these eager and lazy key-iterators:

  allKeys :: DbP -> IO [String]
  allKeys = traverseKeys id

  unsafeLazyKeys :: DbP -> IO [String]
  unsafeLazyKeys = traverseKeys unsafeInterleaveIO

  traverseKeys :: (IO [String] -> IO [String]) -> DbP -> IO [String]
  traverseKeys valve db = traverse firstKey
  where traverse :: (DbP -> IO (Maybe String)) -> IO [String]
traverse func = do nxt <- func db
   case nxt of
 Nothing -> return []
 Just v -> do rest <- valve $
  traverse (\db ->
nextKey db v)
  return $ v : rest

Intuition suggests there's a higher-order way of writing 'traverse'.

(It was an 'aha' moment for me to realize Haskell would let me choose
strict or lazy evaluation by passing in a different 'valve'
function. Powerful stuff.)

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


Re: [Haskell-cafe] lazily traversing a foreign data structure

2007-10-25 Thread Graham Fawcett
On 10/25/07, Brandon S. Allbery KF8NH <[EMAIL PROTECTED]> wrote:
> On Oct 25, 2007, at 14:21 , Ryan Ingram wrote:
> > Right, but if you do something like
> >
> > do
> >   keys <- getKeysLazy db
> >   [.. some computation A here that may or may not evaluate all the
> > keys ..]
> >   addRow db newRow
> >   [.. some other computation B that uses the key list ..]
> >
> > does B see the new row or not?
>
> My point is that there's no promise for that one *even in C*.  (The
> equivalent construct being adding the new row before nextKey has
> failed.)

Just so. Deletions, for example, may change the ordering of the
internal hashtable (according to the gdbm manpage), making some keys
unfindable by a series of nextKey calls.

(If I were writing a serious module, and not just noodling around, I
imagine I'd document this, and let the user decide whether strict
evaluation was required.)

Thanks again to all,
Graham
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] lazily traversing a foreign data structure

2007-10-25 Thread Graham Fawcett
On 10/25/07, Derek Elkins <[EMAIL PROTECTED]> wrote:
> On Thu, 2007-10-25 at 11:30 -0400, Graham Fawcett wrote:
> > I'm writing a Gnu DBM module as an exercise for learning Haskell and
> > its FFI. I'm wondering how I might write a function that returns the
> > database keys as a lazy list. I've wrapped the two relevant foreign
> > functions:
> Just use unsafeInterleaveIO in the obvious definition to read all the
> keys.  That said, it's not called unsafeInterleaveIO for no reason.


Ah thanks, that's just the thing. Safety warnings duly noted.

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


[Haskell-cafe] lazily traversing a foreign data structure

2007-10-25 Thread Graham Fawcett
Hi folks,

I'm writing a Gnu DBM module as an exercise for learning Haskell and
its FFI. I'm wondering how I might write a function that returns the
database keys as a lazy list. I've wrapped the two relevant foreign
functions:

firstKey :: Ptr Db -> IO (Maybe String)
nextKey  :: Ptr Db -> String -> IO (Maybe String)

NextKey takes a key, and returns the next one. Either function could
return Nothing, since the db may have 0 or 1 keys.

Given these, is it possible to write a (simple) function

allKeys :: Ptr Db -> IO [String]

that lazily fetches the keys? (Or, an idiomatic way of achieving the
same end?)

Thanks,

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


[Haskell-cafe] Postdoctoral Fellowship in Functional Programming

2007-09-26 Thread Graham Hutton
++

POSTDOCTORAL RESEARCH FELLOW IN FUNCTIONAL PROGRAMMING

  School of Computer Science
 University of Nottingham, UK

Applications are invited for a 3-year postdoctoral research fellowship
in  functional programming,  to  work  with Dr  Graham  Hutton on  the
EPSRC-funded project "Reasoning About Exceptions and Interrupts".

Most  modern  programming   languages  provide  special  features  for
detecting and managing unexpected events, in the form of exception and
interrupt handling primitives.  Despite their importance, the issue of
provable  correctness  for   programs  involving  these  features  has
received  little  attention, but  is  particularly  crucial given  the
difficulty of  writing correct programs  in this setting.  The  aim of
this project is  to address this problem within  the context of modern
functional programming languages such as Haskell and Epigram.

Applicants for this  position will require a PhD  in Computer Science,
and  research   experience  in  functional   programming.   Additional
desirable attributes  include experience in  formal semantics, program
verification, concurrency theory, or theorem provers.

The  successful applicant will  work in  collaboration with  Dr Graham
Hutton  in  the Foundations  of  Programming  group  in Nottingham,  a
leading  centre   for  research  on  formal   approaches  to  software
construction  and  verification.   The  group  currently  comprises  7
academic staff, 5 research staff, and 13 PhD students.

Salary  will be  within the  range 25,134  - 32,796  pounds  per year,
depending  on qualifications  and experience.   The post  is available
immediately, and will be offered on a fixed-term contract for 3 years.

Further details regarding the position  and how to apply are available
from Dr Graham Hutton, http://www.cs.nott.ac.uk/~gmh.

Closing date for applications: 12th October 2007.

+----+
| Dr Graham HuttonEmail : [EMAIL PROTECTED]  |
| School of Computer Science |
| University of NottinghamWeb   : www.cs.nott.ac.uk/~gmh |
| Jubilee Campus, Wollaton Road  |
| Nottingham NG8 1BB, UK  Phone : +44 (0)115 951 4220|
++

This message has been checked for viruses but the contents of an attachment
may still contain software viruses, which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.

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


Re: [Haskell-cafe] Learning C after Haskell

2006-06-15 Thread Graham Klyne
I did the transition the other way, and even now the real-world keeps me using
more C-like languages (Java, Python).

Unlike the transition from imperative languages to Haskell, I don't think
there's much you have to unlearn or rethink.  But I suspect you may feel a
degree of frustration at how incredibly primitive C may seem after learning to
use the power that Haskell makes available.  Where you can map Haskell idioms
into C, I think they may serve you well (I've found this to be the case with
Python, but the gap from Haskell to C is somewhat greater).

You mention "high performance" computing.  I think there are two ways of
achieving this:  the C way might be described as "micro optimization" -- getting
the small but important things to run as efficiently as possible  The Haskell
was is more a case of "macro optimization" -- getting the overall algorithmic
approach to be as smart as possible.  There's a place for both, but once you get
involved in micro-optimization it can be very difficult to go back and fix the
macro performance issues.  So you might do well to first code algorithms in
Haskell first, and experiment with the algorithms, if only as a way of
specifying the solution to be implemented in C.

#g
--

Chad Scherrer wrote:
> Ok, so I'm doing things somewhat backward. I've been using Haskell for a
> while now, whenever I get a chance to. But in order to become more
> involved in high-performance computing projects at my work, I need to
> learn C.
> 
> I've heard a lot of people say that experience in Haskell can improve
> one's abilities in other languages, but I also wonder how different the
> C "way of doing things" is different from Haskell's.
> 
> My question is, as I learn C, are there any particular Haskell concepts
> I should keep in the back of my mind, or is it better to approach C from
> scratch?
> 
> Thanks in advance!
> 
> Preparing for a foot-shooting,
> Chad
> 
> 
> 
> 
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

-- 
Graham Klyne
For email:
http://www.ninebynine.org/#Contact

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


Re: [Haskell-cafe] develop new Haskell shell?

2006-05-09 Thread Graham Klyne
Did you see [http://nellardo.com/lang/haskell/hash/] ?

Google also finds some links to code.

#g
--

Marc Weber wrote:
> Hi.
> 
> Who wants to try devloping a new shell with me?
> 
> The main goals: try adding some haskell scriting instead of bash/zsh,
> 
> history dependend on 
> a) executing program
> b) current dir
> c) last commands
> d) workspaces
> which should mean that the shell should save at least the last 10
> commands of a,b,c,d.
> 
> So you can do
> emerge (lookup parameters in history) even if you haven't used emerge
> for ages.. :) Nice, isn't it?
> 
> d) Workspaces should mean:
> You can define some kind of workspace like
> workspace=haskellproject, wash, apache 
> to add these tags together with the commands to the history..
> So when working only in the "wash" workspace you can easily find those
> commands.. Perhpas it's even useful to attach commands or even scripts
> to those workspaces?
> 
> eg the startApache script may be attached to
> admin, apache, ...,
> the cd /etc/init.d command only to admin..
> 
> I also would like to have some advanced kind of directory matching,
> defining aliases for directories.
> 
> eg just type
> cd /usl to get a  list of diretories looking like this:
> /UserShupportLocales
> /usr/src/linux
> /usl ?
> 
> Using tab and bash is nice but it might be done better?
> 
> Any suggestions?
> 
> One would have to think about how to run processes in background and so
> on ...
> 
> adding files as parameters the way it's possible in mc ( select them and
> add them to the command line )
> 
> perhaps even implement cp/mv/ ... for virtual file systems like zip
> files/ ftp/ ... ?
> 
> and last but not least:
> on windows add all Programs beeing found in Start-> Programs to the path
> list... I wish I could just do word/ Enterprise Manager at a shell and
> not searching for the menu entries over and over again.. ;)
> I know I can add them the to the path.. but that would be some work,
> too.. and not desirable in any case.
> 
> I could imagine adding a small prefix to each cmd eg.
> 
> eb (execute bash cmd)
> ez (execute zsh cmd)
> r (remove file list)
> efs (execute from windows start menu)
> bg  run in background like bashs & feature.
> 
> Perhaps even introduce some new syntax ?
> or use ghci or hugs with a preprocessor to translate these commands to
> haskell commands?
> 
> What do you think?
> 
> Marc Weber
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
> 

-- 
Graham Klyne
For email:
http://www.ninebynine.org/#Contact

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


Re: [Haskell-cafe] web servers

2006-04-12 Thread Graham Klyne
I'm interested, but I don't have the time to look right now (or in the next
couple of months, as far as I can see).

What would really interest me is a system that can provide the functionality of
the Python packages I currently use (TurboGears [1], of which the web
server/controller component is CherryPy [2]).  There's also some interesting
recent CherryPy-related discussion about web dispatching that I think could
translate very well to Haskell [3][4].

...

I'd also be interested in a system that handled overlapped asynchronous requests
in a fashion not dissimilar to Twisted [5].  I've very recently been playing
with Twisted as a way to deal with large numbers of overlapping lightweight
requests without having large numbers of active threads.  Twisted requires one
to string together asynchronous callbacks to assemble a process that completes
over time.  It seems to me that the sequencing of asynchronous operations is
very much like threading computations in a monad, and that the higher-order
functions on monads could also be used for composition of asynchronous
operations.  I just implemented a "sequence" function for Twisted operations
whose implementation started to feel very like "foldr".

This can't be new, and I'm wondering if there is any interesting work out there
on using monads for multiple asynchronous I/O operations.  (And, much as I'd
love to use Haskell for this, is there work that would translate cleanly to 
Python?)

#g
--

[1] http://www.turbogears.com/

[2] http://www.cherrypy.org/

[3] http://pythonpaste.org/do-it-yourself-framework.html
(cf. descriptions of object publishing)

[4] The above link was posted in this discussion thread:
http://groups.google.com/group/cherrypy-users/browse_frm/thread/47035d8d78adad69/bf02b489e45ce6c5?tvc=1&hl=en#bf02b489e45ce6c5

[5] http://twistedmatrix.com/
http://twistedmatrix.com/projects/core/



Daniel McAllansmith wrote:
> Following is a message I sent yesterday, sans attachment.  Looks like the 
> code 
> was too bloated to get through under the list size limit.
> 
> As I say in the original message , I'm keen for any feedback.  So let me know 
> if anyone wants the actual code (20 KB, compressed) to have a look through.
> 
> Cheerio
> Daniel
> 
> 
> On Sunday 09 April 2006 06:24, Tim Newsham wrote:
>> I found a copy of Simon Marlow's HWS on haskell.org's cvs 
>> server.  I know there's a newer plugin version, but I cant find a working
>> link to the actual code.
> 
> There's this link: http://www.mdstud.chalmers.se/~md9ms/hws-wp/
>>From memory I think there may have been a more recent version at 
> scannedinavian.org (possibly only accessible with darcs?), but still a couple 
> of years with no apparent activity.
> 
>> Besides HWS, what other web servers exist?  Does anyone actually use a
>> haskell based web server in practice?  Which web server is considered the
>> most mature?  stable?  fastest?
>>
>> I'm trying to decided if I should sink some time into HWS or if I should
>> use another server.
> 
> Several months ago I had a bit of play-time available which I spent on 
> writing 
> a HTTP server in Haskell.
> The goal was a HTTP 1.1 compliant server that could be embedded in a Haskell 
> app, be reconfigured on the fly and have different request handlers 
> added/removed.
> I did have a quick look at HWS before I started but I seem to recall it was 
> pretty basic (in terms of the amount of the HTTP spec. implemented).
> 
> In any event, I started from scratch.  It's certainly not finished, and it's 
> the very first thing I wrote with Haskell so it's a bit of a dogs breakfast, 
> but it might be of interest.
> There's lots that needs doing but it should just be a case of writing a 
> request handler to get it doing _something_ useful.
> 
> 
> It's always been my intention to get back to it, clean it up a bit/lot and 
> release it under a more liberal licence (currently 'all rights reserved'), 
> but have had little time available.
> Eventually I hope to actually use it in anger.
> 
> If anyone is interested in using it, contributing to it, or picking over it 
> for use in an existing project, I'll try and find somewhere stable to host it 
> and change the licence.
> Feel free to ask questions on what it does/doesn't do.  You'll probably need 
> to, given the documentation ;-)
> 
> 
> Regardless of it's utility, any criticism or advice on the code would be 
> appreciated.
> 
> Daniel
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
> 

-- 
Graham Klyne
For email:
http://www.ninebynine.org/#Contact

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


Re: [Haskell-cafe] Web application frameworks

2006-03-08 Thread Graham Klyne
Björn Bringert wrote:
> Graham Klyne wrote:
>> [Switching to haskell-cafe]
>> Niklas Broberg wrote:
> 
>> ...
> 
>>> On 3/6/06, Graham Klyne <[EMAIL PROTECTED]> wrote:
>>>> - Options to run the whole thing behind Apache to leverage its
>>>> security and web
>>>> space management capabilities
>>>
>>> Lemmih has implemented a HSP/FastCGI binding for Apache. I also know
>>> that work is being done on building a direct HSP/Apache binding. All
>>> work in progress though.
>>
>> Yes, I was aware of a fastCGI for Haskell.  Didn't Bjorn Bringert (also)
>> implement one?  I tend to think of CGI programs as
>> run-to-completion-then-exit,
>> even when a fastCGI interface allows a persistent wrapper program to
>> speed
>> startup.  But I could easily be missing something here.
> 
> Yes, I have written a FastCGI binding (darcs repo here:
> http://www.cs.chalmers.se/~bringert/darcs/haskell-fastcgi/). If I'm not
> mistaken, that's what Lemmih is using for his HSP/FastCGI binding.
> 
> I have only used FastCGI the way you describe, as CGI without start-up
> penalty, though I can't see why you couldn't keep some state between
> requests to a FastCGI application. I believe that Ruby-on-Rails (which
> I've never used, so I'm not too sure) can use FastCGI.
> 
> One problem with Apache and FastCGI is that the Apache FastCGI module
> doesn't seem to support concurrent requests to a single FastCGI process
> (even though the FastCGI protocol allows this). This means that Apache
> will have to run several instances of the Haskell-over-FastCGI app to
> serve concurrent requests, or be forced to serialize the requests.
> Having several instances of course means that you can't really keep
> stuff like session data in memory in the FastCGI process. If the Apache
> module supported concurrent requests we could spawn a new Haskell thread
> to serve each request, which ought to scale well.

Aha!  I think that homes in on what I was after when mentioning long-running
processes.  I think there are some separate but related issues to consider:

(a) can a single CGI invocation handle (respond to) a series of HTTP requests,
or is it strictly one http request for each CGI invocation?  Without this, you
may have to throw away session state after each request.

(b) is there a way to maintain state between CGI invocations?

(c) can multiple concurrent CGI/HTTP requests be handled?

Of these, I think (c) may be the least important, other than for performance
reasons (and maybe not even then), provided that there are ways to handle
upstream I/O asynchronously, and to encapsulate all the relevant session state
in a way that can be passed between invocations.  I guess it comes down to a
choice between an event-driven or multi-threaded processing model (and the
former seems to me to be a nicer fit with Haskell).

I think the minimum requirement is ((a) OR (b)) AND  ((c) OR (asynchronous I/O
completion))

#g

-- 
Graham Klyne
For email:
http://www.ninebynine.org/#Contact

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


[Haskell-cafe] Web application frameworks (was: [Haskell] Re: Trying On Learn Haskell Web Server)

2006-03-07 Thread Graham Klyne
[Switching to haskell-cafe]

Niklas Broberg wrote:
> Ehum, shameless plug. :)
> 

Pretty much what I was fishing for...

> On 3/6/06, Graham Klyne <[EMAIL PROTECTED]> wrote:
>> Cale Gibbard wrote:
>>> Ah, neat, I knew about WASH, but somehow I'd missed the fact that
>>> there was a server there :)
>> Interesting... at a casual glance, this looks as if it could be coming close 
>> to
>> being a "full stack web application framework" for Haskell, looking to occupy
>> the same kind of territory as systems like Java/Servlets+JSP+the rest,
>> Ruby/Rails or Python/Turbogears (the last a package I'm currently using).
> 
> Have you looked at HSP [1]? This is exactly what the HSP project aims
> for, although there is quite some ways to go yet.

I've noticed it, but haven't yet taken a closer look.  Currently, I'm pretty
busy with non-Haskell activities, but I'd love to find a sufficiently mature
tool to migrate some of my work to Haskell.

>> I think see:
>>   The web server
>>   CGI process dispatching
>>   Web page templating
>>   Relational database access
> 
> All of these are present in HSP.

I noticed that WASH makes some mention of HSP.  My main concern with a *SP
approach, and a reason I haven't delved more deeply, is that they are, AFAICT,
heavily dependent on code embedded in HTML, when I really want to separate the
code and markup as much as possible.

>> Additional features of a full-stack web application framework that may or may
>> not be present are:
>>
>> - Support for longer-running web processes (implemented in haskell, of 
>> course)
> 
> HSP has that.

Ah, OK... I wasn't aware of that.

>> - An easy way to map incoming URIs to specific functions (hmm.. or to monadic
>> values, I think)
> 
> I don't think I understand what you're after exactly, but I'm sure
> it's interesting, care to explain a bit further? :-)

I'll try and explain using Turbogears as example.  Actually, I think that
Turbogears would make a good model for building a Haskell Web application
framework, since many of the key integration points are implemented using higher
order functions.  It makes heavy use of Python 2.4 "decorators", which are a
(constrained) form of functional composition for class member functions.

The web server/controller component of Turbogears is CherryPy.  Roughly, a class
maps to a web server "directory" in URI space, with a declared class
(conventionally "root") corresponding to path / for a server.   Member variables
use used to create subdirectories.  here's an example from soemthign I'm 
working on:

[[
class Root(controllers.Root):

panel= PanelRenderer()  ### Note 1
webbrick = WebBrickAccess()
itunes   = ITunesAccess()

@turbogears.expose(html="templates.welcome")### Note 2
def index(self):
return dict(now=time.ctime())

@turbogears.expose(html="templates.listpanels") ### Note 2
def panels(self):
def selectPanelName((_,nam)):
return nam[:-4]
pattern = re.compile( r'^.+\.xml$' )
c = CollectFiles("../resources/paneldef/",pattern,recursive=False)
return { 'baseuri' : turbogears.url("/")+"panel/",  ### Note 3
 'panels'  : map(selectPanelName,c) }
]]

Notes:

1. These assignments create sub-pages of the root page for http://.../panel/,
http://.../webbrick/, http://.../itunes/.

2. This is the Python decorator syntax, that defines a class method as a
composition of the decorator function (turbogears.expose) and the function
definition that follows.  The turbogears.expose decorator performs two functions
here:  (a) it causes the function to be exposed as a web page; e.g.
http://.../index or http://.../panels, (b) it uses the output from the defined
function as input to a templating system to format and return an HTML web page.

3. The templating system uses a Python "dictionary" type to accept values that
are included in the constructed web page.  You will note that this code is
completely independent of the details of the templating syst actually used.
Indeed, Turbogears can be used with more than one templating system, and (in
principle), I think the decorator system would allow miore than one such system
to be used within a single application - not that I advocate this ;).

I think all of this could be converted quite easily to appropriate Haskell 
idioms.

>> - Easy mapping from Haskell data structures to underlying SQL - what would be
>> called an Object-Relational Mapper (ORM) in OO languages
> 
> Some of our students are working on bringing the power of Ruby/Rails
> to HSP, with em

Re: [Haskell-cafe] Re: [Haskell] page renaming on the Haskell Wiki

2006-02-23 Thread Graham Klyne
[EMAIL PROTECTED] wrote:
> Hello Graham,
> 
> Wednesday, February 22, 2006, 12:57:39 PM, you wrote:
> 
> GK> How to do this in a wiki, I'm not sure, though I don't take that to mean 
> we
> GK> shouldn't try.  I think the mediawiki mechanism you mention is reasonable 
> if not
> GK> ideal, though this would clearly be overwhelmed if page-renaming were to 
> become
> GK> the norm.
> 
> my 2c is what new wiki is just two months old and we should refactor
> it now extensively to make it useable in the future. for example, i
> think that all libraries should be under Library or Libraries root and
> so on. we started with filling up the pages, now we had enough
> contents to see what the structure will serve better

Well, yes, better now than later, for sure.

My comments were really directed toward longer term principles.

I think I've said enough for now.

#g

-- 
Graham Klyne
For email:
http://www.ninebynine.org/#Contact

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


[Haskell-cafe] Re: [Haskell] page renaming on the Haskell Wiki

2006-02-22 Thread Graham Klyne
Wolfgang,

[Switching to haskell-cafe]

Re:
[1] http://www.mail-archive.com/haskell@haskell.org/msg18352.html
[2] http://www.mail-archive.com/haskell@haskell.org/msg18356.html
[3] http://www.w3.org/Provider/Style/URI

Wolfgang Jeltsch wrote (in [2]):
> On the other hand, I think that the above W3C article is far too extreme.  It
> tells you that stability is the most important thing concerning URIs.

I will pursue this a little further, because I think that getting the web
presence right is very important to maintaining an online community.  It may be
that we must agree to disagree, but based on my experience of using the web,
stability of URIs *is* the most important thing (after content, of course).

I have been using the W3C web site now for many years, and the inconsistencies
you mention have never been a problem for me -- indeed, I hadn't even noticed
them until you mentioned them.

Why is this?  I hypothesize that it is because, when the Web is used
effectively, it is really quite rare to enter a URI manually.  Instead, one uses
various index pages, RSS feeds, search tools and so on to find a URI, and then
simply click on it.  Many URIs are never seen by human eye, but placed behind
descriptive links.  W3C themselves use URIs very intensively in transient
communications, and their mailing system is set up to facilitate this (see their
x-archived-at mail headers).  A result of this is that the email archives,
together with the web site pages, form a tightly interlinked collection of
documents and comments that can be, and are, frequently cross-referenced rather
than reinvented.

But, for this to work, once a link has been placed in a document, feed, archive
or whatever, it is crucially important that it continues to work for as long as
the information it references is of interest to people.  Without this, all the
devices we use to find our way around the web simply fail -- not all at once,
but over time.  Even with every intent to maintain stability, this happens, but
if you allow that URI stability is somehow less important than other
conveniences, then I think all hope is lost for information continuing to be
accessible.

As for the difficulty of designing a consistent URI naming scheme for all time,
the W3C position explicitly recognizes this, and this is why they recommend
incorporating dates near the the root of the URI path.  That way, fashions can
change without requiring that pages published using older conventions be 
removed.

How to do this in a wiki, I'm not sure, though I don't take that to mean we
shouldn't try.  I think the mediawiki mechanism you mention is reasonable if not
ideal, though this would clearly be overwhelmed if page-renaming were to become
the norm.  There are, as you indicate, other technical concerns.  But I still
think they are more easily solved that the problems that arise by failing to
maintain URI stability.

Best regards,

#g

-- 
Graham Klyne
For email:
http://www.ninebynine.org/#Contact

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


Re: [Haskell-cafe] HaXml: ampersand in attribute value

2006-02-20 Thread Graham Klyne
Malcolm Wallace wrote:
> Lennart Augustsson wrote:
>> But speaking of HaXml bugs, I'm pretty sure HaXml doesn't handle
>> % correctly.  It seem to treat % specially everywhere, but I think
>> it is only special inside DTDs.  I have many XML files produced by
>> other tools that the HaXml parser fails to process because of this.
> 
> I believe I fixed at least one bug to do with % characters around
> version 1.14.  But that is the development branch in darcs, not formally
> released yet.  Nevertheless, if you know of such bugs, do report them;
> even better if you can send a small test case.

Malcolm,

Did you come across the HaXml test harness I created based on a subset of W3C
conformance tests?

http://www.ninebynine.org/Software/HaskellUtils/HaXml-1.12/test/

This covers all the parameter entity problems I fixed some time ago.

#g

-- 
Graham Klyne
For email:
http://www.ninebynine.org/#Contact
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] HaXml: ampersand in attribute value

2006-02-20 Thread Graham Klyne
Lennart Augustsson wrote:
> But speaking of HaXml bugs, I'm pretty sure HaXml doesn't handle
> % correctly.  It seem to treat % specially everywhere, but I think
> it is only special inside DTDs.  I have many XML files produced by
> other tools that the HaXml parser fails to process because of this.

Indeed.  This is an area that I found required a fair amount of work on the
version of HaXML I was playing with, some time ago.

The change log at the end of:
http://www.ninebynine.org/Software/HaskellUtils/HaXml-1.12/src/Text/XML/HaXml/Lex.hs
has some clues to what I had to do.  Notably:
[[
-- Revision 1.12  2004/06/04 21:59:13  graham
-- Wortk-in-progress:  creating intermediate filter to handle parameter
-- entity replacement.  Separated common features from parse module.
-- Created new module based on simplified use of parsing utilities
-- to dtect and substitute PEs.  The result is a modifed token sequence
-- passed to the main XML parser.
]]

The parameter entity filter is defined by:
http://www.ninebynine.org/Software/HaskellUtils/HaXml-1.12/src/Text/XML/HaXml/SubstitutePE.hs

The parameter and entity entity handling aspect of the code was not pretty, due
mainly to the somewhat quirky nature of XML syntax, especially concerning
parameter and general entities.

#g

-- 
Graham Klyne
For email:
http://www.ninebynine.org/#Contact
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell XSLT interpreter?

2006-02-13 Thread Graham Klyne
S. Alexander Jacobson wrote:
> 
> Has anyone written a pure haskell xslt interpreter?  If not, how
> difficult would it be to do so?

(Ah, another cool project idea that fell by the wayside !)

Back when I was doing more web work in Haskell, inventing a translation of XSLT
into Haskell was one of the ideas I was gestating.  Unfortunately (or not), a
day job came along and distracted me from that.

...

Without reading in detail, I notice subsequent debate about how to write a pure
function that deals with XML constructs that might perform IO.  This was one of
the problems I encountered when working on HaXML:  I wanted to have options to
use use the parser in "pure" mode (String -> XML), but also to be able to
support full XML that may require I/O (XML defines an internal subset that
doesn't require processors to perform I/O).  In the event, I cheated and used
unsafePerformIO.  But it did occur to me that by parameterizing the XML
processing function with a polymorphic function to turn an entity declaration
into a string, like this:

getEntityString :: Monad m => decl -> m String

then the dependency on IO could itself be parameterized.  For "pure" use, an
identity monad could be used, which the calling program could safely unwrap.
But if external entity support is required, then the type 'm' must be (or
incorporate) an IO, so the value returned to the calling program would only be
accessible within an IO monad.

I feel sure this must be a known Haskell idiom for this kind of problem, but I
can't say that I've noticed it anywhere.  Or is there a snag I didn't notice?

#g

-- 
Graham Klyne
For email:
http://www.ninebynine.org/#Contact

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


[Haskell-cafe] Spotted in Haskell Weekly News: February 06, 2006

2006-02-08 Thread Graham Klyne
Donald Bruce Stewart wrote:
> Haskell Weekly News: February 06, 2006
 :
>   Oleg says, "The implementation of RSA on the type level is left
>   for future work".

Methinks this gives a whole new meaning to "type security".

:)

#g

-- 
Graham Klyne
For email:
http://www.ninebynine.org/#Contact

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


[Haskell-cafe] Pythonic monads

2006-02-03 Thread Graham Klyne
Constructing some code today in Python, using some functional-style coding
idioms, I found myself wondering if there would be any real benefit to using a
monad-based implementation (i.e. other than to demonstrate that it can be done).

The application that sparked this line of thought was a simple filter to trim
comments and whitespace out of an XML document.  I ended up with a simple
state-machine driven filter, thus:

[[
# Strip comments from XML strings
def stripXmlComments(x):
# State table for stripping XML comments
stStripXmlComments = \
{ 0: match1('<',(1,stateFilterHold),(0,stateFilterPass))
, 1: match1('!',(2,stateFilterHold),(0,stateFilterPass))
, 2: match1('-',(3,stateFilterHold),(0,stateFilterPass))
, 3: match1('-',(4,stateFilterDrop),(0,stateFilterPass))
, 4: match1('-',(5,stateFilterDrop),(4,stateFilterDrop))
, 5: match1('-',(6,stateFilterDrop),(4,stateFilterDrop))
, 6: match1('>',(0,stateFilterDrop),(4,stateFilterDrop))
}
return stateFilter(stStripXmlComments,x)

# Simple state machine driven filter
#
# The state table is a dictionary indexed by state values, where the
# initial state is 0, and each entry is a function that accepts a next
# symbol and returns a pair of (next state, action), where action is
# one of 'stateFilterPass', 'stateFilterDrop', 'stateFilterHold'.
# stateFilterHold means that the disposition will be determined later.
#
# The result is an iterator that returns elements from the filtered
# subsequence of the supplied sequence.
#
def stateFilter(stable,seq):
queue = []
state = 0
for symbol in seq:
(state,action) = stable[state](symbol)
(queue,emit) = action(queue,symbol)
for e in emit: yield e
return
def stateFilterPass(q,n):
return ([],q+[n])
def stateFilterDrop(q,n):
return ([],[])
def stateFilterHold(q,n):
return (q+[n],[])

# State transition function to match the specified symbol and return
# 'eqval' if matched, otherwise 'neval'
def match1(sym,eqval,neval):
def m(sym,eqval,neval,next):
if next==sym:  return eqval
return neval
return curry(m,sym,eqval,neval)

def curry(func, *args):
"""
Curry multiple arguments:
See: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/229472
"""
def curried(*args2):
args2 = args + args2
return func(*args2)
return curried
]]

and a test case:
[[
def testFilter02(self):
fullstr = "  "
trimstr = list(stripXmlComments(fullstr))
expstr  = list("  ")
assert trimstr==expstr, \
   "stripSpaces, expected:\n"+expstr+"\nFound:\n"+trimstr
]]

In thinking about this implementation, it seemed to me that this employed
patterns characteristic of a monadic type:  each entry in the state table (in
this case, an instance of match1, a curried function) is like a step in a
monadic computation, updating the monadic value and also returning some value.

What I can't quite visualize is if the code in Python would actually look any
better if it were implemented with a monadic type, as one might readily choose
for a Haskell implementation.  Or would there be no real benefit?

I have noticed that, while I like to use functional idioms in some of my Python
code, and the Python language is easily able to support these (even some lazy
evaluation, courtesy of generators), that the code doesn't always look as clean
as its Haskell equivalent.  In Haskell, composition and currying are fundamental
patterns and are directly supported by the syntax.  In Python, one has to work
harder to achieve these (e.g. the "curry" function above seems rather convoluted
to me, for such a fundamental notion).

Thoughts? Comments?

#g

-- 
Graham Klyne
For email:
http://www.ninebynine.org/#Contact

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


  1   2   3   4   >