[Haskell-cafe] Memory leak in streaming parser

2007-04-03 Thread Oren Ben-Kiki

I refactored the code and uploaded a new version to Hackage
(YamlReference-0.2). It is cleaner now and much more efficient. It is
still "leaking" memory though. The profiler hints at "bindReply" as
the culprit retaining State and Reply objects, but it isn't clear to
me why the code would do that. Trying to `seq` things again either
kills streaming or has no effect. Perhaps my basic approach is
wrong...

Any advice would be appreciated,

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


[Haskell-cafe] ANN: Atom - Yet another Haskell HDL

2007-04-03 Thread Tom Hawkins

Hi,

Haskell has a rich history of embedded hardware description languages.
Here's one more for the list.

Inspired by the work of Arvind, Hoe, and all the sharp folks at
Bluespec, Atom is a small HDL that compiles conditional term rewriting
systems down to Verilog RTL.  In Atom, a circuit description is
composed of a set of state elements (registers) and a set of rules.
Each rule has two components: an enabling condition and a collection
of actions, or state updates.  When a rule is enabled, it's actions
may be selected to execute atomically.  In contrast to Verilog
"always" blocks, multiple rules can write to the same state element.

Here's an enabled counter in Atom:

counter :: Int -> Signal -> System Signal
counter width enable = do
 count <- reg "count" width 0
 rule "updateCount" $ do
   when enable
   count <== value count +. one width
 return $ value count

Enjoy!

 http://funhdl.org/

-Tom


A few details:  The Atom compiler attempts to maximize the number of
rules that can execute in a given clock cycle without breaking the
semantics of "one-rule-at-a-time".  For simplicity, rules are assigned
a global, linear priority.  Data dependencies between rules form a
graph.  A acyclic graph is ideal, because all rules become
"sequentially composable".  The compiler attempts to order the rules
to minimize the number of edges feeding back from lower to higher
priority rules.  This is equivalent to the feedback arc set problem.
(Atom's FAS optimization is pretty poor at the moment.)

In a rule-data dependency graph, many of the edges are irrelevent
because pairs of rules are often mutually exclusive, ie. can not be
enabled at the same time.  MiniSat is used to hunt and prune edges
from mutually exclusive rules.  By only looking back to primary inputs
and registers, the SAT procedure is not guaranteed to find all
mutually exclusive rules, but it does a pretty good job.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] `Expect'-like lazy reading/Parsec matching on TCP sockets

2007-04-03 Thread Bulat Ziganshin
Hello Scott,

Wednesday, April 4, 2007, 1:54:27 AM, you wrote:

> Match the Parsec parser against the input as soon as a match
> is available, but fail if the match is unavailable after a timeout
> value if no further data is available on the socket.

one possible solution: use Streams library and establish a stream
transformer that adds an error call on timeout. something like this:

data StreamWithTimeout s = StreamWithTimeout s Timeout

instance Stream s => Stream (StreamWithTimeout s) where
  vGetChar (StreamWithTimeout s t) = do
 timeout t (vGetChar s)
   (error "Timed out!")

then you can use standard vGetContents lazy string reading in order to
get expected behaviour

or, even simple, you can make your own variant of hGetContents which
adds a timeout checks before each next call to hGetChar or hGetBuf

-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]

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


[Haskell-cafe] `Expect'-like lazy reading/Parsec matching on TCP sockets

2007-04-03 Thread Scott Bell

Hello all,

I'm writing an application to interact with other applications
remotely though TCP sockets (primarily), and in the future
with local apps also.

So far I have a Parsec parser to match the input that I want
to see, which works if the remote connection is particularly
speedy - but the final goal is to obtain the following behavior:

Match the Parsec parser against the input as soon as a match
is available, but fail if the match is unavailable after a timeout
value if no further data is available on the socket.

The parser will be matching some input pattern such as
(string "login:"), for example.

What's the best approach to take while leveraging laziness if
possible?

Thanks,

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


Re: [Haskell-cafe] SmallCheck and parser testing

2007-04-03 Thread Paul Johnson

On Tue, 3 Apr 2007 16:01:56 +0100
Joel Reymont <[EMAIL PROTECTED]> wrote:

Folks,

I'm trying to figure out how to test a Parsec-based parser with  
Smallcheck [1]. My test AST is below and the goal is to return  
StyleValue  if the parser is fed an integer, or return  
Solid when parsing "Solid", etc.
  

data Style
 = StyleValue Expr
 | Solid
 | Dashed
 | Dotted
 | Dashed2
 | Dashed3
 deriving Show
I'd use QuickCheck rather than SmallCheck.  First write Arbitrary 
instances for Style and Expr (plus obviously any other types used by 
Expr).  Then write another generator that converts a Style to a string 
with random formatting (whitespace, comments etc).  Then assert that the 
parse of the generated string is equal to the original value.


You might also want to write another string generator that also inserts 
random syntax errors, so you can test for the correct detection of 
syntax errors.


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


Re: [Haskell-cafe] SmallCheck and parser testing

2007-04-03 Thread Spencer Janssen
On Tue, 3 Apr 2007 16:01:56 +0100
Joel Reymont <[EMAIL PROTECTED]> wrote:

> Folks,
> 
> I'm trying to figure out how to test a Parsec-based parser with  
> Smallcheck [1]. My test AST is below and the goal is to return  
> StyleValue  if the parser is fed an integer, or return  
> Solid when parsing "Solid", etc.
> 
> data Style
>  = StyleValue Expr
>  | Solid
>  | Dashed
>  | Dotted
>  | Dashed2
>  | Dashed3
>  deriving Show
> 
> I figure that the following is needed somehow:
> 
> instance Serial Style where
>  series = cons1 StyleValue . depth 0
>   \/ cons0 Solid
>   \/ cons0 Dashed
>   \/ cons0 Dashed2
>   \/ cons0 Dashed3
>   \/ cons0 Dotted
> 
> My parser is 'style', so I would be passing it as p below
> 
> run p input =
>  case (parse p "" input) of
>Left err -> do { putStr "parse error at "
>   ; print err
>   }
>Right x -> x
> 
> How do I go from here to making sure my parser is valid?

