Re: [Haskell-cafe] Regression test utility suggestions?

2010-10-22 Thread Bernie Pope
On 22 October 2010 08:38, Peter Schmitz ps.hask...@gmail.com wrote:
 I am seeking suggestions for a regression test utility or framework
 to use while developing in Haskell (in a MS Windows environment).
 [snip]

For this kind of task I use shelltestrunner

   http://hackage.haskell.org/package/shelltestrunner

It can do recursive search through directories to find test cases,
which I find particularly handy.

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


[Haskell-cafe] Re: suspected problem with network.curl version 1.3.5

2010-10-22 Thread Johannes Waldmann
Perhaps you can use Network.Browser (from HTTP)
http://hackage.haskell.org/package/HTTP-4000.0.9

It handles cookies under the hood
(you don't see it, but it works)
because it keeps a browser session state.

J.W.






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


RE: [Haskell-cafe] Bug in HTTP (bad internal error handling)

2010-10-22 Thread Sittampalam, Ganesh
Bit Connor wrote:
 On Sat, Oct 16, 2010 at 10:29 AM, Claus Reinke
 claus.rei...@talk21.com wrote: 
 After it catches this error, the function returns (line 376):
 
 return (fail (show e))
 
 The fail is running in the Either monad (The Result type =
 Either). This calls the default Monad implementation of fail, which
 is just a call to plain old error. This basically causes the entire
 program to crash.
 
 Actually, it appears that simpleHTTP isn't actually supposed to
 throw an IOException, and it is instead supposed to return a
 ConnError result. So the real fix is to fix the code to make this
 happen. But 
 
 Sounds like a victim of
   http://hackage.haskell.org/trac/ghc/ticket/4159
 
 For mtl clients, 'fail' for 'Either' used to call 'Left'. That was
 changed, though the ticket does not indicate the library versions
 affected.
 
 This looks like the problem. Any idea how to get the HTTP package
 fixed? I could try making a patch myself, but I would prefer hearing
 from the HTTP maintainer first, who doesn't seem to be around.  

I've tried contacting him a few times about getting the base dependencies in 
HTTP bumped and an upload made, without success. This is a widely used package 
that's in the platform and that won't work with GHC 7.0 with the current 
dependencies, so it really needs to get fixed soon.

libraries@, what's the right way to proceed? Can I make a Debian-style 
non-maintainer upload with minimal changes to fix urgent issues like these?

Cheers,

Ganesh

=== 
Please access the attached hyperlink for an important electronic communications 
disclaimer: 
http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html 
=== 

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


Re: [Haskell-cafe] Haskell Weekly News: Issue 155 - October 20, 2010

2010-10-22 Thread wren ng thornton

On 10/21/10 5:38 AM, Ketil Malde wrote:

I'm always getting two copies of everything in haskell@, since
everything is cross-posted to -cafe.  Are there actually people
subscribed to -cafe, but *not* to hask...@?  And if so, why?


I am. In part because I don't want to get two copies of everything, but 
in part because I'm lazy. So adding another list to my reading queue, 
especially one that's specified as sort of being a subset of the content 
here, seems like it'd be too much.


Usually communities in this situation will have the subset list set up 
to automatically forward everything to the main list as well, in order 
to alleviate these sorts of things. Did I mention the lazy? :)


--
Live well,
~wren
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskellers design

2010-10-22 Thread wren ng thornton

On 10/21/10 2:32 PM, Christopher Done wrote:

[1] http://imgur.com/lnkE7.png
[2] http://previasports.com/haskellers_website/


I like the colour theme of the former and the layout of the latter.
The colour theme of the first is more professional, I think. I vote
that styles should be consistent.


+1.

I'd vote for the second layout (though the map looks glitched up) but 
changing the red/dayglow/teal/orange scheme to match the first color 
scheme better. The orange and teal of #2 are fairly close to the orange 
and navy of #1, so it shouldn't alter things too badly. Though because 
of the dark background, we may want #2' to have slightly lighter colors 
than #1. It's the dayglow and red which strike me as out of place.


--
Live well,
~wren
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Haskell Weekly News: Issue 155 - October 20, 2010

2010-10-22 Thread Peter Hercek

On 10/22/2010 09:37 AM, wren ng thornton wrote:

On 10/21/10 5:38 AM, Ketil Malde wrote:

I'm always getting two copies of everything in haskell@, since
everything is cross-posted to -cafe.  Are there actually people
subscribed to -cafe, but *not* to hask...@?  And if so, why?


I am. In part because I don't want to get two copies of everything, 
but in part because I'm lazy.


This is my case too. As for as the amount of messages, who cares. Get it 
through NNTP. You will download only the headers. Bodies will be 
downloaded only for messages you read. You can check only the threads 
you consider interesting. There is not much new threads. Mark newsgroup 
read is a quick operation.


I do not think HWN should not be posted to haskell-cafe. If you decide 
so I do not really care but post a message to haskell-cafe list that you 
are switching HWN to haskell list only (so I can subscribe there too).


Peter.

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


Re: [Haskell-cafe] Convert Either to Tree - Occurs check

2010-10-22 Thread André Batista Martins
Tks for the answer,
the data structure of Either is:


data  Either a b  =  Left a | Right b   deriving (Eq, Ord, Read, Show)

