Re: [Haskell-cafe] expanded standard lib

2007-11-22 Thread Ketil Malde
David Menendez [EMAIL PROTECTED] writes:

 Someone in a previous thread made an analogy between GHC and the linux
 kernel. I imagine that third-party Haskell distributions, consisting
 of GHC/Hugs/whatever and some bundled packages, would meet the desire
 for a batteries included Haskell implementation without tying the
 most popular libraries to GHC releases.

Well - the various Linux distributions certainly could do this -
providing a virtual haskell-libs package that just pulls in a bunch
of commonly used packages.  It'd be nice, of course, if that package
was reasonably consistent across distributions, and if there were
a corresponding installer for those other operating systems.

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Problems with do notation

2007-11-22 Thread Peter Verswyvelen

worksFine =
 if True
 then putStrLn True
 else putStrLn False

worksNOT = do
 if True
 then putStrLn True
 else putStrLn False

worksAgain = do
 if True
   then putStrLn True
   else putStrLn False

Of course the worksFine function returns an IO action, so has different 
behavior, but I mean the indentation is different. Is this by design?



Also the following is rather strange:

doubleDefError = let x = 1
   x = 2
   in x * x

alsoDoubleDefError = do
 let x = 1
 x = 2
 return (x*x)

doubleDefNOERROR = do
 let x = 1
 let x = 2
 return (x*x)

Now I understand why this is (the second let starts a new invisible 
scope no?), but for newbies, this is all very strange :-)


Cheers,
Peter

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


Re: [Haskell-cafe] Problems with do notation

2007-11-22 Thread Thomas Schilling
On Thu, 2007-11-22 at 09:19 +0100, Peter Verswyvelen wrote:
 worksFine = 
   if True
   then putStrLn True
   else putStrLn False
 
 worksNOT = do
   if True
   then putStrLn True
   else putStrLn False
 
 worksAgain = do
   if True
 then putStrLn True
 else putStrLn False
 
 Of course the worksFine function returns an IO action, so has
 different behavior, but I mean the indentation is different. Is this
 by design?
 
 
 Also the following is rather strange:
 
 doubleDefError = let x = 1
 x = 2
 in x * x
 
 alsoDoubleDefError = do
   let x = 1
   x = 2
   return (x*x)
 
 doubleDefNOERROR = do
   let x = 1
   let x = 2
   return (x*x)
  
 Now I understand why this is (the second let starts a new invisible
 scope no?), but for newbies, this is all very strange :-)

Now go and read about 'mdo' (recursive 'do' notation) ;) 

BTW, don't you get the same behaviour?

foo = let x = 1 in
  let x = 2 in
x * x



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


[Haskell-cafe] Dynamically find out instances of classes (plugin system for haskell)

2007-11-22 Thread Radosław Grzanka
Hi,
  Is there any plugin system for haskell? For example, in Java, I can
load all compiled classes from given directory, check their interfaces
and run some methods through reflection etc. Is it possible in
haskell, to load modules from given directory, and if in module there
is instance of class then return instantiation of that class?

I hope this is understandable what I'm trying to achieve here.

Thank you,
  Radek.

-- 
Codeside: http://codeside.org/
Przedszkole Miejskie nr 86 w Lodzi: http://www.pm86.pl/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Problems with do notation

2007-11-22 Thread Luke Palmer
On Nov 22, 2007 8:19 AM, Peter Verswyvelen [EMAIL PROTECTED] wrote:
  worksFine =
if True
then putStrLn True
else putStrLn False

This is just an expression, the indentation is inconsequential.

  worksNOT = do
if True
then putStrLn True
else putStrLn False

The first line, if True, sets the indentation level of the
statements in the do to two spaces.  So this is interpreted as

  worksNOT = do {
if True ;
then putStrLn True ;
else putStrLn False
  }

Which is of course illegal.

  worksAgain = do
if True
  then putStrLn True
  else putStrLn False

Here, the indentation level of the do is still two spaces, but then
then and else are at a higher indent than that, so they are
interpreted as part of the preceding expression.  The rules are
actually very simple.

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


Re: [Haskell-cafe] expanded standard lib

2007-11-22 Thread Ketil Malde
Duncan Coutts [EMAIL PROTECTED] writes:

 I did a quick popularity count by wget'ting the whole thing, and
 looking for hrefs under cgi-bin/packages/archive¹.

 That's quite fascinating. Thanks. You've convinced me we should add
 something like that :-).

Note that that was only a direct count, I haven't implemented a real
library rank.

 Please file a feature request:
 http://hackage.haskell.org/trac/hackage/

This okay?

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

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: expanded standard lib

2007-11-22 Thread apfelmus

Ketil Malde wrote:

David Menendez [EMAIL PROTECTED] writes:


Someone in a previous thread made an analogy between GHC and the linux
kernel. I imagine that third-party Haskell distributions, consisting
of GHC/Hugs/whatever and some bundled packages, would meet the desire
for a batteries included Haskell implementation without tying the
most popular libraries to GHC releases.


Well - the various Linux distributions certainly could do this -
providing a virtual haskell-libs package that just pulls in a bunch
of commonly used packages.  It'd be nice, of course, if that package
was reasonably consistent across distributions, and if there were
a corresponding installer for those other operating systems.


Meta-packages on hackage would do the trick, no?


Regards,
apfelmus

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


RE: [Haskell-cafe] Dynamically find out instances of classes (pluginsystem for haskell)

2007-11-22 Thread Bayley, Alistair
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of 
 Radoslaw Grzanka
 
 Hi,
   Is there any plugin system for haskell? For example, in Java, I can
 load all compiled classes from given directory, check their interfaces
 and run some methods through reflection etc. Is it possible in
 haskell, to load modules from given directory, and if in module there
 is instance of class then return instantiation of that class?

There are two libs that I'm aware of.

  http://hackage.haskell.org/cgi-bin/hackage-scripts/package/plugins-1.0
 
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/metaplug-0.1.
1

AFAICT, plugins is more mature and has a higher-level API, but the last
time I looked it was not working on Windows under ghc = 6.6 (can anyone
refute or verify this?)

It's more like dynamic linking than Java's reflection: you have to
already know what functions are in the module (and their types) to be
able to call them. I'm not sure about directly creating values of data
types exported from the module.

Alistair
*
Confidentiality Note: The information contained in this message,
and any attachments, may contain confidential and/or privileged
material. It is intended solely for the person(s) or entity to
which it is addressed. Any review, retransmission, dissemination,
or taking of any action in reliance upon this information by
persons or entities other than the intended recipient(s) is
prohibited. If you received this in error, please contact the
sender and delete the material from any computer.
*
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Over-allocation