There are several ways to check your parser.  If you have a pretty
printer, you can check that the parse of a pretty printed term is equal
to the term itself.

\begin{code}
parseEq :: String -> Style -> Bool
parseEq s t = case parse style "" s of
   Left err -> False
   Right x  -> x == t

prop_parsePretty t = parseEq (pretty t) t
\end{code}

You can also use a unit-testing style.  Imagine you have a list of
strings and the correct parse trees for each.  You can then check that
the parses match the expected results.

\begin{code}
knownParses :: [(String, Style)]
knownParses = ???

prop_unitTest = all (uncurry parseEq) knownParses
\end{code}


Cheers,
Spencer Janssen


> I thought of the following property (thanks sjanssen)
> 
> prop_parse p s =
>  show (run p s) == s
> 
> 
> but I don't know how to proceed from here.
> 
>   Thanks, Joel
> 
> [1] http://www.cs.york.ac.uk/fp/darcs/smallcheck/
> 
> --
> http://wagerlabs.com/
> 
> 
> 
> 
> 
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] RE: A question about functional dependencies and existential quantification

2007-04-03 Thread Simon Peyton-Jones
| > > class T root pos sel | pos -> root, root -> sel where
| > >f :: pos -> sel -> Bool
| > >
| > > instance T root (Any root) sel where
| > >f (ANY p) s = f p s
...
| That is not surprising. What is surprising is why GHC 6.6 accepts such
| an instance?

Well, it shouldn't.  As the user manual says, the flag 
-fallow-undecidable-instances lifts *both* the Paterson Conditions *and* the 
Coverage condition.  I stupidly forgot that the Coverage Condition is needed 
both to help guarantee termination, and to help guarantee confluence (as our 
own paper says!).  Losing the latter is more serious, and should not be an 
effect of -fallow-undecidable-instances.

This is the same issue as
http://hackage.haskell.org/trac/ghc/ticket/1241

What to do?
- Never lift the Coverage Condition
- Give it a flag all to itself -fno-coverage-condition
- Combine it with -fallow-incoherent-instances

More work is
- Implement some of the more liberal coverage conditions
described in the paper

Simon

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


[Haskell-cafe] SmallCheck and parser testing

2007-04-03 Thread Joel Reymont

Folks,

I'm trying to figure out how to test a Parsec-based parser with  
Smallcheck [1]. My test AST is below and the goal is to return  
StyleValue  if the parser is fed an integer, or return  
Solid when parsing "Solid", etc.


data Style
= StyleValue Expr
| Solid
| Dashed
| Dotted
| Dashed2
| Dashed3
deriving Show

I figure that the following is needed somehow:

instance Serial Style where
series = cons1 StyleValue . depth 0
 \/ cons0 Solid
 \/ cons0 Dashed
 \/ cons0 Dashed2
 \/ cons0 Dashed3
 \/ cons0 Dotted

My parser is 'style', so I would be passing it as p below

run p input =
case (parse p "" input) of
  Left err -> do { putStr "parse error at "
 ; print err
 }
  Right x -> x

How do I go from here to making sure my parser is valid?

I thought of the following property (thanks sjanssen)

prop_parse p s =
show (run p s) == s


but I don't know how to proceed from here.

Thanks, Joel

[1] http://www.cs.york.ac.uk/fp/darcs/smallcheck/

--
http://wagerlabs.com/





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


Re: [Haskell-cafe] Mathematics in Haskell Re: Why the Prelude must die

2007-04-03 Thread Henning Thielemann

On Tue, 3 Apr 2007, Jason Morton wrote:

> NumericPrelude does seem like a good starting point for discussion and
> addition.  Is it still being actively developed,

slowly but actively

> and what are the goals there?

A more sophisticated numeric type class hierarchy. However it contains
also some algorithms, because we have to test if the hierarchy indeed
works.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Mathematics in Haskell Re: Why the Prelude must die

2007-04-03 Thread Jason Morton

NumericPrelude does seem like a good starting point for discussion and
addition.  Is it still being actively developed, and what are the
goals there?

On 4/3/07, Henning Thielemann <[EMAIL PROTECTED]> wrote:


On Mon, 2 Apr 2007, jasonm wrote:

> Jacques Carette wrote:
> >
> >> perhaps i was mistaken in thinking that there is a group of
> >> math-interested
> >> haskellers out there discussing, developing, and documenting the area? or
> >> perhaps that group needs introductory tutorials presenting its work?
> > My guess is that there are a number of people "waiting in the wings",
> > waiting for a critical mass of features to show up before really diving
> > in.  See
> > http://www.cas.mcmaster.ca/plmms07/
> > for my reasons for being both interested and wary).
> >
> > Probably the simplest test case is the difficulties that people are
> > (still) encountering doing matrix/vector algebra in Haskell.  One either
> > quickly encounters efficiency issues (although PArr might help), or
> > typing issues (though many tricks are known, but not necessarily
> > simple).  Blitz++ and the STL contributed heavily to C++ being taken
> > seriously by people in the scientific computation community.  Haskell
> > has even more _potential_, but it is definitely unrealised potential.
>
> I am one of those mathematicians "waiting in the wings."  Haskell looked
> very appealing at first, and the type system seems perfect, especially for
> things like multilinear algebra where currying and duality is fundamental.
> I too was put off by the Num issues though--strange mixture of sophisticated
> category theory and lack of a sensible hierarchy of algebraic objects.
>
> However, I've decided I'm more interested in helping to fix it than wait;
> so count me in on an effort to make Haskell more mathematical.  For me that
> probably starts with the semigroup/group/ring setup, and good
> arbitrary-precision as well as approximate linear algebra support.

