[Haskell-cafe] Re: iteratee: Do I need to roll my own?

2010-03-31 Thread Valery V. Vorotyntsev
 I'm looking at iteratee as a way to replace my erroneous and really
 inefficient lazy-IO-based backend for an expect like Monad DSL I've
 been working for about 6 months or so now on and off.

 The problem is I want something like:

 expect some String
 send some response

 to block or perhaps timeout, depending on the environment, looking for
 some String on an input Handle, and it appears that iteratee works
 in a very fixed block size.

Actually, it doesn't. It works with what enumerator gives him.
In case of `enum_fd'[1] this is a fixed block, but generally this is
a ``value'' of some ``collection''[2].  And it is up to programmer to
decide of what should become a value.

  [1] http://okmij.org/ftp/Haskell/Iteratee/IterateeM.hs
  [2] http://okmij.org/ftp/papers/LL3-collections-enumerators.txt

 While a fixed block size is ok, if I can put back unused bytes into
 the enumerator somehow (I may need to put a LOT back in some cases,
 but in the common case I will not need to put any back as most
 expect-like scripts typically catch the last few bytes of data sent
 before the peer is blocked waiting for a response...)

I don't quite get this ``last few bytes'' thing. Could you explain?

I was about writing that there is no problem with putting data back to
Stream, and referring to head/peek functions...  But then I thought,
that the ``not consuming bytes from stream'' approach may not work
well in cases, when the number of bytes needed (by your function to
accept/reject some rule) exceeds the size of underlying memory buffer
(4K in current version of `iteratee' library[3]).

  [3] 
http://hackage.haskell.org/packages/archive/iteratee/0.3.4/doc/html/src/Data-Iteratee-IO-Fd.html

Do you think that abstracting to the level of _tokens_ - instead of
bytes - could help here? (Think of flex and bison.)  You know, these
enumerators/iteratees things can be layered into
_enumeratees_[1][4]... It's just an idea.

  [4] http://ianen.org/articles/understanding-iteratees/

 Otherwise, I'm going to want to roll my own iteratee style library
 where I have to say NotDone howMuchMoreIThinkINeed so I don't over
 consume the input stream.

What's the problem with over-consuming a stream? In your case?

BTW, this `NotDone' is just a ``control message'' to the chunk
producer (an enumerator):

IE_cont k (Just (GimmeThatManyBytes n))

 Does that even make any sense?  I'm kind of brainstorming in this
 email unfortunately :-)

What's the problem with brainstorming? :)

Cheers.

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


Re: [Haskell-cafe] cabal through PHPProxy

2010-03-31 Thread Valery V. Vorotyntsev
 i'm using PHPProxy to go on the internet (www.phpproxy.fr).
 How can i tell cabal to use this?
...
 PHPProxy is a web based proxy.  To use it, you have to type the http
 address you want in a field on the page.

You still need some web access in order to access a web-based proxy...
Is www.phpproxy.fr the only outer site you can connect directly to?

I am just curious of what kind of LAN you have got. :) How do you
update your OS, anyway? How do you download files?

* * *

Try the following:

# Download phpproxy
wget -c 'http://idea.hosting.lv/a/phpproxy/phpproxy-0.6.tar.gz'

# Unpack
tar -xzf phpproxy-0.6.tar.gz

# Launch PHPProxy client
cd phpproxy-0.6
python phpproxy.py

# In another terminal, try running cabal with `http_proxy'
http_proxy=http://localhost:8080/ cabal update --verbose=3

Please, report your progress.

Good luck!

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


Re: [Haskell-cafe] Takusen and iteratee problem

2010-03-20 Thread Valery V. Vorotyntsev
 Today I stuck with the following problem: I want to read a file with
 iteratee package, and but it to database through Takusen package, but
 it doesn't work. The `Takusen` was built with `mtl` package, and
 `iteratee` - with `transformers`, so they are conflicting when used
 simultaneously.

And what error message is displayed?

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


Re: [Haskell-cafe] Cabal update problem

2010-02-19 Thread Valery V. Vorotyntsev
 after updating to cabal-install-0.8.0/Cabal-1.8.0.2 with GHC 6.10.4, I
 always get an error when updating the package list:

    cabal update
   Downloading the latest package list from hackage.haskell.org
   cabal: Codec.Compression.Zlib: premature end of compressed stream

Would you please send the output of `cabal update -v3' command?

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


Re: [Haskell-cafe] Iteratee, parsec co.

2010-02-09 Thread Valery V. Vorotyntsev
| 3. Why Seek FileOffset is error message?

Are you talking about John Lato's implementation [1]?

Well, `Seek' is not an error message. It is one of constructors for
ErrMsg, and ErrMsg is [2]

 ---- a message to the stream producer (e.g., to rewind the stream)
 --   or an error indication.