2007-11-22 Thread Gracjan Polak
Don Stewart dons at galois.com writes:
 
 ByteStrings have all the same operations as lists though, so you can
 index, compare and take substrings, with the benefit that he underlying
 string will be shared, not copied. And only use 1 byte per element.

Is there any parser built directly over ByteString that I could look at?

Or maybe somebody implemented something like Text.ParserCombinators.ReadP for
ByteString?

From the first sight it seems doable, so there is light at the end of the 
tunnel :)

-- 
Gracjan


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


Re: [Haskell-cafe] More problems [Tetris]

2007-11-22 Thread Bulat Ziganshin
Hello Andrew,

Wednesday, November 21, 2007, 9:26:45 PM, you wrote:

 It seems that the [Haskell] GLUT package isn't installed.

at least i remember my own proposal to remove from GHC distribution
graphics packages - because they are fat, rarely used and mostly outdated

 Hackage. ;-) But, alas, no. That doesn't work either. The reason? Well,
 apparently Cabal can't find sh.

cabal by itself doesn't need sh. it's either required by library
installation or it as just information message

 Not wanting to sound like somebody who just complains all day, but this
 kind of thing seems to be pretty typical of trying to get just about 
 anything Haskell-related to work here.

i agree. haskell world today is something like unix world 10 years ago.
it attracts qualified people which step-by-step makes this world more
attractive for casual users. but we are in the middle of the long road


-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]

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


Re: [Haskell-cafe] expanded standard lib

2007-11-22 Thread Vladimir Zlatanov
snip
 Many other programming languages have packaging strategies that sound
 very similar.  Several of them have managed to have a negative impact on
 platforms that already have good packaging technologies (i.e. almost
 every platform apart from Windows ;-).  I'd hate to see Haskell go in a
 direction where packaging for e.g. Debian is made more difficult than it
 is at the moment.
:)
That would be very bad indeed. With careful implementation that
shouldn't be a problem.

Му reference to planet was regarding the ease of use and download of
packages not installed in the system. That is integrated into the
compiler via scheme macros or their equivalent in non-scheme
languages:
- just consider the following:
(require (planet eval.ss (dherman javascript.plt 5 4)))

if a package javascript verssion 5 4 by dherman is not present in your
system or your user planet cache - download, and compile it, then
proceed doing your normal compiler duties

With distribution provided packages they will be present if installed by
root. With user downloaded they go somewhere in home or whatever else
sensible place is pointed in the environment. I simply don't see a
conflict. It is the normal unix way. Being lazy is good after all.
Having the tools infer all dependencies and provide them to you when you
need them is a good thing as well. Just compare it with the:
sudo apt-get xyz; echo I don't have root, I'll call dad, 'cause I want
to compile

I'm not sure if it is currently possible to implement that via template
haskell. From the snippets I've glimpsed it implements a simple defmacro
like mechanism. But does it allow executing actions at compile time? If
yes, it can be done in a library and then tested for usability,
packaging and destruction. 

I do think it is wrong to have it in the prelude, at least for quite a
while, but having the option to do it is a plus.

I think I went oveboard with this. Sorry for the longish post.

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


Re: [Haskell-cafe] Dynamically find out instances of classes (pluginsystem for haskell)

2007-11-22 Thread Radosław Grzanka
Hi,

Thanks for answer.

 There are two libs that I'm aware of.

   http://hackage.haskell.org/cgi-bin/hackage-scripts/package/plugins-1.0

 http://hackage.haskell.org/cgi-bin/hackage-scripts/package/metaplug-0.1.
 1

Unfortunatly former needs gcc, latter does not compile . I will have
to install msys or something I guess

 It's more like dynamic linking than Java's reflection: you have to
 already know what functions are in the module (and their types) to be
 able to call them. I'm not sure about directly creating values of data
 types exported from the module.

I know the types - not a problem. I just don't know the names.

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


Re: [Haskell-cafe] Re: More problems [Tetris]

2007-11-22 Thread Lennart Augustsson
IMHO, no one in the right mind uses Windows voluntarily. :)
I'm forced to use it at work, and it's a pain.  But since many are forced to
use Windows it would be nice if ghc was as well supported on Windows and
Unix.

On Nov 22, 2007 12:11 AM, Aaron Denney [EMAIL PROTECTED] wrote:

 On 2007-11-21, Andrew Coppin [EMAIL PROTECTED] wrote:
  In short, lots of Haskell-related things seem to be extremely
  Unix-centric and downright unfriendly towards anybody trying to set
  things up on Windows. If I didn't already know a bit about Unix, I'd
  be *really* stuck!

 I'd say, rather, that windows is unfriendly towards open and working
 common standards.

 --
 Aaron Denney
 --

 ___
 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] More problems [Tetris]

2007-11-22 Thread Jules Bean

Peter Verswyvelen wrote:

No GLUT is not bundled with GHC 6.8.1 anymore. Yes, that is weird.



I think it's weird too, so I bug reported it:

http://hackage.haskell.org/trac/ghc/ticket/1917

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


Re: [Haskell-cafe] Problems with do notation

2007-11-22 Thread Henning Thielemann

On Thu, 22 Nov 2007, Peter Verswyvelen wrote:

 worksFine =
   if True
   then putStrLn True
   else putStrLn False

 worksNOT = do
   if True
   then putStrLn True
   else putStrLn False

 worksAgain = do
   if True
 then putStrLn True
 else putStrLn False

 Of course the worksFine function returns an IO action, so has different
 behavior, but I mean the indentation is different. Is this by design?


That's somehow related to:
  http://www.haskell.org/pipermail/haskell-prime/2006-October/001771.html
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Problems with do notation

2007-11-22 Thread Bulat Ziganshin
Hello Peter,

Thursday, November 22, 2007, 11:19:20 AM, you wrote:

  Of course the worksFine function returns an IO action, so has
 different behavior, but I mean the indentation is different. Is this by 
 design?

to be exact, Haskell procedure is just a function returning an
action. i recommend you to read http://haskell.org/haskellwiki/IO_inside

the exact reason is different layout rules of expressions and do
construct, as was already described


-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]

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


Re[4]: [Haskell-cafe] expanded standard lib

2007-11-22 Thread Bulat Ziganshin
Hello Thomas,

Wednesday, November 21, 2007, 6:30:17 PM, you wrote:

 zoho writer: online, not xml editor, but at least able to export into
 pdf/html/doc/..
 

 It's not open source + it doesn't do what we need - Bang!  \also they
 host stuff for you, and only have limited room for free usage.  Relying
 on a company is not the way to go here (think of BitKeeper).