NumericPrelude popped up in this thread earlier. Is this the starting
point you are after?
 http://darcs.haskell.org/numericprelude/


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


Re: [Haskell-cafe] Re: ANN: HSH 1.2.0

2007-04-03 Thread Thomas Hartman

resolved issue at

http://groups.google.de/group/fa.haskell/browse_thread/thread/ceabae2c3fdc8abc/5ab21d4ae2a9b1fc?lnk=st&q=hsh++tphyahoo&rnum=5&hl=en#5ab21d4ae2a9b1fc

2007/4/2, Thomas Hartman <[EMAIL PROTECTED]>:

Well, I guess I spoke to soon. After building ghc6 from feisty as
described above, I tried building missingh and have basically what I
started with.

Is there something I can tweak to get the above straightened out using
those nice deb packages, or do I have to do all the dependency chasing
involved with building from source? Or is there another way?

If this is too debian oriented please yell at me and I will ask about
this on a deb/ubuntu forum.

thanks...

Note, should have mentioned, after doing as my above post describes, I
installed all the newly generated deb packages with

dpkg -i *.deb



[EMAIL PROTECTED]:~/haskellInstalls/missingh>runghc Setup.hs configure
Configuring MissingH-0.18.3...
configure: /usr/lib/ghc-6.6/bin/ghc-pkg
configure: Dependency unix-any: using unix-1.0
Setup.hs: cannot satisfy dependency network-any

[EMAIL PROTECTED]:~/haskellInstalls/missingh>which runghc
/usr/lib/ghc-6.6/bin/runghc

# note, definitely the thing I installed today:
[EMAIL PROTECTED]:~/haskellInstalls/missingh>ls -l `which runghc`
-rwxr-xr-x 1 root root 300716 Apr  2 09:17 /usr/lib/ghc-6.6/bin/runghc
[EMAIL PROTECTED]:~/haskellInstalls/missingh>

# and I installed it from deb ghc6, dpkg recognizes it

[EMAIL PROTECTED]:~/haskellInstalls/missingh>dpkg -S
/usr/lib/ghc-6.6/bin/runghc
ghc6: /usr/lib/ghc-6.6/bin/runghc

# it does seem like ghc6 comes with a network package
[EMAIL PROTECTED]:~/learning/haskell>apt-cache showpkg ghc6 | grep -i network
6.4.1-2ubuntu2 - libghc6-readline-dev libghc6-stm-dev libghc6-hgl-dev
libghc6-x11-dev libghc6-fgl-dev libghc6-mtl-dev libghc6-hunit-dev
libghc6-quickcheck-dev libghc6-network-dev libghc6-haskell-src-dev
libghc6-parsec-dev libghc6-cabal-dev libghc6-unix-dev
libghc6-template-haskell-dev libghc6-haskell98-dev libghc6-base-dev
libghc6-rts-dev ghc haskell-compiler

# I get lost here. Do I have libghc6-network-dev, or don't I?