You know the overall idea behind Seek, don't you?  It is an instrument
to implement random IO [3].


Compare Oleg's code [4]

 data SeekException = SeekException FileOffset
   deriving Show

 instance Typeable SeekException where
 typeOf _ = mkTyConApp (mkTyCon SeekException) []

 instance Exception SeekException

and [2]

 type ErrMsg = SomeException
 data Stream el = EOF (Maybe ErrMsg) | Chunk [el] deriving Show

with John Lato's implementation [1]:

 data StreamG c el =
   EOF (Maybe ErrMsg)
   | Chunk (c el)

 data ErrMsg = Err String
   | Seek FileOffset
   deriving (Show, Eq)

John makes Err and Seek to be the distinct constructors of ErrMsg.
Errors (Err) in `iteratee' package are always Strings.

Oleg's ErrMsg is SomeException.  One of its instances (SeekException)
is a ``rewind the stream'' message to the stream producer. And the user
is free to have as many different ErrMsg'es as he needs to do the job.

  [1] http://inmachina.net/~jwlato/haskell/iteratee/src/Data/Iteratee/Base.hs
  [2] http://okmij.org/ftp/Haskell/Iteratee/IterateeM.hs
  [3] http://okmij.org/ftp/Streams.html#random-bin-IO
  [4] http://okmij.org/ftp/Haskell/Iteratee/RandomIO.hs

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


Re: [Haskell-cafe] safe lazy IO or Iteratee?

2010-02-05 Thread Valery V. Vorotyntsev
 John Lato jwl...@gmail.com wrote:

 Both designs appear to offer similar performance in aggregate,
 although there are differences for particular functions.  I haven't
 yet had a chance to test the performance of the CPS variant, although
 Oleg has indicated he expects it will be higher.

@jwlato:
Do you mind creating `IterateeCPS' tree in
http://inmachina.net/~jwlato/haskell/iteratee/src/Data/, so we can
start writing CPS performance testing code?

AFAICS, you have benchmarks for IterateeM-driven code already:
http://inmachina.net/~jwlato/haskell/iteratee/tests/benchmarks.hs


John Millikin jmilli...@gmail.com wrote:

 I wrote some criterion benchmarks for IterateeM vs IterateeCPS, and
 the CPS version was notably slower. I don't understand enough about
 CPS to diagnose why, but the additional runtime was present in even
 simple cases (reading from a file, writing back out).

@jmillikin:
Could you please publish those benchmarks?

Thanks.

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


Re: [Haskell-cafe] mtl and transformers

2010-01-11 Thread Valery V. Vorotyntsev
Bas van Dijk v.dijk@gmail.com wrote:
 I always make a ghci.sh bash script in each of my projects that calls
 ghci -hide-all-packages -package x -package y -package z. However a
 cabal ghci or cabal interactive command that does this
 automatically would be ideal. I see there already is a ticket[1] about
 it.

 regards,
 Bas

 [1] http://hackage.haskell.org/trac/hackage/ticket/382


Shell script can be replaced with .ghci file.  See
http://neilmitchell.blogspot.com/2010/01/using-ghci-files-to-run-projects.html

(Just my two cents.)

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


Re: [Haskell-cafe] mtl and transformers

2010-01-10 Thread Valery V. Vorotyntsev
 Günther Schmidt:

 Could not find module `Control.Monad.Trans':
  it was found in multiple packages: transformers-0.1.4.0
  mtl-1.1.0.2

 Ivan Lazar Miljenovic:

 There's a way of specifying it at the top of whichever file you're
 using, but so far my workaround in this situation is to use ghc-pkg
 hide on whichever of those packages I don't use in my code.

Günther Schmidt:

 ghc-pkg hide works fine, thanks!

As an alternative, you can use `LANGUAGE PackageImports' pragma:

| {-# LANGUAGE PackageImports #-}
|
| import transformers Control.Monad.Trans

See
http://thread.gmane.org/gmane.comp.lang.haskell.libraries/12134/focus=12155

PS: Have fun with iteratees!

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


Re: [Haskell-cafe] Continuable and serializable parsers.

2009-12-25 Thread Valery V. Vorotyntsev
Serguey Zefirov sergu...@gmail.com wrote:

 1) How to write a parser that could be restarted? Like, it will be
 represented by a function that returns something along the lines

 data ParseStepResult input result =
