[Haskell-cafe] REMINDER: Haskell Communities and Activities Report

2010-04-30 Thread Janis Voigtländer

Dear all,

It is not yet too late to contribute to the 18th edition of HCAR.

If you haven't already, please write an entry for your new project or
update your old entry, and send to me this weekend or early next week.

More information about format etc. can be found in the original call:

   http://www.haskell.org/pipermail/haskell/2010-April/022012.html

I am looking forward to receiving your contributions,

Janis (current editor)

--
Jun.-Prof. Dr. Janis Voigtländer
http://www.iai.uni-bonn.de/~jv/
mailto:j...@iai.uni-bonn.de
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] are forkIO threads event-driven?

2010-04-30 Thread Bulat Ziganshin
Hello Aran,

Friday, April 30, 2010, 2:26:20 AM, you wrote:

 In GHC, if a thread spawned by forkIO blocks on some network or
 disk IO, is the threading system smart enough not to wake the thread

afaik, yes. it's controlled by special i/o thread that multiplexes all
i/o done via stdlibs. but ghc i/o manager can't use epoll/kqueue so
it's appropriate only for small (or medium?) servers

read Writing High-Performance Server Applications in Haskell, Case
Study: A Haskell Web Server
http://www.haskell.org/~simonmar/papers/web-server.ps.gz




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

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


Re: [Haskell-cafe] are forkIO threads event-driven?

2010-04-30 Thread Don Stewart
bulat.ziganshin:
 Hello Aran,
 
 Friday, April 30, 2010, 2:26:20 AM, you wrote:
 
  In GHC, if a thread spawned by forkIO blocks on some network or
  disk IO, is the threading system smart enough not to wake the thread
 
 afaik, yes. it's controlled by special i/o thread that multiplexes all
 i/o done via stdlibs. but ghc i/o manager can't use epoll/kqueue so
 it's appropriate only for small (or medium?) servers

Look at the recent work on the event library and replacing the IO
manager.


http://www.serpentine.com/blog/2010/01/22/new-ghc-io-manager-first-benchmark-numbers/

There's much more background on the new code here,


http://www.serpentine.com/blog/2009/12/17/making-ghcs-io-manager-more-scalable/

and some nice benchmarks


http://blog.johantibell.com/2010/01/scalable-timeout-support-for-ghcs-io.html
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] maling-list manager in haskell?

2010-04-30 Thread Lars Kotthoff
Hi,

 I've just uploaded mhailist, a mailing list manager a friend and I started
working on a while ago, to hackage [1]. It's very much experimental and an alpha
release, but it does the job for some mailing lists we have.

We're also looking for people who'd like to join us developing it; if you're
interested then by all means let me know.

Thanks,

Lars


[1] http://hackage.haskell.org/package/Mhailist
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Using the Clipboard under Windows

2010-04-30 Thread Henk-Jan van Tuyl
On Fri, 30 Apr 2010 08:21:11 +0300, Jason Dagit da...@codersbase.com  
wrote:




As far as I can tell from google wxwidgets does have clipboard support.
 Perhaps wxHaskell can do it or needs to be extended?

Jason


I searched with Hayoo for
  clipboard wx
and found Graphics.UI.WXCore.Controls.execClipBoardData [1]; following  
links, I found a set of clipboard functions [2].


Regards,
Henk-Jan van Tuyl


[1]  
http://hackage.haskell.org/packages/archive/wxcore/latest/doc/html/Graphics-UI-WXCore-Controls.html#v:execClipBoardData
[2]  
http://hackage.haskell.org/packages/archive/wxcore/latest/doc/html/Graphics-UI-WXCore-WxcClassesAL.html#28


--
http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
--
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Haskell XML Parsers

2010-04-30 Thread R Senington

Dear all,

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

HST is the worst and about 7GB and climbing. HaXml uses 1.3Gb.

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

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


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


Cheers

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


Re: [Haskell-cafe] Haskell XML Parsers

2010-04-30 Thread Malcolm Wallace
I have been looking at using XML for a little program I have been  
writing. The file I am currently trying to load is about 9MB, and I  
have now tried to use
HaXml and HST. Without any of my own code, just a simple call to the  
basic parsers, they both use huge amount of memory.

HST is the worst and about 7GB and climbing. HaXml uses 1.3Gb.