[EMAIL PROTECTED]:~/haskellInstalls/missingh>sudo apt-get install
libghc6-network-dev
Reading package lists... Done
Building dependency tree... Done
Note, selecting ghc6 instead of libghc6-network-dev
ghc6 is already the newest version.
You might want to run `apt-get -f install' to correct these:
The following packages have unmet dependencies:
  hat-ghc6: Depends: ghc6 (< 6.4.1+) but 6.6-3 is to be installed
  libghc6-cabal-dev: Depends: ghc6 (< 6.4.2) but 6.6-3 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or
specify a solution).






2007/4/2, Thomas Hartman <[EMAIL PROTECTED]>:
> > As you have built ghc6.6 from sources I think that you also need to build
> > all haskell libs from sources. So, do
>
> I did this, and got the feeling this would probably work, but is a
> real sad world of dependency chasing with no (clear) end in sight.
>
> So I investigated your second suggestion
>
> > Another way is to take ghc6 and all haskell libs from fiesty.
>
> which to me seems much preferrable.
>
> http://old.pupeno.com/blog/unstable-packages-on-ubuntu/
>
> Was indispensible in helping me figure out how to do this.
>
> To give some details on this (which is really more apt packaging know
> how than haskell but whatever), I did something like
>
> 1) change /etc/apt/sources.list to add
>
> deb-src http://archive.ubuntu.com/ubuntu/ feisty main restricted
> universe multiverse
>
> note, only add deb-src line here, not deb line, see article above for why.
>
> sudo aptitude install fakeroot (needed utility)
> fakeroot apt-get source --build ghc6
>   -- complains, some dependencies are missing
>
> sudo aptitude install .
>  install packages with above command, not from source. it's my first
> time using the aptitude command, I wonder if this does the same thing
> as apt-get install, which is what I usually do. Whatever the case...
>
> fakeroot apt-get source --build ghc6
>
> works :)
>
> 2007/3/21, Max Vasin <[EMAIL PROTECTED]>:
> > > "Thomas" == Thomas Hartman <[EMAIL PROTECTED]> writes:
> >
> > Thomas> Furthermore (as the above messages suggest and locate confirms), I
> > Thomas> seem to have mtl already
> >
> > Thomas> I took a wild guess and tried specifying this with ghc -i
> >
> > Thomas> like
> >
> > Thomas> sudo runghc -i/usr/lib/ghc6-mtl-dev Setup.lhs configure
> > Thomas> and sudo runghc -i/usr/lib/ Setup.lhs configure
> >
> > Thomas> but no dice.
> >
> > Thomas> ***
> >
> > Thomas> [EMAIL PROTECTED]:~/haskellInstalls/hsh$ locate libghc6-mtl-dev
> > Thomas> /home/thartman/libghc6-mtl-dev_1.0-3_i386.deb
> > Thomas> /usr/lib/libghc6-mtl-dev
> > Thomas> /usr/lib/libghc6-mtl-dev/register.sh
> > Thomas> /usr/lib/libghc6-mtl-dev/unregister.sh
> > Thomas> /usr/share/doc/libghc6-mtl-dev
> > Thomas> /usr/share/doc/libghc6-mtl-dev/changelog.Debian.gz
> > Thomas> /usr/share/doc/li

[Haskell-cafe] Re: was Re: ANN: HSH 1.2.0

2007-04-03 Thread Thomas Hartman

never mind.

Prelude HSH> run $ ("ls", ["."]) :: IO String
"COPYING\nCOPYRIGHT\nHSH\nHSH.cabal\nHSH.hi\nHSH.hs\nHSH.o\nINSTALL\nMakefile\nSetup.hi\nSetup.lhs\nSetup.o\n_darcs\ndebian\ndist\nsetup\ntest.hs\ntest2.hs\ntestsrc\n"

I guess I got it installed.

Only thing is you (jgoerzen) might want to change

http://changelog.complete.org/posts/492-Announcing-HSH,-the-Haskell-Shell.html

to include the type example, or explain why sometimes you need it
sometimes no. (I'm guessing this just has to do with which version of
the module you're using.)

Finally looking forward to playing with my new toy :)

2007/4/3, Thomas Hartman <[EMAIL PROTECTED]>:

actually, maybe I'm more okay than I thought.

I originally did this without reading the INSTALL file, and built
using the process I have gotten used to: runghc Setup.hs configure;
runghc Setup.hs build; runghc Setup.hs install.

But when I followed the directions in the INSTALL file ...

  make setup

Now:

 ./setup configure
 ./setup build
 ./setup install

... it seemed to work without that error message.

So far so good!

I was also able to do

[EMAIL PROTECTED]:~/haskellinstalls/hsh> ghci HSH
   ___ ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |  GHC Interactive, version 6.6, for Haskell 98.
/ /_\\/ __  / /___| |  http://www.haskell.org/ghc/
\/\/ /_/\/|_|  Type :? for help.

Loading package base ... linking ... done.
Ok, modules loaded: HSH, HSH.Command, HSH.ShellEquivs.
Prelude HSH>

however, when I tried copying a simple example from

  http://changelog.complete.org/posts/492-Announcing-HSH,-the-Haskell-Shell.html

I got errors

[EMAIL PROTECTED]:~/haskellinstalls/hsh>ghci -fglasgow-exts HSH
   ___ ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |  GHC Interactive, version 6.6, for Haskell 98.
/ /_\\/ __  / /___| |  http://www.haskell.org/ghc/
\/\/ /_/\/|_|  Type :? for help.

Loading package base ... linking ... done.
Ok, modules loaded: HSH, HSH.Command, HSH.ShellEquivs.
Prelude HSH> run $ ("ls", ["."])

:1:0:
Ambiguous type variable `a' in the constraint:
  `RunResult a' arising from use of `run' at :1:0-2
Probable fix: add a type signature that fixes these type variable(s)
Prelude HSH>

So, that's where I'm at now.

2007/4/3, Thomas Hartman <[EMAIL PROTECTED]>:
> That was a pretty badly titled top thead, which I regret -- probably
> should have been something like "figuring out how to track down and
> install packages in haskell, using ubuntu /deb-- was Ann:: HSH".
>
> To give additional context, this started out as
>
> 
http://groups.google.de/group/fa.haskell/browse_thread/thread/ca37248eae7a065f/d039de2f9bf6e848?lnk=st&q=hsh+tphyahoo&rnum=1&hl=en#d039de2f9bf6e848
>
> Sorry about the bad title.
>
> Still hoping to get hsh working, though for me this has more morphed
> into learning about package and dependency chasing in a haskell/deb
> context.
>
>
> 2007/4/3, Thomas Hartman <[EMAIL PROTECTED]>:
> > I'm still trying to figure out how to do this on ubuntu. If this winds
> > up being a garden path I'll try on debian next, but at least I'm
> > learning a lot about getting haskell stuff built.
> >
> > Anyway, since I'm on a virtualized linux box, I decided to get a fresh
> > start, unmounted my original OS profile and installed a fresh dapper
> > 6.
> >
> > I then changed /etc/apt/sources.list to be okay for grabbing .debs
> > from feisty. (No longer doing the build from source thing.)
> >
> > apt-get install ghc6, ok from feisty.
> >   (Is there another repo that gets all the extra libs at one go?)
> >
> > sudo apt-cache search -o APT::Cache-Limit=25165824 ghc6 | grep -i missing
> >
> > libghc6-hdbc-missingh-dev - Integration of HDBC with MissingH, GHC version
> > libghc6-missingh-dev - Library of utility functions for Haskell, GHC6 
package
> > [EMAIL PROTECTED]:~/haskellinstalls/hsh>sudo apt-cache search -o
> >
> > hoorah, my apt cache search command seems ok.
> >
> >
> > sudo apt-cache search -o APT::Cache-Limit=25165824 ghc6 | grep -i hsh
> > [EMAIL PROTECTED]:~/haskellinstalls/hsh>
> >
> > too bad, still no hsh in ubuntu repo.
> >
> > darcs get http://darcs.complete.org/hsh/
> >   (Or should I have used something else?)
> >
> > runghc Setup.hs configure
> >   same problems as before.
> >
> > But starting afresh seems to have detangled the issues I was having
> > with packaging confusion. At least now I can apt-get install missingh
> >
> > And some other dependency following is made easier.
> >
> > Finally configure for hsh works.
> >
> > But then
> >
> > [EMAIL PROTECTED]:~/haskellinstalls/hsh>sudo runghc Setup.lhs install
> > Setup.lhs: Warning: The field "hs-source-dir" is deprecated, please
> > use hs-source-dirs.
> > Installing: /usr/local/lib/HSH-1.2.1/ghc-6.6 & /usr/local/bin HSH-1.2.1...
> > Setup.lhs: Error: Could not find module: HSH with any suffix: ["hi"]
> >
> > So, I seem to be stuck at this point.
> >
> > 2007/4/2, Thomas Hartman <[EMAIL PROTECTED]>:
> > > Well, I g