this is actually commercial service which provides some form of
try-before-you-buy facility. GHC docs, naturally, are not the thing
they will be happy to host :)

but at least it's some example - online wysiwyg editor with html/pdf
output which may show our way into future. as you've written, there
are other online editors which are open-source and free so we will be
desired clients for such service/software

there is also google docs - providing less facilities that zoho; i
can't compare it to other free variants neither don't know whether
it's okay to use it for free focs


-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]

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


[Haskell-cafe] Re: Over-allocation

2007-11-22 Thread Gracjan Polak
Gracjan Polak gracjanpolak at gmail.com writes:

 
 Don Stewart dons at galois.com writes:
  
  ByteStrings have all the same operations as lists though, so you can
  index, compare and take substrings, with the benefit that he underlying
  string will be shared, not copied. And only use 1 byte per element.
 
 Is there any parser built directly over ByteString that I could look at?
 
 Or maybe somebody implemented something like Text.ParserCombinators.ReadP for
 ByteString?
 
 From the first sight it seems doable, so there is light at the end of the 
 tunnel :)
 

Just a success report, after 58 min of coding I got kind of ReadP parser over
ByteString working and my memory usage went down from 1500MB to... 1.2MB! Over
1000 times better! Incredible!

Thanks for the suggestion to do it with ByteStrings!

I hope to publish it when I clean it up enough!

-- 
Gracjan



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


Re: [Haskell-cafe] Dynamically find out instances of classes (plugin system for haskell)

2007-11-22 Thread Bulat Ziganshin
Hello Radoslaw,

Thursday, November 22, 2007, 11:34:56 AM, you wrote:

   Is there any plugin system for haskell? For example, in Java, I can

there is also ghc-as-a-library

shortly said, ghc doesn't have dynamic abilities, so providing
features you need without compiling the whole program on the fly is
hardly possible



-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]

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


Re: [Haskell-cafe] Dynamically find out instances of classes (pluginsystem for haskell)

2007-11-22 Thread Claus Reinke

 Is there any plugin system for haskell? For example, in Java, I can
load all compiled classes from given directory, check their interfaces
and run some methods through reflection etc. Is it possible in
haskell, to load modules from given directory, and if in module there
is instance of class then return instantiation of that class?

I hope this is understandable what I'm trying to achieve here.


not really: the only classes in haskell are type classes, and
if there is any class instance missing at compile time, you
won't even get to runtime, so you don't have to worry
about loading instances at runtime!-)

perhaps you could describe the problem you are trying
to solve, rather than the solution you would like to see?

in general, ghci and hugs allow you to browse your modules,
find out types and names, run tests, etc. ghci can be scripted
to some extent (not always comfortably, but possibly sufficient
if you only want to find and run all functions named test*, for
instance), and if that isn't enough, ghc has an api that allows 
you to program your own variant of ghci, among other things.


claus


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


Re: [Haskell-cafe] Dynamically find out instances of classes (pluginsystem for haskell)

2007-11-22 Thread Radosław Grzanka
2007/11/22, Claus Reinke [EMAIL PROTECTED]:
   Is there any plugin system for haskell? For example, in Java, I can
  load all compiled classes from given directory, check their interfaces
  and run some methods through reflection etc. Is it possible in
  haskell, to load modules from given directory, and if in module there
  is instance of class then return instantiation of that class?
 
  I hope this is understandable what I'm trying to achieve here.

 not really: the only classes in haskell are type classes, and
 if there is any class instance missing at compile time, you
 won't even get to runtime, so you don't have to worry
 about loading instances at runtime!-)

Maybe I wasn't clear enough, maybe It is too much OO, maybe this is
exploiting language, maybe there are better ways. ;)

Let's say that in common module I have declaration (written from head,
so may not compile - only for illustration)

class Foo a where
  fun :: a - String

This is my interface declaration.
Now in seperate modules I have:

data GreatFooInstance = GreatFooInstance
instance Foo GreatFooInstance where
  fun a = 1

in another module I have

data GreatFooInstance' = GreatFooInstance'
instance Foo GreatFooInstance' where
  fun a = 2

at my main program I want to load all modules from directory and
receive a structure of (lack of vocabluary here) instantiated
instances of the class like this:

l :: Foo a = [a]
l = [GreatFooInstance, GreatFooInstance']

This above is illegal in haskell I believe, so some other approach
should be taken. The question is what is correct way (if any) to
handle this.

But if it was legal then the usage might be like:

o = map foo l

I cannot be more specifc because this is just theory, I'm playing with
haskell to know it features and limits. The key here is to add and
remove modules and find the list of modules at runtime, load it and
(with known interface) call its functions.

Hope it is clear enough now.

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


[Haskell-cafe] Searched for mdo on haskell.org. Found nothing.

2007-11-22 Thread Richard Kelsall

I was reading the 'Problems with do notation' thread and Thomas
Schilling suggested reading about mdo. Not knowing mdo I thought
that sounds interesting and went to

http://haskell.org/

which redirects you to

http://haskell.org/haskellwiki/Haskell

and gives you a search box. Typing mdo and clicking the Search
button gives

Showing below 0 results starting with #1.
No page title matches
No page text matches
Note: unsuccessful searches are often caused by searching for common
words like have and from, which are not indexed, or by specifying
more than one search term (only pages containing all of the search
terms will appear in the result).

Maybe mdo is too common to be indexed?

So I went to Google and searched for Haskell mdo and top of the
list is this page :

http://www.haskell.org/ghc/docs/latest/html/users_guide/syntax-extns.html

which is Chapter 8. GHC Language Features 8.3. Syntactic extensions
which describes mdo.

Did I do something wrong when searching haskell.org?


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


Re: [Haskell-cafe] Searched for mdo on haskell.org. Found nothing.

2007-11-22 Thread Dougal Stanton
On 22/11/2007, Richard Kelsall [EMAIL PROTECTED] wrote:

 Did I do something wrong when searching haskell.org?

You didn't use Google first? ;-)

Seriously though, using the search box at haskell.org seems to be a
dead loss. I'm sure this has come up in the past.

D.

-- 
Dougal Stanton
[EMAIL PROTECTED] // http://www.dougalstanton.net
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Searched for mdo on haskell.org. Found nothing.

2007-11-22 Thread Mads Lindstrøm
Hi All

Richard Kelsall wrote:
 I was reading the 'Problems with do notation' thread and Thomas
 Schilling suggested reading about mdo. Not knowing mdo I thought
 that sounds interesting and went to
 
 http://haskell.org/
 
 which redirects you to
 
 http://haskell.org/haskellwiki/Haskell
 
 and gives you a search box. Typing mdo and clicking the Search
 button gives
 
 Showing below 0 results starting with #1.
 No page title matches
 No page text matches
 Note: unsuccessful searches are often caused by searching for common
 words like have and from, which are not indexed, or by specifying
 more than one search term (only pages containing all of the search
 terms will appear in the result).
 
 Maybe mdo is too common to be indexed?
 
 So I went to Google and searched for Haskell mdo and top of the
 list is this page :
 
 http://www.haskell.org/ghc/docs/latest/html/users_guide/syntax-extns.html
 
 which is Chapter 8. GHC Language Features 8.3. Syntactic extensions
 which describes mdo.
 
 Did I do something wrong when searching haskell.org?
Properly not. I think the problem is that haskell.org do not index
words, that have length = 3. MediaWiki (which I think haskell.org uses)
do not by default index short words (length = 3 or length = 4 - can't
remember which).

If you search for yhc you also get zero results, which does not make
sense either.

Greetings,

Mads Lindstrøm


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


RE: [Haskell-cafe] Dynamically find out instances of classes (pluginsystem for haskell)

2007-11-22 Thread Grzegorz Chrupala


Bayley, Alistair-2 wrote:
 
 There are two libs that I'm aware of.
 
   http://hackage.haskell.org/cgi-bin/hackage-scripts/package/plugins-1.0
  
 http://hackage.haskell.org/cgi-bin/hackage-scripts/package/metaplug-0.1.
 1
 

There is also
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hint-0.1
I managed to install it (though not without some hassle, i.e. having to use
multiple Cabal versions), and make simple examples work.
--
Grzegorz
-- 
View this message in context: 
http://www.nabble.com/Dynamically-find-out-instances-of-classes-%28plugin-system-for-haskell%29-tf4855053.html#a13897174
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

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


Re: [Haskell-cafe] Searched for mdo on haskell.org. Found nothing.

2007-11-22 Thread Richard Kelsall

Thomas Schilling wrote:

On Thu, 2007-11-22 at 13:23 +, Richard Kelsall wrote:

I was reading the 'Problems with do notation' thread and Thomas
Schilling suggested reading about mdo. Not knowing mdo I thought
that sounds interesting and went to


Gah, I was too lazy to add the proper references:

 A Recursive do for Haskell by Erkök and Launchbury
  http://www.cse.ogi.edu/PacSoft/projects/rmb/recdo.pdf

 A Recursive do for Haskell: Design and Implementation 
 by Erkök and Launchbury

  http://www.cse.ogi.edu/PacSoft/projects/rmb/mdo.pdf

And here's a nice use case for it:

  Assembly: Circular Programming with Recursive do by O'Connor
  http://www.haskell.org/sitewiki/images/1/14/TMR-Issue6.pdf


Thank you. I'll have a read of those. I didn't mean to suggest you
should have given all the details, just that haskell.org confused
me by saying mdo didn't exist.

I've just tried some other words from that page in the Search box and
couldn't see any pattern to whether the page appears in the search
results. Very strange. Maybe a message along the lines of We are
hoping some generous person will improve this search feature at some
point. The source code is here ... The search currently produces
incomplete results. Please try Google if you do not find an answer.
would be useful?


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


Re: [Haskell-cafe] The Yampa Arcade: source code available?

2007-11-22 Thread Bit Connor
I am also happy to hear this. When will the new version be released?

Thanks,
Bit

On Nov 21, 2007 7:11 PM, Paul L [EMAIL PROTECTED] wrote:
 Just to echo back to the question whether Yampa/AFRP is still being
 developed, the answer is YES. We are working on an updated version at
 Yale.

 But really, we have many choices of doing reactive programming, and
 AFRP is only one of them. And even for AFRP, there are many choices of
 combinators and event switch constructs. There is still more research
 work to be done before we can settle on the interface for next
 version.

 I agree that more examples in the line of Space Invaders will serve
 the purpose of not only illustrating the capability, but also as
 tutorials to get people started. We'll first clean up existing code
 and bring it up to date, from which hopefully more examples could be
 developed.

 --
 Regards,
 Paul Liu

 Yale Haskell Group
 http://www.haskell.org/yale


 On 11/20/07, Peter Verswyvelen [EMAIL PROTECTED] wrote:
 
   Thanks for the feedback. Unfortunatly the Space Invaders game uses HGL,
  which is not supported on Windows anymore. Is it supported on Linux?
 
   Frag does compile and run on Windows using GHC 6.6.1, so that might be a
  better starting point.
 
   What is the current consensus regarding (A)FRP? Is it a dead end? Are
  approaches like Modelica better suited for the job?
 
   From the point of view of a veteran assembly/C++ game hacker like myself,
  it is funny to see that the same problems popup when doing reactive
  programming in a pure language like Haskell or an imperative language like
  C++... Recursive dependencies are problematic, be it with signals in FRP or
  with objects in C++. In videogames using an imperative language, this is
  often solved by just adding a global single frame delay between what is
  read and what is written. Ugly, but works in many cases. Or a third object
  is introduced that breaks the recursive dependency between the two
  problematic objects. If I'm correct, when switching from FRP to AFRP signals
  (type Signal a = Time - a) are no first class values anymore, only signal
  functions (type SF a b = Signal a - Signal b) are first class. Furthermore
  the handling of recursive dependencies/feedback is done solely in a loop
  arrow.
 
   I must say it is frustratring. I finally got to understand FRP from the SOE
  book, only to find out that it is not really the way to go ;-) Now I'm
  trying to grasp AFRP. It is incredibly interesting stuff, but for a
  not-so-abstract-thinking-average programmer like me, it is
  not an obvious task. Maybe *using* AFRP is easier than understanding the
  inner details...
 
   Maybe it would be a good idea for the community if someone (maybe me, if I
  find the time ;-) to write a very very simple game using AFRP and GHC 6.8.1?
  Even simpler than the Space Invaders game (which does not work anymore
  anyway), but which does show dynamic collections and switching? Maybe like
  Andrew Coppin mentioned, a very simple Tetris clone? Of course, this is not
  legal, Tetris is copyrighted, but maybe for tutorial purposes it can be
  allowed :)
 
 
   Don Stewart wrote:
   sk:
 
 
   On 19.11.2007, at 19:54, Peter Verswyvelen wrote:
 
 
   I can find the paper, but is the source code for that Space
  Invaders alike game also available somewhere?
 
   it's included here:
  http://haskell.org/yampa/afrp-0.4-src.tgz
 
  btw, does anybody know what's the current state of affairs with yampa/
  afrp? is the framework still developed further?
 
   Can we get this uploaded to hackage?
 
  -- Don
  ___
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 
 
 
 
  ___
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

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