Are you using Text.XML.HaXml.ParseLazy, or Text.XML.HaXml.Parse?  The  
lazy version should show much better space usage, provided your  
subsequent usage of the document is roughly a single-pass traversal.


Regards,
Malcolm

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


Re: [Haskell-cafe] Using the Clipboard under Windows

2010-04-30 Thread Günther Schmidt

Hello all,

the application from which I wish to copy (text) data to the clipboard 
is not a GUI app, it's more of a simple test-script.


So I'd like to do it without having to install wxHaskell. I guess I'll 
just have to bite my way through the Win32 API.


Right now I'm dumping the text output to a file and copy  paste from there.

Günther


Am 30.04.10 11:19, schrieb Henk-Jan van Tuyl:
On Fri, 30 Apr 2010 08:21:11 +0300, Jason Dagit da...@codersbase.com 
wrote:




As far as I can tell from google wxwidgets does have clipboard support.
 Perhaps wxHaskell can do it or needs to be extended?

Jason


I searched with Hayoo for
  clipboard wx
and found Graphics.UI.WXCore.Controls.execClipBoardData [1]; following 
links, I found a set of clipboard functions [2].


Regards,
Henk-Jan van Tuyl


[1] 
http://hackage.haskell.org/packages/archive/wxcore/latest/doc/html/Graphics-UI-WXCore-Controls.html#v:execClipBoardData 

[2] 
http://hackage.haskell.org/packages/archive/wxcore/latest/doc/html/Graphics-UI-WXCore-WxcClassesAL.html#28 



--
http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
--



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


Re: [Haskell-cafe] How to make way into a hadoop infrastructure

2010-04-30 Thread Mike Dillon
I think you'll want to look at the Hadoop Streaming or Hadoop Pipes API.

Further down the line, I think somebody will want to implement a Haskell
library to deal with the Avro serialization protocol when it becomes
possible to write non-JVM mappers and reducers directly. This JIRA issue
covers the RPC part of the Avro-Hadoop integration work:

https://issues.apache.org/jira/browse/HADOOP-6659

Looks like folks have already implemented support for Thrift and
Protocol Buffers, so implementing a library for Avro would likely be
pretty similar.

-md

begin C K Kashyap quotation:
 Dear Haskellers,
 
 A big part of my new job requires tuning app's on Hadoop. I was wondering if
 there is a way to push some Haskell code in the mix. I did some googling on
 Hadoop/Haskell and came across Holumbus - but looks like that is parallel
 to Hadoop.
 
 I was thinking in the lines of doing a Haskell implementation that could run
 in a Hadoop cluster - has anyone tried anything like that?
 
 -- 
 Regards,
 Kashyap

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

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


Re: [Haskell-cafe] Re: FRP for game programming / artifical life simulation

2010-04-30 Thread Antoine Latter
On Fri, Apr 30, 2010 at 3:37 AM, Daniel Fischer
daniel.is.fisc...@web.de wrote:
 Am Donnerstag 29 April 2010 20:08:00 schrieb Ben:
 A technical question: it seems like the instance of ArrowLoop is too
 strict (this is something I've wondered about in Liu's paper too.)
 Shouldn't it be

  instance ArrowLoop SFAuto where
      loop (SFAuto s f) = SFAuto s f'
          where
            f' (b, s1) = let (~(c, d), s2) = f ((b, d), s1)
                         in (c, s2)

 Let-bindings are already lazy, so the '~' makes no difference here.
 Apart from the readability, both are the same as

 where
  f' (b,s1) = let x = f ((b, snd $ fst x),s1) in (fst $ fst x, snd x)

Ben's version is slightly lazier - even though the let binding is
lazy, pattern matching is strict.

so (let ((x,y).z) = (undefined, hello) in z) will exception out, but
(let (~(x,y),z) = (undefined, hello) in z) will not.

I don't know if you need that level of laziness, though.

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


[Haskell-cafe] Downloading Haskell repos from GitHub

2010-04-30 Thread Gwern Branwen
Along the lines of
http://blog.patch-tag.com/2010/03/13/mirroring-patch-tag/ for
downloading all patch-tag.com repositories, I've begun to wonder how
to download all Github repositories since more and more people seem to
be using it.

Nothing in http://develop.github.com/ seems especially useful for
grabbing the git:// URLs of all repos by language - just by user.