[Haskell-cafe] Re: was Re: ANN: HSH 1.2.0

2007-04-03 Thread Thomas Hartman

actually, maybe I'm more okay than I thought.

I originally did this without reading the INSTALL file, and built
using the process I have gotten used to: runghc Setup.hs configure;
runghc Setup.hs build; runghc Setup.hs install.

But when I followed the directions in the INSTALL file ...

 make setup

Now:

./setup configure
./setup build
./setup install

... it seemed to work without that error message.

So far so good!

I was also able to do

[EMAIL PROTECTED]:~/haskellinstalls/hsh> ghci HSH
  ___ ___ _
 / _ \ /\  /\/ __(_)
/ /_\// /_/ / /  | |  GHC Interactive, version 6.6, for Haskell 98.
/ /_\\/ __  / /___| |  http://www.haskell.org/ghc/
\/\/ /_/\/|_|  Type :? for help.

Loading package base ... linking ... done.
Ok, modules loaded: HSH, HSH.Command, HSH.ShellEquivs.
Prelude HSH>

however, when I tried copying a simple example from

 http://changelog.complete.org/posts/492-Announcing-HSH,-the-Haskell-Shell.html

I got errors

[EMAIL PROTECTED]:~/haskellinstalls/hsh>ghci -fglasgow-exts HSH
  ___ ___ _
 / _ \ /\  /\/ __(_)
/ /_\// /_/ / /  | |  GHC Interactive, version 6.6, for Haskell 98.
/ /_\\/ __  / /___| |  http://www.haskell.org/ghc/
\/\/ /_/\/|_|  Type :? for help.

Loading package base ... linking ... done.
Ok, modules loaded: HSH, HSH.Command, HSH.ShellEquivs.
Prelude HSH> run $ ("ls", ["."])

:1:0:
   Ambiguous type variable `a' in the constraint:
 `RunResult a' arising from use of `run' at :1:0-2
   Probable fix: add a type signature that fixes these type variable(s)
Prelude HSH>

So, that's where I'm at now.

2007/4/3, Thomas Hartman <[EMAIL PROTECTED]>:

That was a pretty badly titled top thead, which I regret -- probably
should have been something like "figuring out how to track down and
install packages in haskell, using ubuntu /deb-- was Ann:: HSH".

To give additional context, this started out as

http://groups.google.de/group/fa.haskell/browse_thread/thread/ca37248eae7a065f/d039de2f9bf6e848?lnk=st&q=hsh+tphyahoo&rnum=1&hl=en#d039de2f9bf6e848

Sorry about the bad title.

Still hoping to get hsh working, though for me this has more morphed
into learning about package and dependency chasing in a haskell/deb
context.


2007/4/3, Thomas Hartman <[EMAIL PROTECTED]>:
> I'm still trying to figure out how to do this on ubuntu. If this winds
> up being a garden path I'll try on debian next, but at least I'm
> learning a lot about getting haskell stuff built.
>
> Anyway, since I'm on a virtualized linux box, I decided to get a fresh
> start, unmounted my original OS profile and installed a fresh dapper
> 6.
>
> I then changed /etc/apt/sources.list to be okay for grabbing .debs
> from feisty. (No longer doing the build from source thing.)
>
> apt-get install ghc6, ok from feisty.
>   (Is there another repo that gets all the extra libs at one go?)
>
> sudo apt-cache search -o APT::Cache-Limit=25165824 ghc6 | grep -i missing
>
> libghc6-hdbc-missingh-dev - Integration of HDBC with MissingH, GHC version
> libghc6-missingh-dev - Library of utility functions for Haskell, GHC6 package
> [EMAIL PROTECTED]:~/haskellinstalls/hsh>sudo apt-cache search -o
>
> hoorah, my apt cache search command seems ok.
>
>
> sudo apt-cache search -o APT::Cache-Limit=25165824 ghc6 | grep -i hsh
> [EMAIL PROTECTED]:~/haskellinstalls/hsh>
>
> too bad, still no hsh in ubuntu repo.
>
> darcs get http://darcs.complete.org/hsh/
>   (Or should I have used something else?)
>
> runghc Setup.hs configure
>   same problems as before.
>
> But starting afresh seems to have detangled the issues I was having
> with packaging confusion. At least now I can apt-get install missingh
>
> And some other dependency following is made easier.
>
> Finally configure for hsh works.
>
> But then
>
> [EMAIL PROTECTED]:~/haskellinstalls/hsh>sudo runghc Setup.lhs install
> Setup.lhs: Warning: The field "hs-source-dir" is deprecated, please
> use hs-source-dirs.
> Installing: /usr/local/lib/HSH-1.2.1/ghc-6.6 & /usr/local/bin HSH-1.2.1...
> Setup.lhs: Error: Could not find module: HSH with any suffix: ["hi"]
>
> So, I seem to be stuck at this point.
>
> 2007/4/2, Thomas Hartman <[EMAIL PROTECTED]>:
> > Well, I guess I spoke to soon. After building ghc6 from feisty as
> > described above, I tried building missingh and have basically what I
> > started with.
> >
> > Is there something I can tweak to get the above straightened out using
> > those nice deb packages, or do I have to do all the dependency chasing
> > involved with building from source? Or is there another way?
> >
> > If this is too debian oriented please yell at me and I will ask about
> > this on a deb/ubuntu forum.
> >
> > thanks...
> >
> > Note, should have mentioned, after doing as my above post describes, I
> > installed all the newly generated deb packages with
> >
> > dpkg -i *.deb
> >
> > 
> >
> > [EMAIL PROTECTED]:~/haskellInstalls/missingh>runghc Setup.hs configure
> > Configuring MissingH-0.18.3...
> > confi