Success (Maybe (input - ParseStepResult input result)) (Maybe result)
  | Failure

 (ie, parsers using stream combinators like Fudgets have that property)
 ie, either a continuation of parsing process and result or failure flag.

I think you're looking for `iteratees'.

| newtype IterateeG c el m a
|   = IterateeG {runIter :: StreamG c el - m (IterGV c el m a)}
|
| data IterGV c el m a
|   = Done a (StreamG c el) | Cont (IterateeG c el m a) (Maybe ErrMsg)
|
| data StreamG c el = EOF (Maybe ErrMsg) | Chunk (c el)

See
http://okmij.org/ftp/Streams.html
http://hackage.haskell.org/package/iteratee

See also
http://www.haskell.org/haskellwiki/Enumerator_and_iteratee
http://therning.org/magnus/archives/735/comment-page-1#comment-188128
http://comonad.com/reader/2009/iteratees-parsec-and-monoid/
http://inmachina.net/~jwlato/haskell/iter-audio/

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


[Haskell-cafe] changelogs for packages on Hackage

2009-12-16 Thread Valery V. Vorotyntsev
It would be nice if Hackage displayed ``recent changes'' of a package.
[severity: wishlist]

You see, I am subscribed to the ``hackage - recent additions'' feed
[http://hackage.haskell.org/packages/archive/recent.rss] and receive
entries that look like this:

Cabal 1.8.0.2
Added by DuncanCoutts, Wed Dec 16 04:19:24 UTC 2009.
A framework for packaging Haskell software

This is sweet.  But how can I tell what's new in Cabal since 1.6.0.3?
(`Cabal' is just an example here.)

* * *  -- these are snowflakes

Dear Santa,

This year, I have been a very good boy (in his thirties).  I have not
pillaged, and I have often helped my children with their homework. And
I always say `thank you', which makes me polite and so I deserve lots
of presents this year!

Please bring this stuff for me and the people in Haskell community.

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


Re: [Haskell-cafe] changelogs for packages on Hackage

2009-12-16 Thread Valery V. Vorotyntsev
 Valery V. Vorotyntsev wrote:

 It would be nice if Hackage displayed ``recent changes'' of a package.
 [severity: wishlist]

 You see, I am subscribed to the ``hackage - recent additions'' feed
 [http://hackage.haskell.org/packages/archive/recent.rss] and receive
 entries that look like this:

 Cabal 1.8.0.2
 Added by DuncanCoutts, Wed Dec 16 04:19:24 UTC 2009.
 A framework for packaging Haskell software

 This is sweet.  But how can I tell what's new in Cabal since 1.6.0.3?
 (`Cabal' is just an example here.)


Duncan Coutts duncan.cou...@googlemail.com wrote:

 Yep it's a fair point.

 http://hackage.haskell.org/trac/hackage/ticket/299

 Some packages have a changelog file in them that we could display,
 though most don't. For those that do have a changelog, how we avoid
 displaying all of history is a bit tricky. For those that do not,
 ideally we could derive a changelog by looking at the difference in the
 API. The latter requires a tool we've not written yet.


We could mimic Debian's approach.

Debian policy requires changelogs of standard format. [1]

These changelogs are updated with debchange(1) tool and can be parsed
with parsechangelog(1p). [2,3]

See example. [4]

  [1] http://www.debian.org/doc/debian-policy/ch-source.html#s-dpkgchangelog
  [2] http://manpages.debian.net/cgi-bin/man.cgi?query=debchange
  [3] http://manpages.debian.net/cgi-bin/man.cgi?query=parsechangelog
  [4] http://packages.debian.org/changelogs/pool/main/x/xterm/current/changelog

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


[Haskell-cafe] Re: Iteratee question

2009-11-26 Thread Valery V. Vorotyntsev
On Thu, Nov 26, 2009 at 10:17 AM,  o...@okmij.org wrote:
 You are correct: i2 and i3 can process a chunk of elements at a time,
 if an enumerator supplies it. That means an iteratee like i2 or i3 can
 do more work per invocation -- which is always good. Since you have to
 get the results as a list, you pretty much have to use stream2list. It
 should be noted that stream2list isn't very efficient: it returns the
 accumulated list only when it is done -- which happens when the stream
 is terminated, normally or abnormally. So, stream2list has a terrible
 latency, and is useful only at the last stage of processing. I found
 it is most useful for testing (to see the resulting stream) and for
 writing Unit tests (to compare the produced results with the
 expected). For incremental processing, it is better to stay within
 Iteratees.

 Although I think i2 and i3 should be close in performance (only
 benchmarking can tell for sure, of course), i3 is more extensible
 because stream2list is at the end of the chain. If later on further
 processing is required (or, the latency imposed by stream2list becomes
 noticeable), the chain can be easily extended. The advantage of the
 arrangement of i3 is that if some Iteratee further down the chain
 decided that it has had enough (elements), Iter.take can quickly skip
 the remaining elements without the need to convert them.

Thanks for clarification!

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


[Haskell-cafe] Re: Iteratee question

2009-11-26 Thread Valery V. Vorotyntsev
On Fri, Nov 27, 2009 at 4:04 AM, John Lato jwl...@gmail.com wrote:
 My apologies for not replying; I have been traveling and am only now
 working through my email.

 Oleg's response is much better than anything I would have written.
 I'd like to add one point.

 stream2list is very inefficient as he mentioned, however only for
 large values of 'n'.  For small n it should be fine.  Assuming you're
 using Word8 elements, small means  4096.  This is because the
 default chunk size reading from a file is 2048 elements, so for any n
  4096 you have at most two concatenations in producing the
 stream2list.

 Sincerely,
 John Lato

 PS for one example of a binary data parser, please see
 http://inmachina.net/~jwlato/haskell/iter-audio/

 This is similar to the audio codec included with iteratee, but much
 more efficient.  In particular, the functions convFunc and
 unroller in Sound.Iteratee.Codecs.Common are pretty highly
 optimized.

Wonderful!  Sample code is very helpful to get familiar with iteratees.

Thank you, John. Thanks to both of you.

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


Re: [Haskell-cafe] haskell-mode.el mailing list (+ dpatch)

2009-11-25 Thread Valery V. Vorotyntsev
On Wed, Nov 25, 2009 at 10:37 AM, Svein Ove Aas svein@aas.no wrote:
 http://trac.haskell.org/haskellmode-emacs/
 http://projects.haskell.org/cgi-bin/mailman/listinfo/haskellmode-emacs

Hurray!
Thanks, Svein.

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


[Haskell-cafe] haskell-mode.el mailing list (+ dpatch)

2009-11-24 Thread Valery V. Vorotyntsev
Is there anybody except me feeling the need for mailing list and issue
tracker for emacs' haskell-mode?

Mailing list is a forum to discuss ideas _and_ the area of patch
authors' self-advertisement. And issue tracker is a TODO list; it may
be useful or annoying, and I think we can live without one for a
while.

But I vote for haskell-mode.el mailing list.

Examples:
  http://www.haskell.org/mailman/listinfo/xmonad
  http://code.google.com/p/xmonad/issues/list

-- Description of the attached dpatch:
  * make `inferior-haskell-find-project-root' respect export lists

  A hierarchical module (one or more dots in module name) with an
  export list cannot be loaded (`C-c C-l') unless there is .cabal file
  available.

  That is because regexp current in `inferior-haskell-find-project-root'
  does not match module headers with export lists. Like this one:

  module Codec.Binary.MSCP (
  -- * Data structures
  FileHeader(..),
  CDR(..),

  -- * Parsing
  readFile
) where

  This patch makes the regexp less strict.

Have fun!

--
vvv
#part type=application/octet-stream 
filename=/tmp/XXX/respect-export-lists.dpatch disposition=attachment 
description=respect-export-lists.dpatch
#/part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: haskell-mode.el mailing list (+ dpatch)

2009-11-24 Thread Valery V. Vorotyntsev
 -- Description of the attached dpatch:
  * make `inferior-haskell-find-project-root' respect export lists

No joke this time. Sorry for the glitch.

-- 
vvv
Tue Nov 24 23:48:05 EET 2009  Valery V. Vorotyntsev valery...@gmail.com
  * make `inferior-haskell-find-project-root' respect export lists
  
  A hierarchical module (one or more dots in module name) with an
  export list cannot be loaded (`C-c C-l') unless there is .cabal file
  available.
  
  That is because regexp current in `inferior-haskell-find-project-root'
  does not match module headers with export lists. Like this one:
  
  module Codec.Binary.MSCP (
  -- * Data structures
  FileHeader(..),
  CDR(..),
  
  -- * Parsing
  readFile
) where
  
  This patch makes the regexp less strict.

New patches:

[make `inferior-haskell-find-project-root' respect export lists
Valery V. Vorotyntsev valery...@gmail.com**20091124214805
 Ignore-this: 13944cebba542b12a6b02a7c8ef43c81
 
 A hierarchical module (one or more dots in module name) with an
 export list cannot be loaded (`C-c C-l') unless there is .cabal file
 available.
 
 That is because regexp current in `inferior-haskell-find-project-root'
 does not match module headers with export lists. Like this one:
 
 module Codec.Binary.MSCP (
 -- * Data structures
 FileHeader(..),
 CDR(..),
 
 -- * Parsing
 readFile
   ) where
 
 This patch makes the regexp less strict.
] hunk ./inf-haskell.el 285
 (goto-char (point-min))
 (let ((case-fold-search nil))
   (when (re-search-forward
- ^module[ \t]+\\([^- \t\n]+\\.[^- \t\n]+\\)[ \t]+where\\ nil t)
+ ^module[ \t]+\\([^- \t\n]+\\.[^- \t\n]+\\)[ \t]+ nil t)
 (let* ((dir default-directory)
(module (match-string 1))
(pos 0))

Context:

[Emacs regexes are not perl regexes!
svein@aas.no**20091120123455
 Ignore-this: 7adddfb072ffabb8e02457fd9f1d7179
] 
[Add missing `:group's to defcustoms.
Dave Love f...@gnu.org**2009105701
 Ignore-this: c5126608a89343c907e6a03f77143a82
] 
[Resolve conflict with mdo patch.
Dave Love f...@gnu.org**20091110143208
 Ignore-this: 48568e05d3b1d48d5a3c8014e5287fe3
] 
[Allow non-ASCII names.
Dave Love f...@gnu.org**20091105212057
 Ignore-this: f46f407a19ae2a597f44317e4915e5ba
 The code already used char-classes unconditionally, though I didn't
 think they're supported in XEmacs.
] 
[Various fixes for Emacs 21.
Dave Love f...@gnu.org**20091105211507
 Ignore-this: caae466ff29882fa42f44e081d0a8909
] 
[Fix treatment of missing syntax-ppss.
Dave Love f...@gnu.org**2009111819
 Ignore-this: 284f4d7440592d4b7f4697d1bf2483c7
] 
[Comment/doc/message fixes.
Dave Love f...@gnu.org**20091105212607
 Ignore-this: 15a2aa347da042465d652328b91324a1
] 
[Parse the unicode syntax for (::)
vandijk.r...@gmail.com**20091106085644
 Ignore-this: f4d582279acbaf613b5d77b6788c8189
] 
[Fixed bug in haskell-decl-scan.el when using unicode syntax
vandijk.r...@gmail.com**2009110615
 Ignore-this: 6e8eecb8bd1d7d5ddfc0496bee4d4f3f
] 
[Indent mdo as do
svein@aas.no**20091109214749
 Ignore-this: 8cf3b448fcde1d8219c4c97ba1955c85
] 
[TAG 2.6.4
svein@aas.no**20091107110901
 Ignore-this: d2d4c16df56f5bb4b749e886a99e0550
] 
Patch bundle hash:
db4c47fb09199c61b1611bfbb46a9e0277c82c0a
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Iteratee question

2009-11-20 Thread Valery V. Vorotyntsev
I am writing a binary data parser and use `iteratee' package.
The following pattern appears quite often in my code:

 results - map someConversion `liftM` replicateM nbytes Iter.head

The meaning is: take `nbytes' from stream, apply `someConversion' to
every byte and return the list of `results'.

But there's more than one way to do it[1]:

 i1, i2, i3 :: Monad m = Int - IterateeG [] Word8 m [String]
 i1 n = map conv `liftM` replicateM n Iter.head
 i2 n = map conv `liftM` joinI (Iter.take n stream2list)
 i3 n = joinI $ Iter.take n $ joinI $ mapStream conv stream2list

  [1] http://en.wikipedia.org/wiki/There's_more_than_one_way_to_do_it

If you try the program[2] I've hpasted, you will see that these three
iteratees have equal results.

  [2] http://hpaste.org/fastcgi/hpaste.fcgi/view?id=12464#a12464

Of those i1, i2, i3 which one is better and why? Or is there another -
preferable - way of applying iteratees to this task?

My naïve guess is that i1 will have worse performance with big n's. It
looks like `i1' is reading bytes one by one, while `i2' takes whole
chunks of data... I'm not sure though.

I would appreciate it a lot if you improve my understanding.

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


[Haskell-cafe] Fwd: cabal-install sends invalid proxy password

2008-12-17 Thread Valery V. Vorotyntsev
Hello,

 I was surprised to discover that `cabal-install' -- a popular utility
 for installing Hackage packages -- cannot work with HTTP proxies.
 Despite all the necessary code linked in.

 `cabal update' command returns HTTP 407 (Proxy Authentication Required)
 error.  The problem is explained below and patches follow.

See http://article.gmane.org/gmane.comp.lang.haskell.libraries/10420

No response so far. (I start to suspect that there is just one
proxied haskeller subscribed to `libraries' and `cabal-dev' lists:)

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


[Haskell-cafe] Re: Arrow without `'

2008-01-24 Thread Valery V. Vorotyntsev
On 1/23/08, David Menendez [EMAIL PROTECTED] wrote:
 On Jan 23, 2008 12:20 PM, Valery V. Vorotyntsev [EMAIL PROTECTED] wrote:
  I've built GHC from darcs, and...
  Could anybody tell me, what's the purpose of Arrow[1] not having `'
  method?

 It's derived from the Category superclass.

Yes, it is.

The right question: how to build `arrows' in such circumstances?

Here go 2 changes I made to `CoState.hs' accompanied by the
error messages. :) Unfortunately, I'm not arrow-capable enough to
make _proper_ changes to the code and satisfy GHC... Any help?

~~
Change #1:

$ darcs w Control/Arrow/Transformer/CoState.hs
What's new in Control/Arrow/Transformer/CoState.hs:

{
hunk ./Control/Arrow/Transformer/CoState.hs 23
+import Control.Category (())
}

--
Error #1:

Control/Arrow/Transformer/CoState.hs:29:7:
`' is not a (visible) method of class `Arrow'
Failed, modules loaded: Control.Arrow.Operations.

~~
Change #2:

$ darcs diff -u Control/Arrow/Transformer/CoState.hs
--- old-arrows/Control/Arrow/Transformer/CoState.hs 2008-01-24
14:54:29.852296559 +0200
+++ new-arrows/Control/Arrow/Transformer/CoState.hs 2008-01-24
14:54:29.852296559 +0200
@@ -20,12 +20,13 @@

 import Control.Arrow
 import Control.Arrow.Operations
+import Control.Category (())

  newtype CoStateArrow s a b c = CST (a (s - b) (s - c))

  instance Arrow a = Arrow (CoStateArrow s a) where
arr f = CST (arr (f .))
-   CST f  CST g = CST (f  g)
+-- CST f  CST g = CST (f  g)
first (CST f) = CST (arr unzipMap  first f  arr zipMap)

  zipMap :: (s - a, s - b) - (s - (a,b))

--
Error#2:

Control/Arrow/Transformer/CoState.hs:27:0:
Could not deduce (Control.Category.Category (CoStateArrow s a))
  from the context (Arrow a)
  arising from the superclasses of an instance declaration
   at Control/Arrow/Transformer/CoState.hs:27:0
Possible fix:
  add (Control.Category.Category
 (CoStateArrow s a)) to the context of
the instance declaration
  or add an instance declaration for
 (Control.Category.Category (CoStateArrow s a))
In the instance declaration for `Arrow (CoStateArrow s a)'
Failed, modules loaded: Control.Arrow.Operations.

Thank you.

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


[Haskell-cafe] Fwd: Arrow without `'

2008-01-24 Thread Valery V. Vorotyntsev
The problem has been resolved.
Kudos to Ross Paterson.

-- Forwarded message --
From: Valery V. Vorotyntsev [EMAIL PROTECTED]
Date: Jan 24, 2008 3:34 PM
Subject: Re: Arrow without `'
To: [EMAIL PROTECTED]

On 1/24/08, Ross Paterson [EMAIL PROTECTED] wrote:
  The right question: how to build `arrows' in such circumstances?

 To build with the darcs version of the base library (built with GHC),
 you'll need the darcs version of the arrows library, which I think is
 right now:

 darcs get http://darcs.haskell.org/packages/arrows

Yes, after pulling the latest change from repo installation went smoothly.
Thank you very much, Ross!
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Arrow without `'

2008-01-23 Thread Valery V. Vorotyntsev
Hi, friends,

I've built GHC from darcs, and...
Could anybody tell me, what's the purpose of Arrow[1] not having `'
method?

  1. http://darcs.haskell.org/packages/base/Control/Arrow.hs

  $ ghci
  GHCi, version 6.9.20080104: http://www.haskell.org/ghc/  :? for help
  Loading package base ... linking ... done.
  Prelude :m + Control.Arrow
  Prelude Control.Arrow :i Arrow
  class (Control.Category.Category a) = Arrow a where
arr :: (b - c) - a b c
pure :: (b - c) - a b c
first :: a b c - a (b, d) (c, d)
second :: a b c - a (d, b) (d, c)
(***) :: a b c - a b' c' - a (b, b') (c, c')
() :: a b c - a b c' - a b (c, c')
  -- Defined in Control.Arrow
  instance Arrow (-) -- Defined in Control.Arrow
  instance (Monad m) = Arrow (Kleisli m) -- Defined in Control.Arrow
  Prelude Control.Arrow Leaving GHCi.

I can't build[2] arrows-0.3 package without `' in Arrow.

  2.
  [EMAIL PROTECTED]:~/src/arrows$ darcs w
  {
  hunk ./Control/Arrow/Operations.hs 36
  +import Control.Category (())
  hunk ./Control/Arrow/Transformer/CoState.hs 23
  +import Control.Category (())
  }
  [EMAIL PROTECTED]:~/src/arrows$ runhaskell Setup build
  Preprocessing library arrows-0.3...
  Building arrows-0.3...
  [ 3 of 12] Compiling Control.Arrow.Transformer.CoState (
Control/Arrow/Transformer/CoState.hs,
dist/build/Control/Arrow/Transformer/CoState.o )

  Control/Arrow/Transformer/CoState.hs:29:7:
  `' is not a (visible) method of class `Arrow'

The question arises should I?, but this is one of lambdabot's[3]
depencies.

  3. http://code.haskell.org/lambdabot/

Thanks a lot!

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


Re: [Haskell-cafe] Code folding in Emacs

2008-01-14 Thread Valery V. Vorotyntsev
On 1/14/08, Johan Tibell [EMAIL PROTECTED] wrote:
 It would be pretty neat for Haskell hacking if the Emacs Haskell mode
 could do the following. Imagine you have written some code like so:

 [...]

 Binding a haskell-fold-source function to a key chain would enable you
 to get a quick overview of your module showing only the comments and
 type signatures. I've used the little function from
 http://emacs.wordpress.com/2007/01/16/quick-and-dirty-code-folding/
 but it doesn't work well together with indented type signatures like
 in the example above.

AFAIU the problem, ..

data StupidTypeNameIntendedToBeLong =
Foo

functionWithLngName :: Foo
- Bar
functionWithLngName = undefined

.. you don't like the way haskell-mode indents the `- Bar' line.

If this is the case, you could `newline-and-indent' (`C-j') right
after `::'.

anotherFunctionWithLongName ::
Foo - Bar
anotherFunctionWithLongName = undefined

And what's this haskell-fold-source function you were talking about?

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


Re: [Haskell-cafe] Literate HTML

2007-12-11 Thread Valery V. Vorotyntsev
On 12/11/07, Neil Mitchell [EMAIL PROTECTED] wrote:
 I couldn't get it working either, so have raised a feature request bug.

Which has been merged into #1232:
  http://hackage.haskell.org/trac/ghc/ticket/1967#comment:1

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


[Haskell-cafe] Re: emacs haskellers: r-stripping files becomes popular

2007-11-16 Thread Valery V. Vorotyntsev
On 11/16/07, Valery V. Vorotyntsev [EMAIL PROTECTED] wrote:
 Add the following lines to your ~/.emacs:

Adding buffer name to confirmation message:

--- BEGIN ---
(defun delete-trailing-whitespace-if-confirmed ()
  Delete all the trailing whitespace across the current buffer,
asking user for confirmation.
  (if (and
   (save-excursion (goto-char (point-min))
   (re-search-forward [[:space:]]$ nil t))
   (y-or-n-p (format Delete trailing whitespace from %s?  (buffer-name
  (delete-trailing-whitespace)))
--- END ---

 (add-hook 'before-save-hook 'delete-trailing-whitespace-if-confirmed)

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


Re: [Haskell-cafe] emacs haskellers: r-stripping files becomes popular

2007-11-16 Thread Valery V. Vorotyntsev
On 11/16/07, Denis Bueno [EMAIL PROTECTED] wrote:
 For one thing, if you happen to write code shared with other people
 who do not use this hook, then you may end up causing *huge* numbers
 of spurious differences in diff(1) output.  There may be an easy way
 to deal with this, but, it is a problem.

Yes, you are right. That's why user is being asked for confirmation.
And `diff -w' removes the noise, but still, yes, that can be a problem.

:)

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


Re: [Haskell-cafe] emacs haskellers: r-stripping files becomes popular

2007-11-16 Thread Valery V. Vorotyntsev
On 11/16/07, Brent Yorgey [EMAIL PROTECTED] wrote:
 Nice!  Is there a way to have this only run if the current buffer is in
 haskell-mode?  I'd add it myself but I've not yet taken the plunge to being
 an elisp hacker.

Try adding ``(eq major-mode 'haskell-mode)'' after the `and' ..
.. but why would you tolerate whitespace in other modes?

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


[Haskell-cafe] emacs haskellers: r-stripping files becomes popular

2007-11-16 Thread Valery V. Vorotyntsev
Add the following lines to your ~/.emacs:

--- BEGIN OF ELISP CODE ---
;(global-set-key (kbd f9 s) 'delete-trailing-whitespace)

(defun delete-trailing-whitespace-if-confirmed ()
  Delete all the trailing whitespace across the current buffer,
asking user for confirmation.
  (if (and (save-excursion (goto-char (point-min))
   (re-search-forward [[:space:]]$ nil t))
   (y-or-n-p Delete trailing whitespace? ))
  (delete-trailing-whitespace)))

(add-hook 'before-save-hook 'delete-trailing-whitespace-if-confirmed)
--- END OF ELISP CODE ---

Have fun!

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


Re: [Haskell-cafe] ANN: Math.OEIS 0.1

2007-10-22 Thread Valery V. Vorotyntsev
On 10/22/07, Henning Thielemann [EMAIL PROTECTED] wrote:

 Cute!

+1

http://programming.reddit.com/info/5yuhf/comments/

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


Re: [Haskell-cafe] On the verge of ... giving up!

2007-10-19 Thread Valery V. Vorotyntsev
On 10/19/07, Valery V. Vorotyntsev [EMAIL PROTECTED] wrote:
 On 10/19/07, Johan Tibell [EMAIL PROTECTED] wrote:
 
  If you have a web server somewhere you can use CGIIRC. That's what I
  did in a similar situation.
 
  http://cgiirc.org/

 Thanks, Johan!

There is one at http://ircatwork.com/
And now I'm in. Thank you very much. :)

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


Re: [Haskell-cafe] On the verge of ... giving up!

2007-10-19 Thread Valery V. Vorotyntsev
On 10/18/07, Don Stewart [EMAIL PROTECTED] wrote:

 Please drop by the irc channel! enthusiasm is always welcome there, and
 we're pretty much all obsessed too!

Maybe that's not The Right Thing(TM) to ask, but anyway. :)

My access the world outside the office's LAN is limited to ports 80 and 443.
And chat.freenode.net lives on 6667.

Once upon a time I could access #haskell via IRC gateway @ irc.e.jabber.ru,
but not know, for the reasons unknown.

Do you know of any 443:server, forwarding connections to chat.freenode.net:6667?

Thanks a lot.

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


Re: [Haskell-cafe] 'Proper' use of the State monad

2007-05-03 Thread Valery V. Vorotyntsev
Denis Volk [EMAIL PROTECTED] writes:

 I am trying to make a (turn-based) game in Haskell and need to pass
 around quite a bit of information, so using the State monad seems most
 appropriate. My question is, which is a better idea:

Have you read `Theseus and the Zipper'[1] yet?

  1. http://en.wikibooks.org/wiki/Haskell/Zippers

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


Re: [Haskell-cafe] Why Perl is more learnable than Haskell

2007-04-12 Thread Valery V. Vorotyntsev
Dave Feustel [EMAIL PROTECTED] writes:

 A serious omission in Haskell tutorials is a collection of examples of how to 
 write Haskell solutions for problems that would use arrays in any imperative 
 language.
 I see that arrays can be defined in Haskell, but I don't see their use as
 computationally efficient in Haskell.

By replacing the string type with our ByteString representation,
Haskell is able to approach the speed of C, while still retaining the
elegance of the idiomatic implementation. With stream fusion enabled,
it actually beats the original C program. Only by sacrificing clarity
and explicitly manipulating mutable blocks is the C program able to
outperform Haskell.
- http://www.cse.unsw.edu.au/~dons/papers/CSL06.html

The ability to fuse all common list functions allows the programmer
to write in an elegant declarative style, and still produce excellent
low level code. We can finally write the code we *want* to be able to
write without sacrificing performance!
- http://www.cse.unsw.edu.au/~dons/papers/CLS07.html

Don't give up.
;-)

-vvv
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [OT] Re: [Haskell-cafe] Tricks for making low level haskell hacking easier

2007-03-05 Thread Valery V. Vorotyntsev
Mathieu Boespflug [EMAIL PROTECTED] writes:

 On 2/10/07, Donald Bruce Stewart [EMAIL PROTECTED] wrote:
 metachars). A screenshot:

 http://www.cse.unsw.edu.au/~dons/tmp/screen-core.png

 Just out of curiosity, what window manager is that?

 Mathieu

Looks like ratpoison.
  http://www.nongnu.org/ratpoison/

But give Ion3 a try. You'll love it.
  http://modeemi.cs.tut.fi/~tuomov/ion/
  http://tinyurl.com/25sd9f

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