The only real list of repos by language seems to be gotten at via
http://github.com/languages/Haskell/updated or
http://github.com/languages/Haskell/created . (You might think
http://github.com/languages/Haskell would be good, but no, it's just a
few random repos by interest and not a full listing.)

I looked at the HTML, and it looks possible to use tagsoup to get all
98 pages and then parse the entries to get the HTTP URLs of the repos,
and then turn *that* into git:// URLs suitable for shelling out to
'git clone', but I can't help but wonder if maybe there's a better
approach someone more familiar with Github would know.

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


Re: [Haskell-cafe] Re: FRP for game programming / artifical life simulation

2010-04-30 Thread Daniel Fischer
Am Freitag 30 April 2010 17:23:19 schrieb Antoine Latter:
 On Fri, Apr 30, 2010 at 3:37 AM, Daniel Fischer

 daniel.is.fisc...@web.de wrote:
  Am Donnerstag 29 April 2010 20:08:00 schrieb Ben:
  A technical question: it seems like the instance of ArrowLoop is too
  strict (this is something I've wondered about in Liu's paper too.)
  Shouldn't it be
 
   instance ArrowLoop SFAuto where
       loop (SFAuto s f) = SFAuto s f'
           where
             f' (b, s1) = let (~(c, d), s2) = f ((b, d), s1)
                          in (c, s2)
 
  Let-bindings are already lazy, so the '~' makes no difference here.
  Apart from the readability, both are the same as
 
  where
   f' (b,s1) = let x = f ((b, snd $ fst x),s1) in (fst $ fst x, snd x)

 Ben's version is slightly lazier - even though the let binding is
 lazy, pattern matching is strict.

 so (let ((x,y).z) = (undefined, hello) in z) will exception out, but
 (let (~(x,y),z) = (undefined, hello) in z) will not.

 I don't know if you need that level of laziness, though.

Probably not. Although, you're right, if only s2 is ever looked at and not 
c, Ben's version can give a result where the library instance throws an 
exception.
Was fooled by the use of c in the result.


 Antoine

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


Re: [Haskell-cafe] Downloading Haskell repos from GitHub

2010-04-30 Thread Jesper Louis Andersen
On Fri, Apr 30, 2010 at 5:38 PM, Gwern Branwen gwe...@gmail.com wrote:
 Nothing in http://develop.github.com/ seems especially useful for
 grabbing the git:// URLs of all repos by language - just by user.

 The only real list of repos by language seems to be gotten at via
 http://github.com/languages/Haskell/updated or
 http://github.com/languages/Haskell/created . (You might think
 http://github.com/languages/Haskell would be good, but no, it's just a
 few random repos by interest and not a full listing.)

Github has a REST API for accessing data. Unfortunately it can't give
you the wanted
breakdown, but I would ask them for it. It is much simpler for you,
and it does not put an extra strain on their servers due to the
scraping. Usually, the github guys are helpful when you have a
question.

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


Re: [Haskell-cafe] Downloading Haskell repos from GitHub

2010-04-30 Thread Gwern Branwen
On Fri, Apr 30, 2010 at 11:51 AM, Jesper Louis Andersen
jesper.louis.ander...@gmail.com wrote:
 On Fri, Apr 30, 2010 at 5:38 PM, Gwern Branwen gwe...@gmail.com wrote:
 Nothing in http://develop.github.com/ seems especially useful for
 grabbing the git:// URLs of all repos by language - just by user.

 The only real list of repos by language seems to be gotten at via
 http://github.com/languages/Haskell/updated or
 http://github.com/languages/Haskell/created . (You might think
 http://github.com/languages/Haskell would be good, but no, it's just a
 few random repos by interest and not a full listing.)

 Github has a REST API for accessing data. Unfortunately it can't give
 you the wanted
 breakdown, but I would ask them for it. It is much simpler for you,

You mean ask for a new feature? (Just a one-time list is no good since
I intend to repeat it regularly to pick up new repos, just like with
patch-tag.)

 and it does not put an extra strain on their servers due to the
 scraping.

Well, it'd only be about 2000 HTTP hits. (98 + (20 * 98)). The
downloading of the repos would probably reduce that demand to
insignificance, especially the first time around when most of the
repos would need to be downloaded.

 Usually, the github guys are helpful when you have a
 question.

Any suggested method besides the obvious http://github.com/contact ?

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


Re: [Haskell-cafe] Downloading Haskell repos from GitHub