Re: [Haskell-cafe] Searched for mdo on haskell.org. Found nothing.

2007-11-22 Thread Richard Kelsall

Mads Lindstrøm wrote:
...

Did I do something wrong when searching haskell.org?

Properly not. I think the problem is that haskell.org do not index
words, that have length = 3. MediaWiki (which I think haskell.org uses)
do not by default index short words (length = 3 or length = 4 - can't
remember which).

If you search for yhc you also get zero results, which does not make
sense either.

...

Yes, it does look like MediaWiki and so I guess from the number of
configuration options (if this is the right software)

http://www.mediawiki.org/wiki/Manual:Configuration_settings

there ought to be some clever setting somewhere rather than it needing
any programming. Maybe the full search has been switched off to save
resources? Experimenting with the search it seems to miss some longer
words too, but I can't see a pattern to it.


Richard.

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


[Haskell-cafe] Call external program and get stdout

2007-11-22 Thread Maurí­cio

Hi,

How can I call a program (like, for instance,
'grep text *') and get the standard output?
All actions I found (executeFile, system) do
not give me the output of the program.

Thanks,
Maurício

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


Re: [Haskell-cafe] Tetris

2007-11-22 Thread Bit Connor
On Nov 21, 2007 5:00 PM, Peter Verswyvelen [EMAIL PROTECTED] wrote:
  Last time I checked the SDL binding did not work properly on Windows when
 using GHCi.

The next version of hsSDL (current darcs) has documentation that
explains how to get ghci working.

The trick is to make copies of the SDL.dll, since for some reason the
way hsSDL is built through cabal, ghci looks for this dll under 2
additional names.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Call external program and get stdout

2007-11-22 Thread Jules Bean

Maurí­cio wrote:

Hi,

How can I call a program (like, for instance,
'grep text *') and get the standard output?
All actions I found (executeFile, system) do
not give me the output of the program.


http://haskell.org/ghc/docs/latest/html/libraries/process-1.0.0.0/System-Process.html
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Dynamically find out instances of classes (pluginsystem for haskell)

2007-11-22 Thread ChrisK
the standard way to do that is use an existential wrapper:

(This needs -fglasgow-exts or some flags)

 module Main where
 
 class Interface x where
   withName :: x - String
 
 data A = A String
 
 instance Interface A where
   withName (A string) =  Interface A with  ++ string ++  
 
 data B = B Int
 
 instance Interface B where
   withName (B int) =  Interface B with  ++ show int ++  
 
 data WrapInterface where
WrapInterface :: forall z. Interface z = z - WrapInterface
 
 a :: A
 a = A seven
 
 b :: B
 b = B 7
 
 listOfWrapInterface :: [WrapInterface]
 listOfWrapInterface = [ WrapInterface a
   , WrapInterface b
   , WrapInterface (A ())
   , WrapInterface (B (-2007))
   ]
 
 nameOfWrapped :: WrapInterface - String
 nameOfWrapped (WrapInterface q) = withName q
 
 instance Interface WrapInterface where
   withName = nameOfWrapped
 
 main = do
   putStrLn (show (map nameOfWrapped listOfWrapInterface))
   putStrLn (show (map withName listOfWrapInterface))
 

In ghci this prints:

*Main main
[ Interface A with seven , Interface B with 7 , Interface A with ()
, Interface B with -2007 ]
[ Interface A with seven , Interface B with 7 , Interface A with ()
, Interface B with -2007 ]

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


Re: [Haskell-cafe] Re: Dynamically find out instances of classes (pluginsystem for haskell)

2007-11-22 Thread Jason Dusek
ChrisK [EMAIL PROTECTED] wrote:
 the standard way to do that is use an existential wrapper:

Does this relate to the basket of fruit problem in object
oriented languages?

You created the existential wrapper to allow a multimorphic
list type?

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


[Haskell-cafe] Composing monads

2007-11-22 Thread Maurí­cio

Hi,

If I have two computations a-IO b
and b-IO c, can I join them to
get an a-IO c computation? I imagine
something like a liftM dot operator.

Thanks,
Maurício

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


Re: [Haskell-cafe] Composing monads

2007-11-22 Thread Jonathan Cast

On 22 Nov 2007, at 10:17 AM, Maurí cio wrote:


Hi,

If I have two computations a-IO b
and b-IO c, can I join them to
get an a-IO c computation? I imagine
something like a liftM dot operator.


This is called Kleisli composition, by the way; it's defined as (=)  
in Control.Monad.


jcc

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


Re: [Haskell-cafe] How to abort a computation within Continuation Monad?

2007-11-22 Thread Derek Elkins
On Thu, 2007-11-22 at 01:01 -0500, Dimitry Golubovsky wrote:
 Hi,
 
 I finally was able to write a function which grabs the remainder of
 the computation in Cont monad and passes it to some function, in the
 same time forcing the whole computation to finish by returning a final
 value.
 
 I am not sure what kind of wheel I have reinvented, but here it is:
 
 
 -- Home-grown continuation delimiter function. Passes remainder of the
 -- whole computation to a given function and forces the whole computation
 -- to complete by returning a final value. Something similar to returning
 -- a final value in plain CPS instead of invoking the continuation.
 --  f: function which the remainder of the program will be passed to.
 -- Remainder will not be evaluated.
 --  r: final value of the whole computation that the latter will be
 -- terminated with.
 
 delimit f r = Cont $ \c - runCont (return 0) $ \a - f (runCont (return a) 
 c) r

This is more complicated than it needs to be.
runCont (return 0) = \k - k 0
so
delimit f r = Cont $ \c - f (c 0) r


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


Re: [Haskell-cafe] Call external program and get stdout

2007-11-22 Thread Allan Clark

Jules Bean wrote:

Maurí­cio wrote:

Hi,

How can I call a program (like, for instance,
'grep text *') and get the standard output?
All actions I found (executeFile, system) do
not give me the output of the program.


http://haskell.org/ghc/docs/latest/html/libraries/process-1.0.0.0/System-Process.html 


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


I was using the following:
{-
 A small function for blindly running a process until it completes
 its output and then waiting for its exit code.
 We return both the output (excluding stderr) plus the exit code.
-}
getProcessOutput :: String - IO (String, ExitCode)
getProcessOutput command =
-- Create the process
 do (_pIn, pOut, pErr, handle) - runInteractiveCommand command