[Haskell-cafe] Re: was Re: ANN: HSH 1.2.0

2007-04-03 Thread Thomas Hartman

That was a pretty badly titled top thead, which I regret -- probably
should have been something like "figuring out how to track down and
install packages in haskell, using ubuntu /deb-- was Ann:: HSH".

To give additional context, this started out as

http://groups.google.de/group/fa.haskell/browse_thread/thread/ca37248eae7a065f/d039de2f9bf6e848?lnk=st&q=hsh+tphyahoo&rnum=1&hl=en#d039de2f9bf6e848

Sorry about the bad title.

Still hoping to get hsh working, though for me this has more morphed
into learning about package and dependency chasing in a haskell/deb
context.


2007/4/3, Thomas Hartman <[EMAIL PROTECTED]>:

I'm still trying to figure out how to do this on ubuntu. If this winds
up being a garden path I'll try on debian next, but at least I'm
learning a lot about getting haskell stuff built.

Anyway, since I'm on a virtualized linux box, I decided to get a fresh
start, unmounted my original OS profile and installed a fresh dapper
6.

I then changed /etc/apt/sources.list to be okay for grabbing .debs
from feisty. (No longer doing the build from source thing.)

apt-get install ghc6, ok from feisty.
  (Is there another repo that gets all the extra libs at one go?)

sudo apt-cache search -o APT::Cache-Limit=25165824 ghc6 | grep -i missing

libghc6-hdbc-missingh-dev - Integration of HDBC with MissingH, GHC version
libghc6-missingh-dev - Library of utility functions for Haskell, GHC6 package
[EMAIL PROTECTED]:~/haskellinstalls/hsh>sudo apt-cache search -o

hoorah, my apt cache search command seems ok.


sudo apt-cache search -o APT::Cache-Limit=25165824 ghc6 | grep -i hsh
[EMAIL PROTECTED]:~/haskellinstalls/hsh>

too bad, still no hsh in ubuntu repo.

darcs get http://darcs.complete.org/hsh/
  (Or should I have used something else?)

runghc Setup.hs configure
  same problems as before.

But starting afresh seems to have detangled the issues I was having
with packaging confusion. At least now I can apt-get install missingh

And some other dependency following is made easier.

Finally configure for hsh works.

But then

[EMAIL PROTECTED]:~/haskellinstalls/hsh>sudo runghc Setup.lhs install
Setup.lhs: Warning: The field "hs-source-dir" is deprecated, please
use hs-source-dirs.
Installing: /usr/local/lib/HSH-1.2.1/ghc-6.6 & /usr/local/bin HSH-1.2.1...
Setup.lhs: Error: Could not find module: HSH with any suffix: ["hi"]

So, I seem to be stuck at this point.