2010-04-30 Thread Jesper Louis Andersen
On Fri, Apr 30, 2010 at 6:02 PM, Gwern Branwen gwe...@gmail.com wrote:

 Github has a REST API for accessing data. Unfortunately it can't give
 you the wanted
 breakdown, but I would ask them for it. It is much simpler for you,

 You mean ask for a new feature? (Just a one-time list is no good since
 I intend to repeat it regularly to pick up new repos, just like with
 patch-tag.)


Yes.

 Any suggested method besides the obvious http://github.com/contact ?

No.


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


[Haskell-cafe] ANN: Combinatorrent v0.3.0

2010-04-30 Thread Jesper Louis Andersen
We are pleased to announce Combinatorrent v0.3.0

Combinatorrent is a bittorrent client, written in Haskell and with an emphasis
on concurrency.

This version has the following changes from v0.2.0:

 - Numerous space leak fixes. The client doesn't leak memory anymore
for typical runs.
 - A number of performance optimizations. In particular the number of
CPU seconds per
   downloaded megabyte went down considerably compared to earlier versions.
 - Lowered allocation rate of the client so the garbage collector has
less work to do.
 - Support BEP 0027 implicitly.
 - Add support for compiling with GHC HEAD (6.13.mmdd series).
 - Change the parser in the incoming direction to attoparsec and use
its incremental
   features to simplify the receiver loop. Outgoing direction still uses cereal.
 - Claim BEP 0006 support by implementing the Fast-extension.
 - Add (untested) BEP 0007 support: Handle IPv6 addresses as well as
IPv4 addresses.
 - Fix a bug where interest updates were not considered correctly.
Also lower the
   amount of interest communication to peers to save bandwidth.

Looking ahead, the goal is to support at least the extended messaging
protocol. The EMP
is a dependency prerequisite for many of the other extensions, hence
it is an important
building block for further work.

As always, the source code and issue tracker is at github:

http://github.com/jlouis/combinatorrent




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


[Haskell-cafe] 64-bit code on OSX?

2010-04-30 Thread Gregory Crosswhite
Hey everyone,

Just out of curiosity, does anyone know the story on what is holding up the 
ability of GHC to generate 64-bit code on OSX?

Cheers,
Greg

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


Re: [Haskell-cafe] are forkIO threads event-driven?

2010-04-30 Thread Aran Donohue
Thanks for the excellent links, that's exactly what I wanted. It's
interesting that they've chosen not to base the new work on libevent.

As an aside, I really don't think that the case study should be given any
more linkjuice as a response to GHC/Haskell IO concurrency questions. While
it's a wonderful tutorial on the programming technique side, it's a decade
old and was written at a time when serving 4000 requests was a reasonable
benchmark. These days modern web servers are moving more and more toward
handling tens of thousands of concurrent held-open *connections*---a
different metric and a different scale.

Cheers,
Aran



On Fri, Apr 30, 2010 at 2:51 AM, Don Stewart d...@galois.com wrote:

 bulat.ziganshin:
  Hello Aran,
 
  Friday, April 30, 2010, 2:26:20 AM, you wrote:
 
   In GHC, if a thread spawned by forkIO blocks on some network or
   disk IO, is the threading system smart enough not to wake the thread
 
  afaik, yes. it's controlled by special i/o thread that multiplexes all
  i/o done via stdlibs. but ghc i/o manager can't use epoll/kqueue so
  it's appropriate only for small (or medium?) servers

 Look at the recent work on the event library and replacing the IO
 manager.


 http://www.serpentine.com/blog/2010/01/22/new-ghc-io-manager-first-benchmark-numbers/

 There's much more background on the new code here,


 http://www.serpentine.com/blog/2009/12/17/making-ghcs-io-manager-more-scalable/

 and some nice benchmarks


 http://blog.johantibell.com/2010/01/scalable-timeout-support-for-ghcs-io.html

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


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

2010-04-30 Thread Don Stewart
ketil:
 
 Don Stewart d...@galois.com writes:
 
  http://shootout.alioth.debian.org/u64q/haskell.php
 
 Observations:
 
 Although we're mostly beaten on speed, and about the same on code size,
 we're using a lot less memory than Java.

Prior to the upgrade we weren't mostly beaten on speed, so I think a bit
of tuning (ghc -server :) should help.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe



[Haskell-cafe] why does Data.Text.Lazy.IO.readFile return the internal type Data.Text.Lazy.Internal.Text, when Data.Text.IO.readFile returns plain IO Data.Text.Text?