-- Wait for the process to finish and store its exit code
exitCode - waitForProcess handle
-- Get the standard output.
output   - hGetContents pOut
-- return both the output and the exit code.
return (output, exitCode)

You'll need the following imports:
import System.IO
 ( hGetContents )
import System.Process
 ( runInteractiveCommand
 , waitForProcess
 )
import System.Exit
 ( ExitCode ( .. ) )

regards
allan



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


Re: [Haskell-cafe] Re: More problems [Tetris]

2007-11-22 Thread Andrew Coppin

Lennart Augustsson wrote:

IMHO, no one in the right mind uses Windows voluntarily. :)
I'm forced to use it at work, and it's a pain.  But since many are 
forced to use Windows it would be nice if ghc was as well supported on 
Windows and Unix.


What he said. ;-)

I will say this: GHC itself (and the libraries that come with it) seem 
to work very well on Windows already. Download installer, double-click, 
press [Next] a few times, congratulations, you have a fully functional 
(get it?!) Haskell development box. Not much to improve there. (Well... 
GHC only adds itself to the current user's PATH, not system-wide. A 
switch for this would be nice...)


It's just installing anything from Hackage which turns out to be really 
difficult. I understand Windows developers are a tad rare round here, so 
maybe that's understandable. I'd certainly be interested in hearing 
about anything practical that I can do to improve things on the Windows 
side...


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


Re: [Haskell-cafe] question about ghci on windows ...

2007-11-22 Thread Andrew Coppin

Brandon S. Allbery KF8NH wrote:


On Nov 21, 2007, at 19:57 , Galchin Vasili wrote:


Hi Ian,

I am trying to dump out all function signatures exported from 
System.Directory. I just tried
inside ghci: :! ghc --show-iface System.Directory. This is getting 
closer ... thank you! However, now there appears to be a path 
problem because I get an error message:  System.Directory: 
openBinaryFile: does not exist (No such file or directory). ??


Just for reference:  --show-iface is intended to operate on an 
explicitly specified .hi file, not a module name.  You could locate 
System\Directory.hi in the ghc lib directory and run ghc --show-iface 
on that, or just use :browse.




Also, --show-iface dumps low-level compiler data. In particular, it 
doesn't necessarily show you exactly what the module exports - but 
rather, it shows you when GHC might inline into client modules. ;-) If 
you want the callable interface, you want to be using the :browse 
command, not playing with interface files.


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


Re: [Haskell-cafe] Composing monads

2007-11-22 Thread Brandon S. Allbery KF8NH


On Nov 22, 2007, at 13:17 , Maurí cio wrote:


If I have two computations a-IO b
and b-IO c, can I join them to
get an a-IO c computation? I imagine
something like a liftM dot operator.


If you have GHC 6.8.1, this is the Kleisli composition operator (=)  
in Control.Monad.  (There is also (=) which corresponds to (=).)


Prelude Control.Monad :i (=)
(=) :: (Monad m) = (a - m b) - (b - m c) - a - m c
-- Defined in Control.Monad
infixr 1 =
Prelude Control.Monad :i (=)
(=) :: (Monad m) = (b - m c) - (a - m b) - a - m c
-- Defined in Control.Monad
infixr 1 =

--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED]
system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED]
electrical and computer engineering, carnegie mellon universityKF8NH


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


[Haskell-cafe] Re: Dynamically find out instances of classes (pluginsystem for haskell)

2007-11-22 Thread ChrisK
Jason Dusek wrote:
 ChrisK [EMAIL PROTECTED] wrote:
 the standard way to do that is use an existential wrapper:
 
 Does this relate to the basket of fruit problem in object
 oriented languages?
 
 You created the existential wrapper to allow a multimorphic
 list type?
 

When you access the wrapped data then *_ONLY_* thing you can do with it is via
the type class(es) that the GADT was wrapping.

The example I gave had a single type class:

 data WrapInterface where
WrapInterface :: forall z. Interface z = z - WrapInterface
 

One could have multiple interfaces:

 data WrapInterface where
WrapInterface :: (Interface z,Show z,Num z) = z - WrapInterface
 

One could have more than one piece of data, note that WrapInterface takes three
parameters:

 data WrapInterface where
WrapInterface :: Interface z = z - z - z - WrapInterface


One could do both:
 data WrapInterface where
   WrapInterface :: (Interface z1, Show z2,Num z3) =
 z1 - z2 - z3 - WrapInterface

And so on.  You can even write something like: data WrapInterface' where
 WrapInterface' :: a - (a-String) - WrapInterface'
 
 listExample = [ WrapInterface' Hello (show . (++ World))
   , WrapInterface' 17 (show . succ)
   , WrapInterface' True (show . not)
   ]
 
 apply :: WrapInterface' - String
 apply (WrapInterface' item function) = function item
 
 main = do
   putStrLn (show (map apply listExample))

Now a WrapInterface' holds item a and a function a-String.  When you unwrap
this in a case statement you can then apply the function to the item to get the
String.  The output in ghci is:

*Main main
[\HelloWorld\,18,False]

-- 
Chris

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


Re: [Haskell-cafe] libSDL [Tetris]

2007-11-22 Thread Andrew Coppin

Bit Connor wrote:

Hello Andrew,

  

...yep, configure fails because it can't find sh. (Again.)



This error can safely be ignored on windows.
  


Apparently so. (A bit confusing then, no?)


I'm rather loathed to install a Unix emulator just so I can install
things from Hackage.



cygwin is not required to build hsSDL on windows.
  


Glad to hear it. :-)


By the way, it turns out that SDL at least comes with a little text file
explaining how to build it on Windows. (I overlooked this the first
time.) Sadly, after following the instructions I still can't build it.
The changes it told me to make didn't seem to have any effect. (And
manually editing configuration files and C headers isn't my idea of a
good time anyway...)



What error are you getting?
  


Many pages of them. Mostly about undefined symbols. I've deleted all the 
files now; I'll maybe have another go at it later so I can tell you the 
exact error.



The next version of hsSDL (or current darcs) will not require editing
of C headers.
  


Good. :-)


Editing the cabal config file is necessary so that the SDL include
files and libs can be found.
  


...because Windows uses DLLs instead of [whatever it is that Unix does]?


Out of curiosity, is there a reason I'm trying to compile the code
myself in the first place? Is it just because that's the Unix way, or
is there some deep reason why we can't just download prebuilt binaries?



I am in favour of the idea of providing prebuilt binaries. Do you
think something like the gtk2hs windows installer would be good?
  