one example of what i want convert is:
 Left(Right(Left(Left(


No dia 22 de Outubro de 2010 04:58, Dan Piponi dpip...@gmail.com escreveu:

 André Batista Martins asked:

   i want convert  Either to a tree.
   Example:
Either ( Either  1 2 ) ( Either 3 4)  
  Branch ( Branch (Leafl 1)  (Leafr2) ) ( Branch (Leafl 3)  (Leafr4)) )

 Before writing the function to convert your data structure, why not
 try writing down the precise type signature you expect it to have.

 In fact, before that, try writing down the precise type signature of
 the thing you call an Either.
 --
 Dan

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


Re: [Haskell-cafe] [ANNOUNCE] text 0.10.0.0 - fast Unicode text handling

2010-10-22 Thread Ivan Lazar Miljenovic
On 22 October 2010 16:38, Bryan O'Sullivan b...@serpentine.com wrote:
 [Blog copy of the announcement here.]

 I just pushed it to bitbucket and github, and you can install it from
 the text site on Hackage in the usual way:

 cabal update
 cabal install text

 What's in this release?

 New functions for reading integers and floating point numbers, an
 oft-requested feature. They're fast, too: they range from parity with their
 bytestring counterparts, to up to 4 times faster. You can expect to parse 3
 to 4 million Int values per second out of a text file, or up 2 million
 Double values per second. They're also easy to use, give error messages, and
 come in strict and lazy variants.

 UTF-8 decoding and encoding are now very fast. They're up to 9x faster than
 they were, and close to the performance of pure C UTF-8 decoding and
 encoding.

 The Eq and Ord instances are also now very fast, up to 5x faster than
 before. They're now faster than the bytestring instances.

 Several other common functions received drive-by performance improvements
 too.

 Better protection against rare crashes on really huge volumes of data.

Is there a best practices guide on how to deal with Text values?

For example, I assume that it's better to try and use Text throughout
rather than continually packing String values (in my case, I'm looking
at using Text for I/O in graphviz; should I then start using Text
rather than String for all the parameters?).

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [ANNOUNCE] text 0.10.0.0 - fast Unicode text handling

2010-10-22 Thread Johan Tibell
On Fri, Oct 22, 2010 at 10:30 AM, Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com wrote:
 For example, I assume that it's better to try and use Text throughout
 rather than continually packing String values (in my case, I'm looking
 at using Text for I/O in graphviz; should I then start using Text
 rather than String for all the parameters?).

Yes. Just like with ByteString, frequent packs or unpacks kills
performance. The only thing I pack is compile time constants (and, at
least for ByteStrings, that's cheap).

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


Re: [Haskell-cafe] Re: Haskell Weekly News: Issue 155 - October 20, 2010

2010-10-22 Thread Ketil Malde
Peter Hercek pher...@gmail.com writes:

 I am. In part because I don't want to get two copies of everything,
 but in part because I'm lazy.

 This is my case too. As for as the amount of messages, who cares.

Right.  So the question is, what is (or should be) the contents of the
messages that are posted only to haskell@, but *not* crossposted to
café?  Because I think this set of messages is (or should be) empty,
which suggests that we

  1) remove the people subscribed to haskell-cafe@ from haskell@
  2) automatically post all messages to haskell@ to -cafe as well
  3) post announcements to haskell@ without any crossposting.

This way, most people will subscribe to -cafe and get a single copy of
each message, not miss out on any important stuff, and as an added
benefit discussion will mostly go to that list.  People who only want
low-bandwith subscription to announcements, HWN, and the like, may
subscribe to haskell@ only.

-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


Re: [Haskell-cafe] Bug in HTTP (bad internal error handling)

2010-10-22 Thread Sigbjorn Finne
On Fri, Oct 22, 2010 at 9:35 AM, Sittampalam, Ganesh 
ganesh.sittampa...@credit-suisse.com wrote:

 Bit Connor wrote:
  On Sat, Oct 16, 2010 at 10:29 AM, Claus Reinke
  claus.rei...@talk21.com wrote:
  After it catches this error, the function returns (line 376):
 
  return (fail (show e))
 
  The fail is running in the Either monad (The Result type =
  Either). This calls the default Monad implementation of fail, which
  is just a call to plain old error. This basically causes the entire
  program to crash.
 
  Actually, it appears that simpleHTTP isn't actually supposed to
  throw an IOException, and it is instead supposed to return a
  ConnError result. So the real fix is to fix the code to make this
  happen. But
 
  Sounds like a victim of
http://hackage.haskell.org/trac/ghc/ticket/4159
 
  For mtl clients, 'fail' for 'Either' used to call 'Left'. That was
  changed, though the ticket does not indicate the library versions
  affected.
 
  This looks like the problem. Any idea how to get the HTTP package
  fixed? I could try making a patch myself, but I would prefer hearing
  from the HTTP maintainer first, who doesn't seem to be around.


I've tried contacting him a few times about getting the base dependencies in
 HTTP bumped and an upload made, without success. This is a widely used
 package that's in the platform and that won't work with GHC 7.0 with the
 current dependencies, so it really needs to get fixed soon.


 libraries@, what's the right way to proceed? Can I make a Debian-style
 non-maintainer upload with minimal changes to fix urgent issues like
 these?


I'd be much obliged if you could, and I do apologise for leaving all of this
just hanging.

No time available for Haskell projects these days unfortunately, Opera
engine development taking up most of my waking hours. Getting someone to
take over HTTP would be best, or maybe rewrite it altogether..it is not the
prettiest thing around :)

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


Re: [Haskell-cafe] Re: Eta-expansion and existentials (or: types destroy my laziness)

2010-10-22 Thread Max Bolingbroke
On 19 October 2010 19:01, Dan Doel dan.d...@gmail.com wrote:
 However, this argument is a bit circular, since that eliminator could be
 defined to behave similarly to an irrefutable match.

Right.

 Or, put another
 way, eta expansion of a dictionary-holding existential would result in a value
 holding a bottom dictionary, whereas that's otherwise impossible, I think.

I think evaluating dictionaries strictly is more of a want to have
rather than actually implemented. In particular, GHC supports
building value-recursive dictionaries - and making dictionary
arguments strict indiscriminately would make this feature rather
useless.

I think this means that even with constrained existential things would be OK.

What is definitely not OK is lazy pattern matching on GADTs which have
*type equality* constraints on their existentials - because the type
equalities are erased at compile time, lazy pattern matching on a GADT
would leave no opportunity for us to observe that the proof of the
type equality was bogus (a bottom) - so allowing this would let our
programs segfault. For example, this program would erroneously
typecheck:


data Eq a b where
  Eq :: EQ a a

f :: Eq Int Bool - Bool
f (~Eq) = ((1 :: Int) + 1) :: Bool

main = print $ f undefined


I'm sticking with my unsafeCoerce based solution for now. It's ugly,
but it's nicely *localised* ugliness :-)

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


Re: [Haskell-cafe] Convert Either to Tree - Occurs check

2010-10-22 Thread Neil Brown

On 22/10/10 09:23, André Batista Martins wrote:

Tks for the answer,
the data structure of Either is:

data   Either  a  b   =   Left  a  |  Right  bderiving  (Eq,  Ord,  Read,  
Show)


one example of what i want convert is:
  Left(Right(Left(Left(
   

Hi,

The problem here is that the type of Left () is:

 Either () a

The type of Left (Left ()) is:

 Either (Either () a) b

The type of Right (Left (Left ())) is:

 Either c (Either (Either () a) b)

and finally, the type of Left (Right (Left (Left ( is:

 Either (Either c (Either (Either () a) b)) d

That is, each level in the tree must have a different type.  For this 
reason, you can't sensibly use Either for tree types of varying depth (a 
type-class would help, but I doubt it's what you want).  A sensible type 
for a tree is the one you gave in your original post, TreeE.  So why do 
you want to encode the tree with Either (not really possible) and then 
convert to your TreeE type?  Why not just start out with the values in 
your tree type?


Thanks,

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


[Haskell-cafe] Scrap your rolls/unrolls

2010-10-22 Thread Max Bolingbroke
Hi Cafe,

In generic programming, e.g. as in Data Types a la Carte and Compos,
you often wish to work with data types in their fix-point of a functor
form. For example:


data ListF a rec = Nil | Cons a rec
newtype List a = Roll { unroll :: ListF a (List a) }


In some presentations, this is done by factoring the fix point like so:


newtype FixF f = Roll { unroll :: f (FixF f) }
type List a = FixF (ListF a)


This is all well and good, but it means when working with data types
defined in this manner you have to write Roll and unroll everywhere.
This is tedious :-(

Something I have long wished for is equirecursion, which would let you
write this instead:


type List a = ListF a (List a)


Note that we now have a type instead of a newtype, so we won't need to
write any injection/extraction operators. However, currently GHC
rightly rejects this with a complaint about a cycle in type synonym
declarations.

However, you can use type families to hide the cycle from GHC:


type List a = ListF a (Force (ListThunk a))
data ListThunk a
type family Force a
type instance Force (ListThunk a) = List a


Unfortunately, this requires UndecidableInstances (the type instance
RHS is not smaller than the instance head). And indeed when we turn
that extension on, GHC goes into a loop, so this may not seem very
useful.

However, we can make this slight modification to the data type to make
things work again:


data ListF a rec = Nil | Cons a (Force rec)
type List a = ListF a (ListThunk a)


Note that the application of Force has moved into the *use site* of
rec rather than the *application site*. This now requires no
extensions other than TypeFamilies, and the client code of the library
is beautiful (i.e. has no rolls/unrolls):


example, ones :: List Int
example = Cons 1 (Cons 2 Nil)
ones = Cons 1 ones


We can factor this trick into a fix point combinator that does not
require roll/unroll:


type Fix f = f (FixThunk f)
type List a = Fix (ListF a)
data FixThunk f
type family Force a
type instance Force (FixThunk f) = Fix f


The annoying part of this exercise is the the presence of a Force in
the functor definition (e.g ListF) means that you can't make them into
actual Functor instances! The fmap definition gives you a function of
type (a - b) and you need one of type (Force a - Force b). However,
you can make them into a category-extras:Control.Functor.QFunctor
instance 
(http://hackage.haskell.org/packages/archive/category-extras/0.53.5/doc/html/Control-Functor.html)
by choosing the s Category to be:


newtype ForceCat a b = ForceCat { unForceCat :: Force a - Force b }

instance Category ForceCat where
  id = ForceCat id
  ForceCat f . ForceCat g = ForceCat (f . g)


Rather than the usual Hask Category which is used in the standard
Functor. This is somewhat unsatisfying, but I'm not sure there is a
better way.

I haven't seen this trick to emulate equirecursion before. Has it
showed up anywhere else?

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


Re: [Haskell-cafe] Bug in HTTP (bad internal error handling)

2010-10-22 Thread Michael Snoyman
On Fri, Oct 22, 2010 at 11:36 AM, Sigbjorn Finne
sigbjorn.fi...@gmail.com wrote:


 On Fri, Oct 22, 2010 at 9:35 AM, Sittampalam, Ganesh
 ganesh.sittampa...@credit-suisse.com wrote:

 Bit Connor wrote:
  On Sat, Oct 16, 2010 at 10:29 AM, Claus Reinke
  claus.rei...@talk21.com wrote:
  After it catches this error, the function returns (line 376):
 
  return (fail (show e))
 
  The fail is running in the Either monad (The Result type =
  Either). This calls the default Monad implementation of fail, which
  is just a call to plain old error. This basically causes the entire
  program to crash.
 
  Actually, it appears that simpleHTTP isn't actually supposed to
  throw an IOException, and it is instead supposed to return a
  ConnError result. So the real fix is to fix the code to make this
  happen. But
 
  Sounds like a victim of
    http://hackage.haskell.org/trac/ghc/ticket/4159
 
  For mtl clients, 'fail' for 'Either' used to call 'Left'. That was
  changed, though the ticket does not indicate the library versions
  affected.
 
  This looks like the problem. Any idea how to get the HTTP package
  fixed? I could try making a patch myself, but I would prefer hearing
  from the HTTP maintainer first, who doesn't seem to be around.


 I've tried contacting him a few times about getting the base dependencies
 in HTTP bumped and an upload made, without success. This is a widely used
 package that's in the platform and that won't work with GHC 7.0 with the
 current dependencies, so it really needs to get fixed soon.

 libraries@, what's the right way to proceed? Can I make a Debian-style
 non-maintainer upload with minimal changes to fix urgent issues like
 these?

 I'd be much obliged if you could, and I do apologise for leaving all of this
 just hanging.
 No time available for Haskell projects these days unfortunately, Opera
 engine development taking up most of my waking hours. Getting someone to
 take over HTTP would be best, or maybe rewrite it altogether..it is not the
 prettiest thing around :)

I know it may not be appropriate as-is due to its dependency list, but
http-enumerator[1] may be something to consider. It's still young, but
I think the API is pretty clean, and I've heard from users that it
performs favorably versus HTTP.

Michael

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


Re: [Haskell-cafe] Re: Eta-expansion and existentials (or: types destroy my laziness)

2010-10-22 Thread Dan Doel
On Friday 22 October 2010 5:48:28 am Max Bolingbroke wrote:
 I think evaluating dictionaries strictly is more of a want to have
 rather than actually implemented. In particular, GHC supports
 building value-recursive dictionaries - and making dictionary
 arguments strict indiscriminately would make this feature rather
 useless.

It now occurs to me that I might be thinking of your paper on strict core.

When does this come up? I only have one example that seems likely:

  data Mu f = In { out :: f (Mu f) }

  instance Show (f (Mu f)) = Show (Mu f) where
show = show . out

Is that an example of a value recursive dictionary? I also considered:

  data AnyShow = forall a. Show a = AS a

  instance Show AnyShow where
show (AS x) = AS ( ++ show x ++ )

  inf = AS inf

but I don't think the dictionary is actually recursive there. Translating to 
explicit dictionary passing seems to confirm the latter impression. The former 
is more iffy.

The most obvious way to build a value recursive dictionary would be an 
existential like:

  inf' = case inf' of AS x - AS (x, x)

but this is prevented from happening by the lack of irrefutable match.

 What is definitely not OK is lazy pattern matching on GADTs which have
 *type equality* constraints on their existentials.

This is certainly the more compelling deal breaker.

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


Re: [Haskell-cafe] Convert Either to Tree - Occurs check

2010-10-22 Thread André Batista Martins
Tks for the answser,
I need to continue a work that has already been developed. In this work i
have  Eithers and i want convert  to another datatype with more information,
because I want to generate  Eithers, which will contain the information from
the first but with positions exchanged.

No dia 22 de Outubro de 2010 11:30, Neil Brown nc...@kent.ac.uk escreveu:

  On 22/10/10 09:23, André Batista Martins wrote:

 Tks for the answer,
 the data structure of Either is:


 data  Either a b  =  Left a | Right b   deriving (Eq, Ord, Read, Show)


 one example of what i want convert is:
  Left(Right(Left(Left(

  Hi,

 The problem here is that the type of Left () is:

  Either () a

 The type of Left (Left ()) is:

  Either (Either () a) b

 The type of Right (Left (Left ())) is:

  Either c (Either (Either () a) b)

 and finally, the type of Left (Right (Left (Left ( is:

  Either (Either c (Either (Either () a) b)) d

 That is, each level in the tree must have a different type.  For this
 reason, you can't sensibly use Either for tree types of varying depth (a
 type-class would help, but I doubt it's what you want).  A sensible type for
 a tree is the one you gave in your original post, TreeE.  So why do you want
 to encode the tree with Either (not really possible) and then convert to
 your TreeE type?  Why not just start out with the values in your tree type?

 Thanks,

 Neil.

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


Re: [Haskell-cafe] Scrap your rolls/unrolls

2010-10-22 Thread Dan Doel
On Friday 22 October 2010 6:37:49 am Max Bolingbroke wrote:
 This is all well and good, but it means when working with data types
 defined in this manner you have to write Roll and unroll everywhere.
 This is tedious :-(

Your discovery is interesting (and I haven't seen it before).

Another solution, though, is SHE. With it, you can write:

  data ListF a r = NilF | ConsF a r
  newtype List a = Roll (ListF a (List a))

  pattern Nil   = Roll NilF
  pattern Cons x xs = Roll (ConsF x xs)

And not worry about Rolls anymore.

-- Dan

http://personal.cis.strath.ac.uk/~conor/pub/she/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Eta-expansion and existentials (or: types destroy my laziness)

2010-10-22 Thread Max Bolingbroke
On 22 October 2010 12:03, Dan Doel dan.d...@gmail.com wrote:
  data Mu f = In { out :: f (Mu f) }

  instance Show (f (Mu f)) = Show (Mu f) where
    show = show . out

 Is that an example of a value recursive dictionary?

Assuming the Show (f (Mu f)) instance uses the (Mu f) one, AFAIK this
should indeed build a loopy dictionary.

I think this extension was motivated by Scrap your Boilerplate with
Class - see section 5 of
http://research.microsoft.com/en-us/um/people/simonpj/papers/hmap/gmap3.pdf.

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


[Haskell-cafe] Re: Scrap your rolls/unrolls

2010-10-22 Thread Max Bolingbroke
Forgot to reply to list

On 22 October 2010 12:14, Dan Doel dan.d...@gmail.com wrote:
 Another solution, though, is SHE. With it, you can write:

  data ListF a r = NilF | ConsF a r
  newtype List a = Roll (ListF a (List a))

  pattern Nil       = Roll NilF
  pattern Cons x xs = Roll (ConsF x xs)

 And not worry about Rolls anymore.

Ah yes, pattern synonyms. This solution is somewhat unsatisfying
because you will also need some smart constructors:


nil = Roll NilF
cons x xs = Roll (ConsF x xs)


Now the names of the smart constructors for building the data type are
not the same as the things you pattern match on, which is a slightly
annoying asymmetry. It's certainly less complicated than the
TypeFamilies based solution though!

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


[Haskell-cafe] vector-space and standard API for vectors

2010-10-22 Thread Alexey Khudyakov

Hello everyone!

It's well known that Num  Co type classes are not adequate for vectors 
(I don't mean arrays). I have an idea how to address this problem.


Conal Elliott wrote very nice set of type classes for vectors. 
(Definition below). I used them for some time and quite pleased. Code is 
concise and readable.


 class AdditiveGroup v where
   zeroV :: v
   (^+^) :: v - v - v
   negateV :: v - v

 class AdditiveGroup v = VectorSpace v where
   type Scalar v :: *
   (*^) :: Scalar v - v - v

 class VectorSpace v = InnerSpace v where
   (.) :: v - v - Scalar v

There are few problems though. Fisrt one is inlining. Functions are not 
inlined so if client code uses uses stream fusion it breaks. Second is 
dependecies. Vector-space doesn't have big chain of dependencies. People 
may be reluctant to use vector-spaces just for API for small packages.


My proposal is to split type classes above into separate package which 
provide only type classes, doesn't have any dependencies.
Second point is to lean more on performance side in performance vs 
elegance. Add INLINE pragmas everywhere (unfortunate feature of stream 
fusion), move ^-^ to AdditiveGroup with default implementation.


I'd like to know opinion of haskellers on this and specifically opinion 
of Conal Eliott as author and maintainer (I CC'ed him)

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


[Haskell-cafe] tried to use the example given in the source of network.browser

2010-10-22 Thread Michael Litchard
This is what is in HTTPbis/Network/Browser.hs

do
  rsp - Network.Browser.browse $ do
   setAllowRedirects True -- handle HTTP redirects
   request $ getRequest http://google.com/;
  fmap (take 100) (getResponseBody rsp)


And how I changed it slightly to test it out


 import Network.HTTP
 import Network.Browser


 main =
 do
 rsp - Network.Browser.browse $ do
  setAllowRedirects True -- handle HTTP redirects
  request $ getRequest http://google.com/;
 fmap (take 100) (getResponseBody rsp)

but I got this errortest.lhs:10:39:
Couldn't match expected type `Network.Stream.Result (Response [a])'
   against inferred type `(Network.URI.URI, Response String)'
In the first argument of `getResponseBody', namely `rsp'
In the second argument of `fmap', namely `(getResponseBody rsp)'
In the expression: fmap (take 100) (getResponseBody rsp)


how did I get this error? I'm perplexed as this came right from the source.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ICFP 2011: Call for Workshop Proposals

2010-10-22 Thread Wouter Swierstra
  CALL FOR WORKSHOP AND CO-LOCATED EVENT PROPOSALS
 ICFP 2011
 16th ACM SIGPLAN International Conference on Functional Programming
  September 19 - 21, 2011
   Tokyo, Japan
   http://www.icfpconference.org/icfp2011

The 16th ACM SIGPLAN International Conference on Functional
Programming will be held in Tokyo, Japan on September 19-21,
2011.  ICFP provides a forum for researchers and developers to hear
about the latest work on the design, implementations, principles, and
uses of functional programming.

Proposals are invited for workshops (and other co-located events, such
as tutorials) to be affiliated with ICFP 2011 and sponsored by
SIGPLAN.  These events should be more informal and focused than ICFP
itself, include sessions that enable interaction among the attendees,
and be fairly low-cost.  The preference is for one-day events, but
other schedules can also be considered.

NEW THIS YEAR: The workshops are scheduled to occur on September 18
(the day before ICFP) and September 22-24 (the three days after ICFP).

--

Submission details
 Deadline for submission: November 19, 2010
 Notification of acceptance:  December 17, 2010

Prospective organizers of workshops or other co-located events are
invited to submit a completed workshop proposal form in plain text
format to the ICFP 2011 workshop co-chairs (Gabriele Keller and Derek
Dreyer), via email to icfp11-workshops at mpi-sws.org by November 19,
2010.  (For proposals of co-located events other than workshops,
please fill in the workshop proposal form and just leave blank any
sections that do not apply.)  Please note that this is a firm
deadline.

Organizers will be notified if their event proposal is accepted by
December 17, 2010, and if successful, depending on the event, they
will be asked to produce a final report after the event has taken
place that is suitable for publication in SIGPLAN Notices.

The proposal form is available at:

http://www.icfpconference.org/icfp2011/icfp11-workshops-form.txt

Further information about SIGPLAN sponsorship is available at:

http://acm.org/sigplan/sigplan_workshop_proposal.htm

--

Selection committee

The proposals will be evaluated by a committee comprising the
following members of the ICFP 2010 organizing committee, together with
the members of the SIGPLAN executive committee.

 Workshop Co-Chair: Gabriele Keller (University of New South Wales)
 Workshop Co-Chair: Derek Dreyer (MPI-SWS)
 General Co-Chair:  Manuel Chakravarty (University of New South Wales)
 General Co-Chair:  Zhenjiang Hu (National Institute of Informatics)
 Program Chair: Olivier Danvy (Aarhus University)

--

Further information

Any queries should be addressed to the workshop co-chairs (Gabriele
Keller and Derek Dreyer), via email to icfp11-workshops at mpi-sws.org.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] The Haskell theme

2010-10-22 Thread Thomas Schilling
I agree with Mark that we shouldn't try to over-constrain things.
However, basic startup-resources are perfectly fine.  It gives a good
default for people who don't really like (web-)design, and can serve
as a baseline for others.  I.e., encourage consistency but don't
enforce it.

On 12 October 2010 22:17, Christopher Done chrisd...@googlemail.com wrote:

 http://img840.imageshack.us/img840/3577/ideasv.png

I mostly like it, with the following remarks:

  - Only blue for a colour scheme is too cold.  This is why I used
this orange-red for the new wiki.  There are other ways to do this, of
course.  I'd just like to encourage people to not only use blueish
tones.

  - The wiki edit links in your sketch are very dark.  I prefer the
light grey as used in the new wiki, because it doesn't stand out that
much.


 To download the Inkscape SVG grab it here:
 http://chrisdone.com/designs/haskell-theme-1.svg

 I don't know what I was thinking here but it seemed like fun:
 http://img412.imageshack.us/img412/1827/rect5935.png

With a bit of tuning, this can look nice.


 I get bored really quickly, I was alright for 15 minutes and then I
 lost the will to point and click. Anyway, I was thinking rather than
 trying to come up with a brilliant all-encompassing design, we could
 agree on conventions:

 * colours
 * headings
 * spacing
 * links
 * the particular incarnation of the logo

 etc.

 I'm pretty happy to go with the colour theme of
 http://new-www.haskell.org/haskellwiki/Haskell

 Haskellers.com also makes me think we need an umbrella theme that
 encompasses all Haskell sites.

 Maybe we should do a theme poll like the logo poll. I don't know.
 Regardless, I think we do need to decide on something and stick with
 it. Should this discussion be taken to the web devel mailing list? Is
 that appropriate?
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe




-- 
Push the envelope. Watch it bend.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] tried to use the example given in the source of network.browser

2010-10-22 Thread Neil Brown

Hi,

On 22/10/10 14:58, Michael Litchard wrote:



main =
 do
 rsp- Network.Browser.browse $ do
  setAllowRedirects True -- handle HTTP redirects
  request $ getRequest http://google.com/;
 fmap (take 100) (getResponseBody rsp)
 

but I got this errortest.lhs:10:39:
 Couldn't match expected type `Network.Stream.Result (Response [a])'
against inferred type `(Network.URI.URI, Response String)'
 In the first argument of `getResponseBody', namely `rsp'
 In the second argument of `fmap', namely `(getResponseBody rsp)'
 In the expression: fmap (take 100) (getResponseBody rsp)


how did I get this error? I'm perplexed as this came right from the source.
   


To be specific, it came from the documentation of the library... which 
turns out not to match the source.  It seems you instead want:


 main = do
   (_, rsp) - Network.Browser.browse $ do
setAllowRedirects True -- handle HTTP redirects
request $ getRequest http://google.com/;
  print (take 100 $ rspBody rsp)

I've changed the last bit to print the first 100 lines of the result 
rather than return them, as I imagine that is what you want if you're 
using it as a main function.


Thanks,

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


Re: [Haskell-cafe] JavaScript in a browser as a Windows GUI?

2010-10-22 Thread Andrew Coppin

 On 21/10/2010 07:00 PM, Jeremy Shaw wrote:

But, you are correct that happstack does not currently have support
for running CGI executables. I imagine that you could write a CGI
handler (with out modifying the core code) in a few hours (maybe
less). Mostly just a matter of turning the values in the Request type
into a environment variables, and calling the executable?


And writing a HTTP server is mostly a matter of parsing the request 
headers and constructing some response headers. However, this turns out 
to be significantly less easy to do properly than you'd first imagine. ;-)



That said, I am not sure why you want CGI.


Because my hired web server runs Apache?

Sure, if I'm only doing stuff on the local machine, I can use any kind 
of server/application linkage I like, because I can use any server I 
want. But if I ever decide to actually put this stuff on the web, for 
real, it'll have to be plain CGI. (Or maybe FastCGI is supported, I'm 
not actually sure...) That being the case, I might as well develop it as 
CGI to start with.


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


Re: [Haskell-cafe] JavaScript in a browser as a Windows GUI?

2010-10-22 Thread Jeremy Shaw
On Fri, Oct 22, 2010 at 12:05 PM, Andrew Coppin
andrewcop...@btinternet.com wrote:
  On 21/10/2010 07:00 PM, Jeremy Shaw wrote:

 But, you are correct that happstack does not currently have support
 for running CGI executables. I imagine that you could write a CGI
 handler (with out modifying the core code) in a few hours (maybe
 less). Mostly just a matter of turning the values in the Request type
 into a environment variables, and calling the executable?

 And writing a HTTP server is mostly a matter of parsing the request
 headers and constructing some response headers. However, this turns out to
 be significantly less easy to do properly than you'd first imagine. ;-)

True. Though I am basing my assumption on the fact that we have code
which goes the opposite way (allows happstack to run as a CGI
process), and those bindings are pretty short (less than 100 lines)
and simple looking.

 That said, I am not sure why you want CGI.

 Because my hired web server runs Apache?

 Sure, if I'm only doing stuff on the local machine, I can use any kind of
 server/application linkage I like, because I can use any server I want. But
 if I ever decide to actually put this stuff on the web, for real, it'll have
 to be plain CGI. (Or maybe FastCGI is supported, I'm not actually sure...)
 That being the case, I might as well develop it as CGI to start with.

happstack-server has FastCGI support. Plain-old CGI support is no
great challenge either. Your web application is basically just a ,
ServerPart Response, value. Typically you would run that using
simpleHTTP

simpleHTTP :: (ToMessage a) = Conf - ServerPart a - IO ()

but you can just as easily run it as CGI using:

serverPartToCGI :: ToMessage a = ServerPart a - CGI CGIResult

(from the happstack-fastcgi package).

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


[Haskell-cafe] Redy to release gtk2hs-0.12.0!

2010-10-22 Thread Andy Stewart
Dear gtk2hs user:

We have ready to release next version : gtk2hs-0.12.0

Please pull gtk2hs darcs to test, if no bug report, we will
release.

You can use below commands (Debian) to install gtk2hs darcs:

   darcs get --lazy http://code.haskell.org/gtk2hs/
   cd ./gtk2hs
   sudo chmod +x ./bootstrap.sh
   ./bootstrap.sh 
   
Then recompile your gtk2hs program to test.   

Of course, any successful feedback are welcome!

Thanks,

  -- Gtk2hs Team

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


[Haskell-cafe] HSCurses - Hello World? (can't find much documentation)

2010-10-22 Thread Anonymous Void
Hi everyone,
Haven't posted here since I was a kid, when this language first warped my
poor imperative brain.
My main work environment is a three-split terminal session using `Yakuake'
as a dropdown-terminal (one for vim, one for interactive interpreter, one
for MySQL).

I don't mind using the MySQL cli *that* much,
but I find typing my queries all the time much takes up precious time when
I'm developing things, and it annoys me.

Since there is currently no TUI for mysql administration (besides
links/phpadmin? o.0).
I decided to make one, choosing Haskell because, well, it's awesome.

I've made curses apps before, but never in Haskell (only wx, cgi, cli, etc).
Couldn't find anything besides an api reference;
Which was impossible to find before typing haddock specifically, even after
an exhausting search on google, krugle, archives, etc...
It's livable (I've learned more complex things with less).
But since I've never seen how the HSCurses functions really integrate
together, or any tutorials/examples (besides hsFishEx),
I fear toying with it is going to be annoying until I figure it out on my
own, especially since I'm already doing a project for someone...

So, I was wondering if anyone would be kind enough to point me to (or write
me) a basic example of how HSCurses works,
maybe w/ some very simple example of interactivity (e.g. getch processing,
screen refresh, ..)  support.
Also, maybe warn me of some of the common pitfalls and differences in
hscurses vs ncurses in other languages.

Having found the haddock, and having done curses apps in other languages,
that should be enough for me to get a handle on it.
I'm just dreading the read the haddock, assume it works this way, find out
you do it this way, repeat loop of learning w/o a starting point.

Any help would be greatly appreciated, and will save me some (anticipated)
hassle.

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


Re: [Haskell-cafe] Re: Scrap your rolls/unrolls

2010-10-22 Thread Dan Doel
On Friday 22 October 2010 7:24:37 am Max Bolingbroke wrote:
 Ah yes, pattern synonyms. This solution is somewhat unsatisfying
 because you will also need some smart constructors:
 
 
 nil = Roll NilF
 cons x xs = Roll (ConsF x xs)
 
 
 Now the names of the smart constructors for building the data type are
 not the same as the things you pattern match on, which is a slightly
 annoying asymmetry. It's certainly less complicated than the
 TypeFamilies based solution though!

SHE's pattern synonyms also work as expressions, so there's no asymmetry. They 
work just like constructors as far as I can tell (with what little I've played 
with them); you can even partially apply them (in expressions). It doesn't do 
infix synonyms currently, though.

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


Re: [Haskell-cafe] HSCurses - Hello World? (can't find much documentation)

2010-10-22 Thread Ari Rahikkala
On Fri, Oct 22, 2010 at 11:18 PM, Anonymous Void byteasphy...@gmail.com wrote:
 But since I've never seen how the HSCurses functions really integrate
 together, or any tutorials/examples (besides hsFishEx),
 I fear toying with it is going to be annoying until I figure it out on my
 own, especially since I'm already doing a project for someone...
 So, I was wondering if anyone would be kind enough to point me to (or write
 me) a basic example of how HSCurses works,
 maybe w/ some very simple example of interactivity (e.g. getch processing,
 screen refresh, ..)  support.
 Also, maybe warn me of some of the common pitfalls and differences in
 hscurses vs ncurses in other languages.

UI.HSCurses.Curses follows ncurses quite closely so you can get pretty
far reading the NCurses Programming HOWTO:
http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/ .Don't forget to have
the ncurses man pages handy - usually you'll just need to lowercase
the name of a HSCurses function to get the name of the same function
in ncurses. If you're going to be using colours or styles (bold,
underline, etc), do take a look at CursesHelper too - its API
documentation is somewhat better than Curses's.

You could also try looking at the ContactManager program in hscurses's
example directory. Just to get you started, though, here's a trivial
HSCurses program to exhibit simple interaction (a walking '@'):

module Main where

import UI.HSCurses.Curses

-- | Useful for transforming a Char to a ChType. Not sure if this is
safe outside of the 7-bit ASCII range.
castEnum = toEnum . fromEnum

-- note that curses positions are (y, x) coordinates, with (0, 0)
being the upmost leftmost position
moveAbout pY pX = do
 erase -- clear curses's virtual screen but don't force a redraw
 mvAddCh pY pX (castEnum '@') -- place a character in curses's virtual screen
 refresh -- copy the virtual screen to the terminal
 c - getCh
 case c of
   KeyUp - moveAbout (pY - 1) pX
   KeyDown - moveAbout (pY + 1) pX
   KeyLeft - moveAbout pY (pX - 1)
   KeyRight - moveAbout pY (pX + 1)
   _ - return ()

main = do
 initCurses
 keypad stdScr True -- make the cursor keys usable
 echo False -- disable terminal echo
 cursSet CursorInvisible
 (sizeY, sizeX) - scrSize
 moveAbout (sizeY `div` 2) (sizeX `div` 2)
 endWin
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


profiling and strictness (was: Re: [Haskell-cafe] An interesting paper from Google)

2010-10-22 Thread Evan Laforge
 Any time you see something inexplicable like lots of time being attributed
 to something simple like get, it means that something isn't strict enough
 and get is having to force a bunch of lazy evaluations to do its job.
 Since you're using State.Strict but lift-ing to get there, I'd first look at
 the strictness of the monad you're lift-ing from.  (I'm assuming
 State.Strict does what the label says, but it's possible that it's not
 strict in the way you need; strictness is kinda tricky.)

Ahh, thanks, this makes sense to me.  The monads involved are an
ErrorT and one other strict StateT.  When the monads say they are
strict, they seem to mean that = will force the evaluation of the
monadic mechanics of the first argument when the second is demanded.
By monadic mechanics I mean the work done by = itself, so for
StateT it binds the result of the first argument with either 'let' or
'~(a, s') -' instead of 'case' or '(a, s') -'.  So in my
understanding, a lazy State will build thunks on every = and they
won't ever be forced until you pull the final value and pass it to a
strict function in IO like print or an FFI call, and then they are
forced recursively, at which point there is a stack overflow unless
it's a short sequence.

Talking about strictness seems complicated to me because it's not
really about what is actually forced, it's about who is forced by who
(i.e., when 'a' is forced then 'b' will be) and whether it's forced in
sequence or nested.  So a strict State is also not forced until the
strict IO function, but it turns into a sequential series of thunks
rather than a nested one.

If this is accurate, why would anyone want to use the lazy State?

Anyway, State doesn't provide the really critical bit of strictness,
which is in the actual state being modified.  So 'State.modify' will
inevitably lead to stack overflow if you don't intersperse 'get's in
there.  What is needed is both $! on State.put (or define your own
strict modify that puts $! on put), and strictness annotation of the
fields of the record that is being modified (provided it's a record
and not a scalar type).

In any case, ErrorT has a strict = by necessity, both States have a
strict =, and all modifys and puts (I think) are strict, as are all
the record fields.  In any case, a simple 'get' should only have to
force the state to whnf, so it shouldn't matter if the fields are huge
thunks or not, so really all that should matter is if the state is
already in whnf or is a huge nest of thunks.  Which a strict =
should prevent, right?  This is right next to a 'lookup' function
which is called twice as many times and should be doing more work
since it actually looks in a Map, but is credited with less cpu and
alloc.

A lift . get should turn into

-- ErrorT
a - do
  a - StateT (\s - return (s, s)) -- 'get' of the outer StateT
  return (a, s) -- = belongs to inner StateT
return (Right a)

Anyway, it's sort of a mishmash of semi inlined functions since this
is especially nested and hard to understand with transformers, but it
looks like a lot of applications of (\a - (a, s)) type functions, so
(,) constructors and a 'Right' constructor, inside of 'case's to make
sure this are evaluations and not allocations (and I remember from the
STG paper that a constructor inside a case need not even be
constructed).  So I don't totally understand where the forcing is
happening to make credit the 'get' with so much work.

BTW, I have a theory about what the '0' might mean... perhaps if a
function is inlined away, it still appears in the profile list, but
with 0 entries.

 Moral of the story:  time is accounted to the function that forces
 evaluation of lazy thunks, not to the thunks themselves or the function that
 created the lazy thunks.  (I think the latter is impossible without passing
 around a lot of expensive baggage, and in any case doesn't tell you anything
 useful; unexpected functions taking a lot of time, on the other hand, tells
 you right away that there's excessive laziness in the invocation somewhere
 and gives you a starting point to track it down.)

Indeed, this is a good point that I hadn't realized in quite that way
before, but tracking it down is still the tricky part.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Scrap your rolls/unrolls

2010-10-22 Thread Max Bolingbroke
On 22 October 2010 22:06, Dan Doel dan.d...@gmail.com wrote:
 SHE's pattern synonyms also work as expressions, so there's no asymmetry. They
 work just like constructors as far as I can tell (with what little I've played
 with them); you can even partially apply them (in expressions).

I didn't realise that - pretty cool!

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


Re[2]: [Haskell-cafe] concurrency vs. I/O in GHC

2010-10-22 Thread Bulat Ziganshin
Hello John,

Monday, October 18, 2010, 8:15:42 PM, you wrote:

 If anyone is listening, I would very much like for there to be a
 mechanism by which external functions can be called unsafe-ly, but
 without blocking all other Haskell threads.  I have code that does this:

+RTS -N2

-- 
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] readProcess exception

2010-10-22 Thread Bulat Ziganshin
Hello Leskó,

Friday, October 22, 2010, 1:50:54 AM, you wrote:

 I run into a problem with readProcessWithExitCode (from System.Process
 module). Basically what i want is to start an exe file, giving it some
 input on stdin and receiving the results on stdout. But id the stdin and

look for other functions in the library. one that you need should read
and write data simultaneously, for example by using separate thread


-- 
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] vector-space and standard API for vectors

2010-10-22 Thread wren ng thornton

On 10/22/10 8:46 AM, Alexey Khudyakov wrote:

Hello everyone!

It's well known that Num  Co type classes are not adequate for vectors
(I don't mean arrays). I have an idea how to address this problem.

Conal Elliott wrote very nice set of type classes for vectors.
(Definition below). I used them for some time and quite pleased. Code is
concise and readable.

  class AdditiveGroup v where
  zeroV :: v
  (^+^) :: v - v - v
  negateV :: v - v
[...]
I'd like to know opinion of haskellers on this and specifically opinion
of Conal Eliott as author and maintainer (I CC'ed him)


Just my standard complaint: lack of support for semirings, modules, and 
other simple/general structures. How come everyone's in such a hurry to 
run off towards Euclidean spaces et al.?


I'd rather see,

class Additive v where -- or AdditiveMonoid, if preferred
zeroV :: v
(^+^) :: v - v - v

class Additive v = AdditiveGroup v where
negateV :: v - v

type family Scalar :: * - *

class Additive v = LeftModule v where
(*^) :: Scalar v - v - v

class Additive v = RightModule v where
(^*) :: v - Scalar v - v

...

Though I don't know how much that'd affect the niceness properties you 
mentioned.


--
Live well,
~wren
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskellers design

2010-10-22 Thread Nubis
Hi guys,
It's me again, I made a new proposal for the website with the standard
colors.
I've put my pretentions of content being grouped by color, and just used
what I thought looked better for each part of the site.
Here's the link:
http://previasports.com/haskellers_website_standard/

Let me know what you think

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


[Haskell-cafe] Error Calling Lua Function

2010-10-22 Thread aditya siram
Hi all,
I'm having some issues calling Lua functions from Haskell. I have the
following in Haskell2Lua.lua:
function hello ()
   return hello world
end

And my Haskell file Haskell2Lua.hs looks like this:
import qualified Scripting.Lua as
Lua

main =
do

l -
Lua.newstate

Lua.openlibs
l

succ - Lua.loadfile l
/Haskell2Lua.lua

print succ


Lua.callproc l hello


Lua.close l

When I compile and run this file I get:
0
Haskell2Lua: user error (attempt to call a nil value)

I have tried some variations on calling the function including:
Lua.callproc l hello
Lua.callfunc l hello
Lua.callfunc l hello 

I know the Lua bridge is working because the following works:

Lua.callproc l print Hello from Lua

Any help is appreciated!
-deech
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] The Haskell theme Haskellers design

2010-10-22 Thread Mark Lentczner
You might have seen the post I did yesterday about the Haskell project I'm 
currently working on. In it I posted an screen shot or a web page, which you 
can find here:

http://mtnviewmark.files.wordpress.com/2010/10/source-editing.png

I think that page illustrates what I was thinking in terms of themes: It 
actually has yet a different color scheme, though it shares some colors with 
the basic pallet. What further ties it together, and what I'd like to propose 
Haskell sites use, is that top bar. It is the same as the top bar used in the 
Haddock Ocean theme.

For sites, I suggest the top bar appear as it does in that image: The Haskell 
logotype on the left (linked to haskell.org), and some or all of the community 
links on the right. (Though I think the lambdas should be smaller versions of 
the logo.) Specific site branding and navigation goes under.

Another way to use the bar would be like Haddock does: The left side contains 
the name of a major collection of pages. The links on the right are constant 
links to major sections.

- Mark

P.S.: The CSS for the top bar in that image can be found here:

http://github.com/mtnviewmark/barley/blob/master/seed/static/scaffold.css
Look for selectors with topbar in them.

The CSS for the same bar in Haddock can be found here:
http://code.haskell.org/haddock/html/Ocean.std-theme/ocean.css
Look for selectors with package-header in 
them.___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] The Haskell theme Haskellers design

2010-10-22 Thread Nubis
On Sat, Oct 23, 2010 at 1:27 AM, Mark Lentczner ma...@glyphic.com wrote:

 You might have seen the post I did yesterday about the Haskell project I'm
 currently working on. In it I posted an screen shot or a web page, which you
 can find here:

http://mtnviewmark.files.wordpress.com/2010/10/source-editing.png


That's cool!
I'm working on a proposal for the haskellers website and that top bar is
exactly what it's missing from it.

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