2010-04-30 Thread Thomas Hartman
*Main :t Data.Text.IO.readFile
Data.Text.IO.readFile :: FilePath - IO T.Text

but

*Main :t Data.Text.Lazy.IO.readFile
Data.Text.Lazy.IO.readFile
  :: FilePath - IO text-0.7.1.0:Data.Text.Lazy.Internal.Text

why does the lazy version use the internal type, whereas the strict
version of Text IO just using plain Data.Text type?
and how can I get from internal type to regular type when using Data.Text?

also the internal type doesn't appear to be reflected in the haddock:
 
http://hackage.haskell.org/packages/archive/text/0.7.1.0/doc/html/Data-Text-Lazy-IO.html

ghc-pkg list | grep -i text
text-0.7.1.0

thanks for any help!
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] why does Data.Text.Lazy.IO.readFile return the internal type Data.Text.Lazy.Internal.Text, when Data.Text.IO.readFile returns plain IO Data.Text.Text?

2010-04-30 Thread Edward Kmett
Data.Text.Lazy.Internal.Text = Data.Text.Lazy.Text
Data.Text.Internal.Text = Data.Text.Text

You can use fromChunks/toChunks from Data.Text.Lazy to break it up into
strict Text fragments.

The lazy version returns a Lazy Text value, which is isomorphic to
[Data.Text.Text]. The strict version just returns a single strict Text
value.

On Fri, Apr 30, 2010 at 4:37 PM, Thomas Hartman tphya...@gmail.com wrote:

 *Main :t Data.Text.IO.readFile
 Data.Text.IO.readFile :: FilePath - IO T.Text

 but

 *Main :t Data.Text.Lazy.IO.readFile
 Data.Text.Lazy.IO.readFile
  :: FilePath - IO text-0.7.1.0:Data.Text.Lazy.Internal.Text

 why does the lazy version use the internal type, whereas the strict
 version of Text IO just using plain Data.Text type?
 and how can I get from internal type to regular type when using Data.Text?

 also the internal type doesn't appear to be reflected in the haddock:

 http://hackage.haskell.org/packages/archive/text/0.7.1.0/doc/html/Data-Text-Lazy-IO.html

 ghc-pkg list | grep -i text
text-0.7.1.0

 thanks for any help!
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

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


Re: [Haskell-cafe] why does Data.Text.Lazy.IO.readFile return the internal type Data.Text.Lazy.Internal.Text, when Data.Text.IO.readFile returns plain IO Data.Text.Text?

2010-04-30 Thread Daniel Fischer
Am Freitag 30 April 2010 22:37:38 schrieb Thomas Hartman:
 *Main :t Data.Text.IO.readFile
 Data.Text.IO.readFile :: FilePath - IO T.Text

 but

 *Main :t Data.Text.Lazy.IO.readFile
 Data.Text.Lazy.IO.readFile

   :: FilePath - IO text-0.7.1.0:Data.Text.Lazy.Internal.Text


Hmm,

Prelude :t Data.Text.Lazy.IO.readFile
Data.Text.Lazy.IO.readFile
  :: FilePath - IO text-0.7.1.0:Data.Text.Lazy.Internal.Text
Prelude :t Data.Text.IO.readFile
Data.Text.IO.readFile
  :: FilePath - IO text-0.7.1.0:Data.Text.Internal.Text


 why does the lazy version use the internal type, whereas the strict
 version of Text IO just using plain Data.Text type?

Both are using the type from the corresponding .Internal, because that's 
where the type is defined (note that, as with ByteStrings, the strict and 
lazy types are different, lazy is basically a list of strict).
Now, the interesting question is, why is the one displayed as T.Text?
It must be what you import to your Main, but I don't know how to produce 
that effect.

 and how can I get from internal type to regular type when using
 Data.Text?

Use id :: a - a 
;)


 also the internal type doesn't appear to be reflected in the haddock:
 
 http://hackage.haskell.org/packages/archive/text/0.7.1.0/doc/html/Data-T
ext-Lazy-IO.html

Follow the 'Source' link at Data.Text.Lazy.Text, that sends you to
http://hackage.haskell.org/packages/archive/text/0.7.1.0/doc/html/src/Data-
Text-Lazy-Internal.html#Text


 ghc-pkg list | grep -i text
 text-0.7.1.0

 thanks for any help!
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: FRP for game programming / artifical life simulation