2007/4/2, Thomas Hartman <[EMAIL PROTECTED]>:
> Well, I guess I spoke to soon. After building ghc6 from feisty as
> described above, I tried building missingh and have basically what I
> started with.
>
> Is there something I can tweak to get the above straightened out using
> those nice deb packages, or do I have to do all the dependency chasing
> involved with building from source? Or is there another way?
>
> If this is too debian oriented please yell at me and I will ask about
> this on a deb/ubuntu forum.
>
> thanks...
>
> Note, should have mentioned, after doing as my above post describes, I
> installed all the newly generated deb packages with
>
> dpkg -i *.deb
>
> 
>
> [EMAIL PROTECTED]:~/haskellInstalls/missingh>runghc Setup.hs configure
> Configuring MissingH-0.18.3...
> configure: /usr/lib/ghc-6.6/bin/ghc-pkg
> configure: Dependency unix-any: using unix-1.0
> Setup.hs: cannot satisfy dependency network-any
>
> [EMAIL PROTECTED]:~/haskellInstalls/missingh>which runghc
> /usr/lib/ghc-6.6/bin/runghc
>
> # note, definitely the thing I installed today:
> [EMAIL PROTECTED]:~/haskellInstalls/missingh>ls -l `which runghc`
> -rwxr-xr-x 1 root root 300716 Apr  2 09:17 /usr/lib/ghc-6.6/bin/runghc
> [EMAIL PROTECTED]:~/haskellInstalls/missingh>
>
> # and I installed it from deb ghc6, dpkg recognizes it
>
> [EMAIL PROTECTED]:~/haskellInstalls/missingh>dpkg -S
> /usr/lib/ghc-6.6/bin/runghc
> ghc6: /usr/lib/ghc-6.6/bin/runghc
>
> # it does seem like ghc6 comes with a network package
> [EMAIL PROTECTED]:~/learning/haskell>apt-cache showpkg ghc6 | grep -i network
> 6.4.1-2ubuntu2 - libghc6-readline-dev libghc6-stm-dev libghc6-hgl-dev
> libghc6-x11-dev libghc6-fgl-dev libghc6-mtl-dev libghc6-hunit-dev
> libghc6-quickcheck-dev libghc6-network-dev libghc6-haskell-src-dev
> libghc6-parsec-dev libghc6-cabal-dev libghc6-unix-dev
> libghc6-template-haskell-dev libghc6-haskell98-dev libghc6-base-dev
> libghc6-rts-dev ghc haskell-compiler
>
> # I get lost here. Do I have libghc6-network-dev, or don't I?
>
> [EMAIL PROTECTED]:~/haskellInstalls/missingh>sudo apt-get install
> libghc6-network-dev
> Reading package lists... Done
> Building dependency tree... Done
> Note, selecting ghc6 instead of libghc6-network-dev
> ghc6 is already the newest version.
> You might want to run `apt-get -f install' to correct these:
> The following packages have unmet dependencies:
>   hat-ghc6: Depends: ghc6 (< 6.4.1+) but 6.6-3 is to be installed
>   libghc6-cabal-dev: Depends: ghc6 (< 6.4.2) but 6.6-3 is to be installed
> E: Unmet dependencies. Try 'apt-get -f install' wit

[Haskell-cafe] was Re: ANN: HSH 1.2.0

2007-04-03 Thread Thomas Hartman

I'm still trying to figure out how to do this on ubuntu. If this winds
up being a garden path I'll try on debian next, but at least I'm
learning a lot about getting haskell stuff built.

Anyway, since I'm on a virtualized linux box, I decided to get a fresh
start, unmounted my original OS profile and installed a fresh dapper
6.

I then changed /etc/apt/sources.list to be okay for grabbing .debs
from feisty. (No longer doing the build from source thing.)

apt-get install ghc6, ok from feisty.
 (Is there another repo that gets all the extra libs at one go?)

sudo apt-cache search -o APT::Cache-Limit=25165824 ghc6 | grep -i missing

libghc6-hdbc-missingh-dev - Integration of HDBC with MissingH, GHC version
libghc6-missingh-dev - Library of utility functions for Haskell, GHC6 package
[EMAIL PROTECTED]:~/haskellinstalls/hsh>sudo apt-cache search -o

hoorah, my apt cache search command seems ok.


sudo apt-cache search -o APT::Cache-Limit=25165824 ghc6 | grep -i hsh
[EMAIL PROTECTED]:~/haskellinstalls/hsh>

too bad, still no hsh in ubuntu repo.

darcs get http://darcs.complete.org/hsh/
 (Or should I have used something else?)

runghc Setup.hs configure
 same problems as before.

But starting afresh seems to have detangled the issues I was having
with packaging confusion. At least now I can apt-get install missingh

And some other dependency following is made easier.

Finally configure for hsh works.

But then

[EMAIL PROTECTED]:~/haskellinstalls/hsh>sudo runghc Setup.lhs install
Setup.lhs: Warning: The field "hs-source-dir" is deprecated, please
use hs-source-dirs.
Installing: /usr/local/lib/HSH-1.2.1/ghc-6.6 & /usr/local/bin HSH-1.2.1...
Setup.lhs: Error: Could not find module: HSH with any suffix: ["hi"]

So, I seem to be stuck at this point.

2007/4/2, Thomas Hartman <[EMAIL PROTECTED]>:

Well, I guess I spoke to soon. After building ghc6 from feisty as
described above, I tried building missingh and have basically what I
started with.

Is there something I can tweak to get the above straightened out using
those nice deb packages, or do I have to do all the dependency chasing
involved with building from source? Or is there another way?

If this is too debian oriented please yell at me and I will ask about
this on a deb/ubuntu forum.

thanks...

Note, should have mentioned, after doing as my above post describes, I
installed all the newly generated deb packages with

dpkg -i *.deb



[EMAIL PROTECTED]:~/haskellInstalls/missingh>runghc Setup.hs configure
Configuring MissingH-0.18.3...
configure: /usr/lib/ghc-6.6/bin/ghc-pkg
configure: Dependency unix-any: using unix-1.0
Setup.hs: cannot satisfy dependency network-any

[EMAIL PROTECTED]:~/haskellInstalls/missingh>which runghc
/usr/lib/ghc-6.6/bin/runghc

# note, definitely the thing I installed today:
[EMAIL PROTECTED]:~/haskellInstalls/missingh>ls -l `which runghc`
-rwxr-xr-x 1 root root 300716 Apr  2 09:17 /usr/lib/ghc-6.6/bin/runghc
[EMAIL PROTECTED]:~/haskellInstalls/missingh>

# and I installed it from deb ghc6, dpkg recognizes it

[EMAIL PROTECTED]:~/haskellInstalls/missingh>dpkg -S
/usr/lib/ghc-6.6/bin/runghc
ghc6: /usr/lib/ghc-6.6/bin/runghc

# it does seem like ghc6 comes with a network package
[EMAIL PROTECTED]:~/learning/haskell>apt-cache showpkg ghc6 | grep -i network
6.4.1-2ubuntu2 - libghc6-readline-dev libghc6-stm-dev libghc6-hgl-dev
libghc6-x11-dev libghc6-fgl-dev libghc6-mtl-dev libghc6-hunit-dev
libghc6-quickcheck-dev libghc6-network-dev libghc6-haskell-src-dev
libghc6-parsec-dev libghc6-cabal-dev libghc6-unix-dev
libghc6-template-haskell-dev libghc6-haskell98-dev libghc6-base-dev
libghc6-rts-dev ghc haskell-compiler

# I get lost here. Do I have libghc6-network-dev, or don't I?

[EMAIL PROTECTED]:~/haskellInstalls/missingh>sudo apt-get install
libghc6-network-dev
Reading package lists... Done
Building dependency tree... Done
Note, selecting ghc6 instead of libghc6-network-dev
ghc6 is already the newest version.
You might want to run `apt-get -f install' to correct these:
The following packages have unmet dependencies:
  hat-ghc6: Depends: ghc6 (< 6.4.1+) but 6.6-3 is to be installed
  libghc6-cabal-dev: Depends: ghc6 (< 6.4.2) but 6.6-3 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or