Gtk2hs is certainly drop-dead easy to install, no doubt about that. 
(Modulo some tricky path fiddling if you install Glade seperately as 
well... but that's no fault of the Haskell package.)


Personally, given how tricky it generally is to build *most* things from 
source code (you have to have all the right tools to do it), I'd prefer 
to see *all* packages available in binary form. However, I guess the 
number of packages and possible target platforms makes this prohibitive...


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


Re: [Haskell-cafe] Re: More problems [Tetris]

2007-11-22 Thread Andrew Coppin

Brandon S. Allbery KF8NH wrote:


On Nov 22, 2007, at 14:25 , Andrew Coppin wrote:

It's just installing anything from Hackage which turns out to be 
really difficult. I understand Windows developers are a tad rare 
round here, so maybe that's understandable. I'd certainly be 
interested in hearing about anything practical that I can do to 
improve things on the Windows side...


I suspect this requires a wrapper around Cabal so a suitably equipped 
Windows developer can build a package and then wrap it up in an 
InstallerVise (or etc.) installer.


What's actually involved in installing a 100% Haskell package? I was 
under the impression you just need to put the compiled code somewhere 
nice, and then tell GHC where you put it?


Would it not be possible to write a Cabal package description that just 
takes a bunch of binary objects, puts them somewhere, and tells GHC?


(Obviously if the package is a binding to some external library things 
become more complex...)


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


Re: [Haskell-cafe] Re: More problems [Tetris]

2007-11-22 Thread Jonathan Cast

On 22 Nov 2007, at 11:16 AM, Andrew Coppin wrote:


Aaron Denney wrote:

On 2007-11-21, Andrew Coppin [EMAIL PROTECTED] wrote:


In short, lots of Haskell-related things seem to be extremely
Unix-centric and downright unfriendly towards anybody trying to set
things up on Windows. If I didn't already know a bit about Unix, I'd
be *really* stuck!



I'd say, rather, that windows is unfriendly towards open and working
common standards.



Or you could say that Windows *is* a common standard. (I stop  
short of working.) But it's unclear where such circular semantic  
fidgetting gets us. ;-)


Or you could say that focusing on ‘standards’ is a good way to side- 
step the issue of whether those standards are technically sound or  
not; and that if the combination of Windows and Haskell is  
technically unsound, there are four possibilities:


(0) Windows and Haskell are both themselves technically unsound;
(1) Windows is technically unsound, and Windows + Haskell  
incorporates this unsoundness;
(2) Haskell is technically unsound, and Windows + Haskell  
incorporates this unsoundness; or
(3) Windows and Haskell are both technically sound, but in  
incompatible ways.


I lean towards (1), naturally.

But this doesn't answer the question of whether the lowest-cost  
solution is to fix Windows or work around it, of course.


jcc

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


Re: [Haskell-cafe] More problems [Tetris]

2007-11-22 Thread Andrew Coppin

Bulat Ziganshin wrote:

Hello Andrew,

Wednesday, November 21, 2007, 9:26:45 PM, you wrote:

  

Hackage. ;-) But, alas, no. That doesn't work either. The reason? Well,
apparently Cabal can't find sh.



cabal by itself doesn't need sh. it's either required by library
installation or it as just information message
  


Cabal doesn't give me this message for other packages, so presumably 
something about GLUT makes Cabal think that sh is necessary.



i agree. haskell world today is something like unix world 10 years ago.
it attracts qualified people which step-by-step makes this world more
attractive for casual users. but we are in the middle of the long road
  


OK, so we agree a problem exists. Now, what can we do to solve it? :-)

My first question would be:

- Is there a viable alternative to sh scripts for installing packages?

If there is, it would seem it's just an issue of getting everybody to 
migrate to it. If there isn't, it looks like we need to make one...


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


Re: [Haskell-cafe] Re: More problems [Tetris]

2007-11-22 Thread Andrew Coppin

Aaron Denney wrote:

On 2007-11-21, Andrew Coppin [EMAIL PROTECTED] wrote:
  

In short, lots of Haskell-related things seem to be extremely
Unix-centric and downright unfriendly towards anybody trying to set
things up on Windows. If I didn't already know a bit about Unix, I'd
be *really* stuck!



I'd say, rather, that windows is unfriendly towards open and working
common standards.
  


Or you could say that Windows *is* a common standard. (I stop short of 
working.) But it's unclear where such circular semantic fidgetting 
gets us. ;-)


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


Re: [Haskell-cafe] Re: More problems [Tetris]

2007-11-22 Thread Brandon S. Allbery KF8NH


On Nov 22, 2007, at 14:25 , Andrew Coppin wrote:

It's just installing anything from Hackage which turns out to be  
really difficult. I understand Windows developers are a tad rare  
round here, so maybe that's understandable. I'd certainly be  
interested in hearing about anything practical that I can do to  
improve things on the Windows side...


I suspect this requires a wrapper around Cabal so a suitably equipped  
Windows developer can build a package and then wrap it up in an  
InstallerVise (or etc.) installer.


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED]
system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED]
electrical and computer engineering, carnegie mellon universityKF8NH


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


Re: [Haskell-cafe] Dynamically find out instances of classes (pluginsystem for haskell)

2007-11-22 Thread Andrew Coppin

Claus Reinke wrote:

I hope this is understandable what I'm trying to achieve here.


not really: the only classes in haskell are type classes, and
if there is any class instance missing at compile time, you
won't even get to runtime, so you don't have to worry
about loading instances at runtime!-)

perhaps you could describe the problem you are trying
to solve, rather than the solution you would like to see?


In [gasp!] Java, you can just stick compiled files into a folder, and 
write your main program such that ts scans this folder, loads anything 
it finds, and executes specific code within it. In other words, an 
instant plugin system. I imagine this is what the original poster is after.


I'm not 100% sure, but I think hsplugins can dynamically load compiled 
*.o files in this way. Not sure whether this requires the person running 
the main program to have GHC installed though.


Unlike Java, there's no reflection capabilities. This isn't too bad 
though; just write your own class definition to allow your main program 
to query the thing it just loaded and find out what it offers.


 class Describable d where
   available_functions :: d - [FunctionInfo]

 data FunctionInfo = FunctionInfo {name :: String, description :: 
String, ...}


Unlike general reflection (where you try to guess things from function 
names and so on), this can be taylored to exactly the kind of plugins 
you're trying to write.


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


Re: [Haskell-cafe] More problems [Tetris]

2007-11-22 Thread Brandon S. Allbery KF8NH


On Nov 22, 2007, at 14:22 , Andrew Coppin wrote:


My first question would be:

- Is there a viable alternative to sh scripts for installing packages?

If there is, it would seem it's just an issue of getting everybody  
to migrate to it. If there isn't, it looks like we need to make one...


ActiveState Perl?

Unfortunately, as long as you can't guarantee everything being  
installed in consistent places and/or invoked in consistent ways  
(which on Windows is well-nigh impossible due to conflicting version  
requirements) you need a way to search the system for stuff.  If you  
don't want to require that people on Windows have a reasonable  
scripting language installed for such, you get to bundle (or write) one.


It would be nice if Windows devs had come up with something like pkg- 
config; it'd be possible to do a minimal implementation just using  
CMD.EXE scripts (don't bother with the full GNU pkg-config framework,  
just have each package bundle a %foo%-CONFIG.CMD that dumps  
locations, compiler flags, etc. in an easily parsed form) and then a  
relatively simple Haskell module could check for packages by running  
their config scripts.  But this requires convincing all the non- 
Haskell third party libraries (GLUT, SDL, etc.) to add config scripts  
to their distributions; practically, I don't see this happening.


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED]
system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED]
electrical and computer engineering, carnegie mellon universityKF8NH


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


Re: [Haskell-cafe] Dynamically find out instances of classes (pluginsystem for haskell)

2007-11-22 Thread Leif Frenzel
I'm not 100% sure, but I think hsplugins can dynamically load compiled 
*.o files in this way. 

Correct.

Not sure whether this requires the person running 
the main program to have GHC installed though.

Yes, it does.

Thanks  ciao,
Leif



Unlike Java, there's no reflection capabilities. This isn't too bad 
though; just write your own class definition to allow your main program 
to query the thing it just loaded and find out what it offers.


 class Describable d where
   available_functions :: d - [FunctionInfo]

 data FunctionInfo = FunctionInfo {name :: String, description :: 
String, ...}


Unlike general reflection (where you try to guess things from function 
names and so on), this can be taylored to exactly the kind of plugins 
you're trying to write.


___
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] Composing monads

2007-11-22 Thread Brent Yorgey
On Nov 22, 2007 1:22 PM, Jonathan Cast [EMAIL PROTECTED] wrote:

 On 22 Nov 2007, at 10:17 AM, Maurí cio wrote:

  Hi,
 
  If I have two computations a-IO b
  and b-IO c, can I join them to
  get an a-IO c computation? I imagine
  something like a liftM dot operator.

 This is called Kleisli composition, by the way; it's defined as (=)
 in Control.Monad.

 jcc


Even if you didn't know about (=)  (I didn't, actually!), it's not too
hard to write yourself:

(=) :: (Monad m) = (a - m b) - (b - m c) - (a - m c)
(=) f g a = f a = g

There's no magic, just follow the types. =)

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


[Haskell-cafe] Source code for Visual Haskell

2007-11-22 Thread Felix Martini
Hi all,

The documentation of Visual Haskell mentions that the source code is
available under a BSD license. The code is not available from the
download page (http://www.haskell.org/visualhaskell/downloads.html).
Does anone know where to get it?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] libSDL [Tetris]

2007-11-22 Thread Bit Connor
On Nov 22, 2007 9:39 PM, Andrew Coppin [EMAIL PROTECTED] wrote:
  Editing the cabal config file is necessary so that the SDL include
  files and libs can be found.
 

 ...because Windows uses DLLs instead of [whatever it is that Unix does]?

The reason is that on Unix, there are standard location for header
files and libraries. On windows, they can be anywhere, and in the case
of SDL, they are inside the directory where SDL was installed.

  Out of curiosity, is there a reason I'm trying to compile the code
  myself in the first place? Is it just because that's the Unix way, or
  is there some deep reason why we can't just download prebuilt binaries?
 
 
  I am in favour of the idea of providing prebuilt binaries. Do you
  think something like the gtk2hs windows installer would be good?
 

 Gtk2hs is certainly drop-dead easy to install, no doubt about that.
 (Modulo some tricky path fiddling if you install Glade seperately as
 well... but that's no fault of the Haskell package.)

 Personally, given how tricky it generally is to build *most* things from
 source code (you have to have all the right tools to do it), I'd prefer
 to see *all* packages available in binary form. However, I guess the
 number of packages and possible target platforms makes this prohibitive...

On GNU/Linux it is usually not tricky at all to build things from
source, and a lot of people prefer it over installing binaries.

I do agree that binary packages should be available for windows.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Searched for mdo on haskell.org. Found nothing.

2007-11-22 Thread Tillmann Rendel

Hi Andrew,

Andrew Coppin wrote:
In general, I find *most* search functions to be fairly unhelpful. 
Google is the shining exception to this rule; it almost always seems to 
figure out what you're after.


I guess doing text searching is just a fundamentally difficult problem, 
and the guys at Google have spent a hell of a long time on it.


text searching is a well-known problem. ranking search results by 
relevance is the key to google's success. read the paper about google to 
learn more:


Sergey Brin and Lawrence Page,
The Anatomy of a Large-Scale Hypertextual Web Search Engine
in: Proceedings of the 7th International WWW Conference, 1998, Brisbane

http://infolab.stanford.edu/~backrub/google.html
http://infolab.stanford.edu/pub/papers/google.pdf

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


[Haskell-cafe] http/ftp library

2007-11-22 Thread Bulat Ziganshin
Hello Haskell-Cafe,

i write a file-processing utility and want to allow users open URLs
like the usual files. for this, i need a library with minimum the
following http functionality:

getFileSize url
readBuf url bufPtr offset size

ideally, it should also support ftp and allow to create ftp files:

h - create url
writeBuf h bufPtr size
close h

what libraries can i use? ghc 6.6.1, if it's important

-- 
Best regards,
 Bulat  mailto:[EMAIL PROTECTED]

___
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-22 Thread Greg Heartsfield
Additionally, I find this to be helpful for keeping out trailing
whitespace:

;; Highlight trailing whitespace in haskell files
(add-hook 'haskell-mode-hook
  '(lambda ()
 (setq show-trailing-whitespace t)))

Cheers,
-Greg Heartsfield

On Fri, Nov 16, 2007 at 06:14:57PM +0200, Valery V. Vorotyntsev wrote:
 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] http/ftp library

2007-11-22 Thread brad clawsie
if you need comprehensive support of http and ftp in one api/library, as
far as i know, the curl bindings are your only choice

related...i promised a while back to support packaging and
documentation of the curl bindings. this work is now delayed until
freebsd 7 gains haskell support (due to acquiring new hardware, i
had to upgrade my os). sorry to anyone who expected immediate results.


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