2010-04-30 Thread Ben
FYI i got the lazy pattern match from Patterson's Programming with
Arrows, so I'm assuming it makes a difference.  (I'll work out a real
example later.)

B

On Fri, Apr 30, 2010 at 8:45 AM, Daniel Fischer
daniel.is.fisc...@web.de wrote:
 Am Freitag 30 April 2010 17:23:19 schrieb Antoine Latter:
 On Fri, Apr 30, 2010 at 3:37 AM, Daniel Fischer

 daniel.is.fisc...@web.de wrote:
  Am Donnerstag 29 April 2010 20:08:00 schrieb Ben:
  A technical question: it seems like the instance of ArrowLoop is too
  strict (this is something I've wondered about in Liu's paper too.)
  Shouldn't it be
 
   instance ArrowLoop SFAuto where
       loop (SFAuto s f) = SFAuto s f'
           where
             f' (b, s1) = let (~(c, d), s2) = f ((b, d), s1)
                          in (c, s2)
 
  Let-bindings are already lazy, so the '~' makes no difference here.
  Apart from the readability, both are the same as
 
  where
   f' (b,s1) = let x = f ((b, snd $ fst x),s1) in (fst $ fst x, snd x)

 Ben's version is slightly lazier - even though the let binding is
 lazy, pattern matching is strict.

 so (let ((x,y).z) = (undefined, hello) in z) will exception out, but
 (let (~(x,y),z) = (undefined, hello) in z) will not.

 I don't know if you need that level of laziness, though.

 Probably not. Although, you're right, if only s2 is ever looked at and not
 c, Ben's version can give a result where the library instance throws an
 exception.
 Was fooled by the use of c in the result.


 Antoine


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


Re: [Haskell-cafe] why does Data.Text.Lazy.IO.readFile return the internal type Data.Text.Lazy.Internal.Text, when Data.Text.IO.readFile returns plain IO Data.Text.Text?

2010-04-30 Thread Edward Kmett
On Fri, Apr 30, 2010 at 5:09 PM, Daniel Fischer daniel.is.fisc...@web.dewrote:
 and how can I get from internal type to regular type when using

  Data.Text?

 Use id :: a - a
 ;)

 Not quite, there is still a distinction between Data.Text(.Internal).Text
and Data.Text.Lazy(.Internal).Text.

but the machinery to work with the results he gets back are found in
Data.Text.Lazy including the functions to turn it into a list of strict Text
fragments.


 
  also the internal type doesn't appear to be reflected in the haddock:
 
  http://hackage.haskell.org/packages/archive/text/0.7.1.0/doc/html/Data-T
 ext-Lazy-IO.html

 Follow the 'Source' link at Data.Text.Lazy.Text, that sends you to
 http://hackage.haskell.org/packages/archive/text/0.7.1.0/doc/html/src/Data-
 Text-Lazy-Internal.html#Text

 
  ghc-pkg list | grep -i text
  text-0.7.1.0
 
  thanks for any help!
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

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


Re: [Haskell-cafe] why does Data.Text.Lazy.IO.readFile return the internal type Data.Text.Lazy.Internal.Text, when Data.Text.IO.readFile returns plain IO Data.Text.Text?

2010-04-30 Thread Daniel Fischer
Am Freitag 30 April 2010 23:20:59 schrieb Edward Kmett:
 On Fri, Apr 30, 2010 at 5:09 PM, Daniel Fischer 
daniel.is.fisc...@web.dewrote:
  and how can I get from internal type to regular type when using
 
   Data.Text?
 
  Use id :: a - a
  ;)
 
  Not quite, there is still a distinction between
  Data.Text(.Internal).Text

 and Data.Text.Lazy(.Internal).Text.

Yes, I understood it so that he wanted to convert from 
Data.Text.Lazy.Internal.Text to Data.Text.Lazy.Text.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] why does Data.Text.Lazy.IO.readFile return the internal type Data.Text.Lazy.Internal.Text, when Data.Text.IO.readFile returns plain IO Data.Text.Text?

2010-04-30 Thread Bryan O'Sullivan
On Fri, Apr 30, 2010 at 3:14 PM, Daniel Fischer daniel.is.fisc...@web.dewrote:


 Yes, I understood it so that he wanted to convert from
 Data.Text.Lazy.Internal.Text to Data.Text.Lazy.Text.