specify a solution).






2007/4/2, Thomas Hartman <[EMAIL PROTECTED]>:
> > As you have built ghc6.6 from sources I think that you also need to build
> > all haskell libs from sources. So, do
>
> I did this, and got the feeling this would probably work, but is a
> real sad world of dependency chasing with no (clear) end in sight.
>
> So I investigated your second suggestion
>
> > Another way is to take ghc6 and all haskell libs from fiesty.
>
> which to me seems much preferrable.
>
> http://old.pupeno.com/blog/unstable-packages-on-ubuntu/
>
> Was indispensible in helping me figure out how to do this.
>
> To give some details on this (which is really more apt packaging know
> how than haskell but whatever), I

Re: [Haskell-cafe] Josephus problem and style

2007-04-03 Thread Malcolm Wallace
Anthony Chaumas-Pellet <[EMAIL PROTECTED]> wrote:

> From: Ross Paterson <[EMAIL PROTECTED]>
> > You show a bias towards tail recursion.  It would be neater (and
> > lazier) to return the executed ones incrementally.
> 
> Why is tail recursion a bad thing for a finite function?

Tail recursion tends to create space-leaks, which in turn hurt time
performance.

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


Re: [Haskell-cafe] Re: Matlab/BLAS/LAPack

2007-04-03 Thread Henning Thielemann

On Tue, 3 Apr 2007, Ferenc Wagner wrote:

> "Alexander McPhail" <[EMAIL PROTECTED]> writes:
>
> > I am embarking on a project to bind to CBLAS and CLAPack.
>
> Do you know of http://www.cs.utah.edu/~hal/HBlas/index.html ?

... not to forget GSLHaskell and
 
http://www.haskell.org/haskellwiki/Libraries_and_tools/Mathematics#Linear_algebra
  at all.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Mathematics in Haskell Re: Why the Prelude must die

2007-04-03 Thread Henning Thielemann

On Mon, 2 Apr 2007, jasonm wrote:

> Jacques Carette wrote:
> >
> >> perhaps i was mistaken in thinking that there is a group of
> >> math-interested
> >> haskellers out there discussing, developing, and documenting the area? or
> >> perhaps that group needs introductory tutorials presenting its work?
> > My guess is that there are a number of people "waiting in the wings",
> > waiting for a critical mass of features to show up before really diving
> > in.  See
> > http://www.cas.mcmaster.ca/plmms07/
> > for my reasons for being both interested and wary).
> >
> > Probably the simplest test case is the difficulties that people are
> > (still) encountering doing matrix/vector algebra in Haskell.  One either
> > quickly encounters efficiency issues (although PArr might help), or
> > typing issues (though many tricks are known, but not necessarily
> > simple).  Blitz++ and the STL contributed heavily to C++ being taken
> > seriously by people in the scientific computation community.  Haskell
> > has even more _potential_, but it is definitely unrealised potential.
>
> I am one of those mathematicians "waiting in the wings."  Haskell looked
> very appealing at first, and the type system seems perfect, especially for
> things like multilinear algebra where currying and duality is fundamental.
> I too was put off by the Num issues though--strange mixture of sophisticated
> category theory and lack of a sensible hierarchy of algebraic objects.
>
> However, I've decided I'm more interested in helping to fix it than wait;
> so count me in on an effort to make Haskell more mathematical.  For me that
> probably starts with the semigroup/group/ring setup, and good
> arbitrary-precision as well as approximate linear algebra support.

NumericPrelude popped up in this thread earlier. Is this the starting
point you are after?
 http://darcs.haskell.org/numericprelude/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Matlab/BLAS/LAPack

2007-04-03 Thread Ferenc Wagner
"Alexander McPhail" <[EMAIL PROTECTED]> writes:

> I am embarking on a project to bind to CBLAS and CLAPack.

Do you know of http://www.cs.utah.edu/~hal/HBlas/index.html ?
-- 
Feri.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Josephus problem and style

2007-04-03 Thread Anthony Chaumas-Pellet
Thanks for your comments everyone! There is one point that has left me
puzzled, though.

From: Ross Paterson <[EMAIL PROTECTED]>
> You show a bias towards tail recursion.  It would be neater (and lazier)
> to return the executed ones incrementally.  This is easier if you don't
> distinguish the survivor from the rest, i.e. just put it on the end of
> the list.

Why is tail recursion a bad thing for a finite function? (Of course,
it would be... curious on functions that can produce infinite results)
Is tail recursion simply not the most common Haskell idiom, or is
there some technical reason I fail to see?

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


[Haskell-cafe] Fwd: darcs.haskell.org access for maths hierarchy

2007-04-03 Thread Alexander McPhail

I have set up a page on the wiki for discussion:

http://www.haskell.org/haskellwiki/Haskell_and_mathematics/Hierarchy

And about a darcs repo for people to patch against:

-- Forwarded message --
From: Simon Marlow <[EMAIL PROTECTED]>
Date: 03-Apr-2007 20:28
Subject: Re: darcs.haskell.org access for maths hierarchy
To: Alexander McPhail <[EMAIL PROTECTED]>

Hi there,

The plan is to set up a separate server for hosting community
projects.  Right
now we have the server, but we still have to set it up.  Hopefully it should
be
available soon, we'll announce something when it is.

Cheers,
   Simon

Alexander McPhail wrote:

Hi,

There is some movement on the haskell-cafe mailing list to set up a repo
to develop a mathematically sound algebraic class hierarchy.  I have
volunteered to coordinate this.

What is the policy on giving access to darcs.haskell.org
?
Cheers,

Vivian


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