It's the same type.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] why does Data.Text.Lazy.IO.readFile return the internal type Data.Text.Lazy.Internal.Text, when Data.Text.IO.readFile returns plain IO Data.Text.Text?

2010-04-30 Thread Daniel Fischer
Am Samstag 01 Mai 2010 00:26:26 schrieb Bryan O'Sullivan:
 On Fri, Apr 30, 2010 at 3:14 PM, Daniel Fischer 
daniel.is.fisc...@web.dewrote:
  Yes, I understood it so that he wanted to convert from
  Data.Text.Lazy.Internal.Text to Data.Text.Lazy.Text.

 It's the same type.

That's why I suggested id.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] why does Data.Text.Lazy.IO.readFile return the internal type Data.Text.Lazy.Internal.Text, when Data.Text.IO.readFile returns plain IO Data.Text.Text?

2010-04-30 Thread Felipe Lessa
On Fri, Apr 30, 2010 at 11:09:05PM +0200, Daniel Fischer wrote:
 Hmm,

 Prelude :t Data.Text.Lazy.IO.readFile
 Data.Text.Lazy.IO.readFile
   :: FilePath - IO text-0.7.1.0:Data.Text.Lazy.Internal.Text
 Prelude :t Data.Text.IO.readFile
 Data.Text.IO.readFile
   :: FilePath - IO text-0.7.1.0:Data.Text.Internal.Text

It depends on what is on your scope:

  Prelude :t Data.Text.Lazy.IO.readFile
  Data.Text.Lazy.IO.readFile
:: FilePath - IO text-0.7.1.0:Data.Text.Lazy.Internal.Text

  Prelude :m Data.Text.Lazy
  Prelude Data.Text.Lazy :t Data.Text.Lazy.IO.readFile
  Data.Text.Lazy.IO.readFile :: FilePath - IO Text

HTH,

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


Re: [Haskell-cafe] why does Data.Text.Lazy.IO.readFile return the internal type Data.Text.Lazy.Internal.Text, when Data.Text.IO.readFile returns plain IO Data.Text.Text?

2010-04-30 Thread Daniel Fischer
Am Samstag 01 Mai 2010 00:58:23 schrieb Felipe Lessa:

 It depends on what is on your scope:

   Prelude :t Data.Text.Lazy.IO.readFile
   Data.Text.Lazy.IO.readFile

 :: FilePath - IO text-0.7.1.0:Data.Text.Lazy.Internal.Text

   Prelude :m Data.Text.Lazy
   Prelude Data.Text.Lazy :t Data.Text.Lazy.IO.readFile
   Data.Text.Lazy.IO.readFile :: FilePath - IO Text

 HTH,

Indirectly. From the original post:

 *Main :t Data.Text.IO.readFile
 Data.Text.IO.readFile :: FilePath - IO T.Text

So the scope is the top level of the Main module. I didn't immediately 
figure out why it was displayed as T.Text. I couldn't reproduce that with a 
couple of different imports, but I only  tried
import [qualified] Data.Text.IO as T.
When I saw

   Prelude :m Data.Text.Lazy

it became clear, he had import qualified Data.Text as T in Main, thanks 
:)


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


[Haskell-cafe] Re: Functional Dependencies Help

2010-04-30 Thread John Creighton

On Apr 29, 7:47 am, John Creighton johns2...@gmail.com wrote:
 I've been trying to apply some stuff I learned about functional
 dependencies, but I run into one of two problems. I either end up with
 inconsistent dependencies (OverlappingInstances  doesn't seem to
 apply) or I end up with infinite recursion. I want to be able to do
 simple things like if a is a subset of b and b is a subset of c then a
 is a subset of c. If a is a is a subset of b and b is a c then a is a
 c.

 Before I added the equality functions I had infinite recursion. Once I
 put them them in then I have trouble with overlapping instances.

I've been doing some reading and I think the following is an
improvement but I end up hanging the compiler so I can't tell what the
errors are. I'll see if their are any trace options that might be
helpfully for GHC.
{-# LANGUAGE EmptyDataDecls,
 MultiParamTypeClasses,
 ScopedTypeVariables,
 FunctionalDependencies,
 FlexibleInstances #-}

{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-} --10
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FlexibleContexts #-}


data Noun = Noun deriving (Show) --15
data Verb = Verb deriving (Show) --
data Adjactive = Adjactive deriving (Show)

data Animal=Animal deriving (Show)
data Feline=Feline deriving (Show) --20
data Cat = Cat deriving (Show)

data Taby_Cat=Taby_Cat deriving (Show)
data T=T deriving (Show)
data F=F deriving (Show) --25
--data Z=Z
--data S i = S i
--type One = S Z
--type Zero = Z
class Isa a b c | a b-c where isa::a-b-c --30

instance Isa Animal Noun T where isa a b = T --



class Parrent a b| a-b where -- Specific Cases
parrent :: a-b --

instance Parrent Cat Feline where --
   parrent a = Feline --40
instance Parrent Feline Animal where --
   parrent a= Animal --




class TypeOr a b c|a b-c where
   typeOr :: a-b-c
instance TypeOr T T T where
   typeOr a b = T --50
instance TypeOr T F T where
   typeOr a b = T
instance TypeOr F T T where
   typeOr a b = T
instance TypeOr F F T where
   typeOr a b = T

class TypeEq' () x y b = TypeEq x y b | x y - b
instance TypeEq' () x y b = TypeEq x y b
class TypeEq' q x y b | q x y - b --60
class TypeEq'' q x y b | q x y - b

instance TypeCast b T = TypeEq' () x x b
instance TypeEq'' q x y b = TypeEq' q x y b
instance TypeEq'' () x y F

-- see http://okmij.org/ftp/Haskell/typecast.html
class TypeCast   a b   | a - b, b-a   where typeCast   :: a - b
class TypeCast'  t a b | t a - b, t b - a where typeCast'  :: t-a-
b
class TypeCast'' t a b | t a - b, t b - a where typeCast'' :: t-a-
b --70

instance TypeCast'  () a b = TypeCast a b where typeCast x =
typeCast' () x
instance TypeCast'' t a b = TypeCast' t a b where typeCast' =
typeCast''
instance TypeCast'' () a a where typeCast'' _ x  = x

-- overlapping instances are used only for ShowPred
class EqPred a flag | a-flag where {}

  -- Used only if the other
  -- instances don't apply -- 80

class IsSuperSet a b c | a b-c where -- General Definition
isSuperSet :: a-b-c

--instance (TypeEq b Animal T,TypeEq c F T)=IsSuperSet a b c where
--85
--   isSuperSet a b = F --
u=undefined
instance (
   TypeEq a b iseq, --90
   TypeEq Animal b isaninmal,
   IsSuperSet' isaninmal iseq a b c3 --
 ) =
 IsSuperSet a b c3 where --
 isSuperSet a b=(isSuperSet' (u::isaninmal) (u::iseq) (a::a)
(b::b))::c3

class IsSuperSet' isanimal iseq a b c| isanimal iseq a b-c where
isSuperSet' :: a-b-c

instance IsSuperSet' isanimal T a b T where
   isSuperSet' a b = T

instance (Parrent b d, IsSuperSet a b c)=IsSuperSet' F F a b c where
   isSuperSet' a b = (isSuperSet a ((parrent (b::b)::d)))::c

instance IsSuperSet' T F a b F where
   isSuperSet' a b = F


class ToBool a where
   toBool :: a-Bool

instance ToBool T where
   toBool a = True

instance ToBool F where
   toBool a = False

myCat=Cat
bla=isSuperSet Animal Cat
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] FGL instance constraint

2010-04-30 Thread Kevin Quick


I need help understanding how to express the following:



 data (Cls a) = B a = B [a]



 data GrB a b = GrB (B a)



 instance Graph GrB where ...


In the methods for the instance specification, I need to perform Cls a 
operations on a.

 * As shown, the compiler complains that it cannot deduce (Cls a) from the 
context () on those methods.
 * I can't redefine the Graph methods to introduce the (Cls a) constraint 
[reasonable]
 * If I try to express the constraint as part of the Graph instance: instance (Cls a) 
= Graph GrB where ... then it says it's an ambiguous constraint because 'a' isn't 
mentioned.
 * I've tried specifying a functional constraint: instance (Cls a) = Graph GrB | GrB 
- a where ... but that's not valid for an instance declaration.
 * I can't include a in the GrB instance: instance (Cls a) = Graph (GrB a b) where 
... because that's a kind conflict.

Suggestions/solutions are appreciated.

Thanks!

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