Re: [Haskell-cafe] The Haskell theme

2010-10-13 Thread Christopher Done
On 13 October 2010 05:49, Mark Lentczner ma...@glyphic.com wrote:
  I spent some time beforehand looking at what other successful language 
 communities do w.r.t. visual design. I found that none of the communities had 
 a single theme; most had two or three. but these themes were visually 
 harmonious. Furthermore, I found that they were used consistently, and that 
 the various themes were generally at the same level of polish.

Just out of interest, can you show some examples? A cursory glance at
Ruby, and I see that the home page[1] and their package site[2] are
completely different!

[1]: http://www.ruby-lang.org/en/
[2]: http://rubyforge.org/

 This means leaning toward consistent colors, and logo form, rather than exact 
 layout. Further, it seems more important that our projects get designers who 
 will do a thorough job, and less important that it be a single central 
 design group.

Indeed.

 It is no accident that the new Haddock backend looks like the new wiki 
 design: Thomas Schilling (nominolo) supplied the initial style sheet that the 
 Haddock team used to build the Ocean theme. I think this exemplifies what 
 we should strive for: The two projects look well together, look like they 
 have a relationship, and both are full treatments of their subjects. It isn't 
 so important that they have identical layouts or details.

Ah, I didn't notice! I see that there is a navy blue bar at the top, a
grey footer and the links are orange. This is generally good enough, I
suppose. Nice.

 Since parts of the Hackage site integrate so closely with the Haddock output, 
 I've been asked if I would take a stab at styling the new Hackage (or at 
 least the package pages). I'll be aiming to make that fit, but without being 
 100% rigid about conformance to the Ocean output.

Wwe could provide a base stylesheet which provides fonts, colours,
spacing, the heading and footer and logo. That way when you or anyone
starts on a new site you already have the base style upon which to
built, it will look like Haskell whatever layout or content you use.

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

 Lovely ideas there and I think a Haskell project built on those lines would 
 continue to look well with the wiki and Haddock.

Can we use this logo? Or can we pick one? Every site I see has a
different incarnation of it. The favicon of the new-www site is even
different to the logo that's on the left. In fact on the new-www site
the logo colour changes from the home page to sub pages!

This reminds me, do we have a good syntax highlighting theme?
HsColour's has always been pretty bad (no offence intended -- but
there is a reason people always redefine it).

 I'd lean toward us putting these thoughts down in the wiki, and developing a 
 set of guide posts for styling Haskell, rather than a strict set of 
 policies.

This sounds like a good idea. The Python site has a page like this[3],
ours could be a little more comprehensive regarding the polish, as
you say.

[3]: http://python.org/community/logos/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Who is afraid of arrows, was Re: [Haskell-cafe] ANNOUNCE: Haskell XML Toolbox Version 9.0.0

2010-10-13 Thread David Virebayre
2010/10/12 Gregory Crosswhite gcr...@phys.washington.edu:

 Also, I don't see why one would prefer  over the standard function
 composition operator, ..

With .  you have to read right-to-left to follow data's path.

For me that reading order isn't natural, and I imagine it is so for
most people which don't have a mathematical background.

Combined with = /  you have multiple reading direction in the same
expression, as in

expression  ( c . b . a ) `liftM` a1 = a2 = a3
reading order 6   5   41  2  3

So that could be one reason.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Who is afraid of arrows, was Re: ANNOUNCE: Haskell XML Toolbox Version 9.0.0

2010-10-13 Thread Heinrich Apfelmus

David Virebayre wrote:

Gregory Crosswhite wrote:


Also, I don't see why one would prefer  over the standard function
composition operator, ..


With .  you have to read right-to-left to follow data's path.

For me that reading order isn't natural, and I imagine it is so for
most people which don't have a mathematical background.

Combined with = /  you have multiple reading direction in the same
expression, as in

expression  ( c . b . a ) `liftM` a1 = a2 = a3
reading order 6   5   41  2  3

So that could be one reason.


That's why I'm usually using  =  instead of  = .


Regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.com

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


Re: [Haskell-cafe] Yi on Windows

2010-10-13 Thread Peter Marks
Thanks Jeff

What should I see when Yi loads? If my config file is broken, where should I
see errors? The debug option didn't produce anything useful.

After starting up, the help option does open my config, so I think it is in
the right place. This is Windows 7 if that makes any difference.

I'm happy to take a look at the source, any suggestions where I should
start?

Peter
On 13 Oct 2010 06:36, Jeff Wheeler wheel...@illinois.edu wrote:
 That bug is probably no longer correct. We now use the dyre package
 for loading the config. Does anybody know if dyre works on Windows in
 general?

 On Tue, Oct 12, 2010 at 5:39 PM, Peter Marks pe...@indigomail.net wrote:
 Does anyone use Yi on Windows? I've managed to get it to build and run,
but
 it doesn't seem to pick up a config file. This seems to be an issue
 identified over a year
 ago: http://code.google.com/p/yi-editor/issues/detail?id=269. This would
 seem to render the editor almost completely useless on Windows. The whole
 point is to have an editor you can customize in Haskell.
 Any suggestions appreciated.
 Thanks

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





 --
 Jeff Wheeler

 Undergraduate, Electrical Engineering
 University of Illinois at Urbana-Champaign
 ___
 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] Finite but not fixed length...

2010-10-13 Thread Jason Dusek
  Is there a way to write a Haskell data structure that is
  necessarily only one or two or seventeen items long; but
  that is nonetheless statically guaranteed to be of finite
  length?

--
Jason Dusek
Linux User #510144 | http://counter.li.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Finite but not fixed length...

2010-10-13 Thread Eugene Kirpichov
Hm. This is not actually an answer to your question, just a
discussion starter, but still.

The code below typechecks, though actually it shouldn't: there's no
type n such that ones is formed by the FL from some value of type
List Int n.
Or should it?

{-# LANGUAGE ExistentialQuantification, GADTs, EmptyDataDecls #-}
module Finite where

data Zero
data Succ a

class Finite a where

instance Finite Zero
instance (Finite a) = Finite (Succ a)

data List a n where
  Nil :: List a Zero
  Cons :: (Finite n) = a - List a n - List a (Succ n)

data FiniteList a where
  FL :: (Finite n) = List a n - FiniteList a

nil :: FiniteList a
nil = FL Nil

cons :: a - FiniteList a - FiniteList a
cons a (FL x) = FL (Cons a x)

list123 = cons 1 (cons 2 (cons 3 nil))

ones = cons 1 ones -- typechecks ok

2010/10/13 Jason Dusek jason.du...@gmail.com:
  Is there a way to write a Haskell data structure that is
  necessarily only one or two or seventeen items long; but
  that is nonetheless statically guaranteed to be of finite
  length?

 --
 Jason Dusek
 Linux User #510144 | http://counter.li.org/
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe




-- 
Eugene Kirpichov
Senior Software Engineer,
Grid Dynamics http://www.griddynamics.com/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Finite but not fixed length...

2010-10-13 Thread Max Bolingbroke
On 13 October 2010 08:57, Jason Dusek jason.du...@gmail.com wrote:
  Is there a way to write a Haskell data structure that is
  necessarily only one or two or seventeen items long; but
  that is nonetheless statically guaranteed to be of finite
  length?

Maybe you want a list whose denotation is formed by a least (rather
than a greatest) fixed point? i.e. the type of spine-strict lists:


data FinList a = Nil
   | Cons a !(FinList a)
   deriving (Show)


ones_fin = 1 `Cons` ones_fin

take_fin n Nil = Nil
take_fin n (Cons x rest)
  | n = 0= Nil
  | otherwise = Cons x (take_fin (n - 1) rest)

ones = 1 : ones

main = do
print $ take 5 ones
print $ take_fin 5 ones_fin


If you have e :: FinList a then if e /= _|_ it is necessarily of finite length.

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


Re: [Haskell-cafe] Finite but not fixed length...

2010-10-13 Thread Miguel Mitrofanov

 hdList :: List a n - Maybe a
hdList Nil = Nothing
hdList (Cons a _) = Just a

hd :: FiniteList a - Maybe a
hd (FL as) = hdList as

*Finite hd ones

this hangs, so, my guess is that ones = _|_


13.10.2010 12:13, Eugene Kirpichov пишет:

{-# LANGUAGE ExistentialQuantification, GADTs, EmptyDataDecls #-}
module Finite where

data Zero
data Succ a

class Finite a where

instance Finite Zero
instance (Finite a) =  Finite (Succ a)

data List a n where
   Nil :: List a Zero
   Cons :: (Finite n) =  a -  List a n -  List a (Succ n)

data FiniteList a where
   FL :: (Finite n) =  List a n -  FiniteList a

nil :: FiniteList a
nil = FL Nil

cons :: a -  FiniteList a -  FiniteList a
cons a (FL x) = FL (Cons a x)

list123 = cons 1 (cons 2 (cons 3 nil))

ones = cons 1 ones -- typechecks ok

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


Re: [Haskell-cafe] Finite but not fixed length...

2010-10-13 Thread Eugene Kirpichov
Well, it's easy to make it so that lists are either finite or bottom,
but it's not so easy to make infinite lists fail to typecheck...
That's what I'm wondering about.

2010/10/13 Miguel Mitrofanov miguelim...@yandex.ru:
  hdList :: List a n - Maybe a
 hdList Nil = Nothing
 hdList (Cons a _) = Just a

 hd :: FiniteList a - Maybe a
 hd (FL as) = hdList as

 *Finite hd ones

 this hangs, so, my guess is that ones = _|_


 13.10.2010 12:13, Eugene Kirpichov пишет:

 {-# LANGUAGE ExistentialQuantification, GADTs, EmptyDataDecls #-}
 module Finite where

 data Zero
 data Succ a

 class Finite a where

 instance Finite Zero
 instance (Finite a) =  Finite (Succ a)

 data List a n where
   Nil :: List a Zero
   Cons :: (Finite n) =  a -  List a n -  List a (Succ n)

 data FiniteList a where
   FL :: (Finite n) =  List a n -  FiniteList a

 nil :: FiniteList a
 nil = FL Nil

 cons :: a -  FiniteList a -  FiniteList a
 cons a (FL x) = FL (Cons a x)

 list123 = cons 1 (cons 2 (cons 3 nil))

 ones = cons 1 ones -- typechecks ok

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




-- 
Eugene Kirpichov
Senior Software Engineer,
Grid Dynamics http://www.griddynamics.com/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] The Haskell theme

2010-10-13 Thread Johan Tibell
On Wed, Oct 13, 2010 at 5:49 AM, Mark Lentczner ma...@glyphic.com wrote:
 I'd lean toward us putting these thoughts down in the wiki, and developing a 
 set of guide posts for styling Haskell, rather than a strict set of 
 policies.

Here's a strawman proposal for a very first guideline:

Body text defaults
==

Size: Equivalent to 13 px. in default browser settings
Color: #000 (black)

Motivation: I believe this is the most commonly used font size on the
web. Mark did a bunch of research on this so perhaps he can clarify.
Black gives a good contrast.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Finite but not fixed length...

2010-10-13 Thread Miguel Mitrofanov

 So... you want your ones not to typecheck? Guess that's impossible, since it's nothing 
but fix application...

13.10.2010 12:33, Eugene Kirpichov пишет:

Well, it's easy to make it so that lists are either finite or bottom,
but it's not so easy to make infinite lists fail to typecheck...
That's what I'm wondering about.

2010/10/13 Miguel Mitrofanovmiguelim...@yandex.ru:

  hdList :: List a n -  Maybe a
hdList Nil = Nothing
hdList (Cons a _) = Just a

hd :: FiniteList a -  Maybe a
hd (FL as) = hdList as

*Finite  hd ones

this hangs, so, my guess is that ones = _|_


13.10.2010 12:13, Eugene Kirpichov пишет:

{-# LANGUAGE ExistentialQuantification, GADTs, EmptyDataDecls #-}
module Finite where

data Zero
data Succ a

class Finite a where

instance Finite Zero
instance (Finite a) =Finite (Succ a)

data List a n where
   Nil :: List a Zero
   Cons :: (Finite n) =a -List a n -List a (Succ n)

data FiniteList a where
   FL :: (Finite n) =List a n -FiniteList a

nil :: FiniteList a
nil = FL Nil

cons :: a -FiniteList a -FiniteList a
cons a (FL x) = FL (Cons a x)

list123 = cons 1 (cons 2 (cons 3 nil))

ones = cons 1 ones -- typechecks ok

___
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] Finite but not fixed length...

2010-10-13 Thread Eugene Kirpichov
Well, in my implementation it's indeed impossible. It might be
possible in another one. That is the question :)
Perhaps we'll have to change the type of cons, or something.

13 октября 2010 г. 12:37 пользователь Miguel Mitrofanov
miguelim...@yandex.ru написал:
  So... you want your ones not to typecheck? Guess that's impossible, since
 it's nothing but fix application...

 13.10.2010 12:33, Eugene Kirpichov пишет:

 Well, it's easy to make it so that lists are either finite or bottom,
 but it's not so easy to make infinite lists fail to typecheck...
 That's what I'm wondering about.

 2010/10/13 Miguel Mitrofanovmiguelim...@yandex.ru:

  hdList :: List a n -  Maybe a
 hdList Nil = Nothing
 hdList (Cons a _) = Just a

 hd :: FiniteList a -  Maybe a
 hd (FL as) = hdList as

 *Finite  hd ones

 this hangs, so, my guess is that ones = _|_


 13.10.2010 12:13, Eugene Kirpichov пишет:

 {-# LANGUAGE ExistentialQuantification, GADTs, EmptyDataDecls #-}
 module Finite where

 data Zero
 data Succ a

 class Finite a where

 instance Finite Zero
 instance (Finite a) =    Finite (Succ a)

 data List a n where
   Nil :: List a Zero
   Cons :: (Finite n) =    a -    List a n -    List a (Succ n)

 data FiniteList a where
   FL :: (Finite n) =    List a n -    FiniteList a

 nil :: FiniteList a
 nil = FL Nil

 cons :: a -    FiniteList a -    FiniteList a
 cons a (FL x) = FL (Cons a x)

 list123 = cons 1 (cons 2 (cons 3 nil))

 ones = cons 1 ones -- typechecks ok

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







-- 
Eugene Kirpichov
Senior Software Engineer,
Grid Dynamics http://www.griddynamics.com/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Finite but not fixed length...

2010-10-13 Thread Steffen Schuldenzucker

I don't know too much about GADTs, but it works fine with fundeps:

http://hpaste.org/40535/finite_list_with_fundeps

(This is rather a draft. If anyone can help me out with the TODOs, I'd be 
happy.)

-- Steffen


On 10/13/2010 10:40 AM, Eugene Kirpichov wrote:
 Well, in my implementation it's indeed impossible. It might be
 possible in another one. That is the question :)
 Perhaps we'll have to change the type of cons, or something.
 
 13 октября 2010 г. 12:37 пользователь Miguel Mitrofanov
 miguelim...@yandex.ru написал:
  So... you want your ones not to typecheck? Guess that's impossible, since
 it's nothing but fix application...

 13.10.2010 12:33, Eugene Kirpichov пишет:

 Well, it's easy to make it so that lists are either finite or bottom,
 but it's not so easy to make infinite lists fail to typecheck...
 That's what I'm wondering about.

 2010/10/13 Miguel Mitrofanovmiguelim...@yandex.ru:

  hdList :: List a n -  Maybe a
 hdList Nil = Nothing
 hdList (Cons a _) = Just a

 hd :: FiniteList a -  Maybe a
 hd (FL as) = hdList as

 *Finite  hd ones

 this hangs, so, my guess is that ones = _|_


 13.10.2010 12:13, Eugene Kirpichov пишет:

 {-# LANGUAGE ExistentialQuantification, GADTs, EmptyDataDecls #-}
 module Finite where

 data Zero
 data Succ a

 class Finite a where

 instance Finite Zero
 instance (Finite a) =Finite (Succ a)

 data List a n where
   Nil :: List a Zero
   Cons :: (Finite n) =a -List a n -List a (Succ n)

 data FiniteList a where
   FL :: (Finite n) =List a n -FiniteList a

 nil :: FiniteList a
 nil = FL Nil

 cons :: a -FiniteList a -FiniteList a
 cons a (FL x) = FL (Cons a x)

 list123 = cons 1 (cons 2 (cons 3 nil))

 ones = cons 1 ones -- typechecks ok

 ___
 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] Desired behaviour of rounding etc.

2010-10-13 Thread Simon Marlow

On 12/10/2010 15:17, Daniel Fischer wrote:

On Tuesday 12 October 2010 11:18:39, Simon Marlow wrote:

On 09/10/2010 10:07, Daniel Fischer wrote:

On Saturday 09 October 2010 06:34:32, Lennart Augustsson wrote:

That code is incorrect.  You can't assume that the base for floating
point numbers is 2, that's something you have to check.
(POWER6 and z9 has hardware support for base 10 floating point.)



-- We assume that FLT_RADIX is 2 so that we can use more efficient
code #if FLT_RADIX != 2
#error FLT_RADIX must be 2
#endif




Making the assumption is fine (as we do in the code above), but the
important thing is to make the build fail in a very noisy way if the
assumption turns out to be wrong (as above).

Cheers,
 Simon


Are there any other places where FLT_RADIX == 2 is assumed?
(grepping the .hs, .lhs and .h files in the source tree for FLT_RADIX
revealed nothing else.)
If that's the only place where e.g. base 10 floating point would fail, we
should make it work for that too.
If on the other hand base 2 is assumed in other places, for primops,
whatever, and that assumption is not going to be changed, I'd prefer not to
litter the source with dead code.


I think the code in rts/StgPrimFloat.c assumes a lot about floating 
point representations.


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


Re: Who is afraid of arrows, was Re: [Haskell-cafe] ANNOUNCE: Haskell XML Toolbox Version 9.0.0

2010-10-13 Thread Paolo G. Giarrusso
On Oct 11, 3:20 pm, Uwe Schmidt u...@fh-wedel.de wrote:
 Hi Gregory,

  Is there some benefit that your library gets out of using arrows that I
  missed which makes these costs worth it?

 I thing, this is not a question of functionality, it's a question of style.
 Of course everything in hxt could have been done with monads,
 but does this also mean: Everything must have been done with monads?

I would like to answer yes here, following the inventor of monads,
and giving some more reasons.

1) With monads, you still get a monadic interface by using Keisli, if
you want. So your code would be strictly more reusable with monads.
Maybe there is also an inverse of Keisli defined somewhere - it still
makes more sense to use monads in your definitions.
If nothing else, I don't want to start reading a 56-page tutorial [1]
about an abstract concept to do XML processing (ArrowApply appears at
page 20).

2) Quoting from another mail:
Hughes himself said that when your arrow is an instance of
ArrowApply,
you are better off just sticking with monads, except for the usage of
point-free notation.

[See sec 2.4, page 14 of [1]]

But as argued, point-free notation is possible with monads, too - at
worst, nobody has put together a tutorial for doing it.

Given the less widespread knowledge about arrows, their bigger
complexities (twenty-seven arrow laws versus three monad laws) the
reduced number of available utilities, monads are better here.

My knowledge of arrows comes from an afternoon of study interleaved
with other stuff (so it's less than an afternoon) - but I soon started
to use Programming with Arrows, which is _not_ linked from the
reference of Control.Arrow, just from GHC's User Guide [2]. IMHO, you
probably also chose to use arrows instead of monads because of bad
docs by - namely, Control.Arrow docs should contain the above tip by
John Hughes, together with a link to (=); the whole debate wouldn't
need to exist.

Best regards

[1] Programming with Arrows, John Hughes tutorial at 5th
International Summer School on Advanced Functional Programming, 2004.
[2] http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/arrow-notation.html
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Who is afraid of arrows, was Re: [Haskell-cafe] ANNOUNCE: Haskell XML Toolbox Version 9.0.0

2010-10-13 Thread Uwe Schmidt
Hi Gregory,

  As I understood, John Hughes invented the arrows as a generalisation
  of monads, you say it's a less powerful concept. I'm a bit puzzled with
  that. Could you explain these different views.
 
 
 Consider the following example:
 
  f :: Int - m a
  f i = monads !! (i *5 `mod` length monads)
  where
  monads = [...] :: [m a]
 
 In this case, we see that the action chosen by f is a non-trivial 
 function of the input argument.  In general, there is no way that we can 
 represent this equivalently as an arrow.  The reason why is because, 

thanks for the explanation, I thik I got that.

  So, your advice is to throw away the whole arrow stuff in hxt-10 and
  redefined (or rename) the combinators on the basis of monads?
  ...
 Yes, of course it is!!!  Of course, given how much work you put into 
 hxt, you would most likely be a fool if you actually took my advice...  ;-)

Of course the remark about hxt-10 wasn't meant to be totally serious.

 So, no, despite the way I am probably coming across I am not actually 
 trying to convince you to rewrite your library from scratch to use 
 monads.  My actual goals are twofold:  First (driven by genuine 
 curiosity) to see if there is something that I missed that made arrows 
 be the natural choice for you to use in your library.  Second, to try 
 and convince people in the future who are considering basing their 
 libraries on arrows that they should only do this if monads do not give 
 them enough power as library authors.

I'm not really convinced of your point of view.  I agree much more with the
point of view that Sebastiaan Visser described in his post. Let me explain this.

HXT as other libraries (HXML, HaXml) defines an embedded DSL for processing XML.
When starting to work with this DSL, the main task for a user is to understand 
the
semantics of this DSL, the underlying data types, the primitive operations, the
combinators, how to execute a DSL program, and how to plug in own primitive
operations.

In HXT, the concept of a filter is the most important one. This concept
is a natural generalisation of a function (and that's what arrows are).
A user has to grasp this idea of a filter. And he/she can do
this even without knowing anything about arrows or monads.  
People knowing a little bit of Unix pipes and filter will become
easily familiar with the simple parts of this DSL.

As a user of this DSL, I'm not really interested whether it's implemented with 
arrows,
with monads, or something else, I just want to have the right combinators
to formulate the task to be performed by the program.

From the point of an implementer, we agree, that for HXT
an arrow based implementation
is equivalent to a monad based one. So there's no open point.

The intention with HXT was not to build a general purpose languages, where you 
can do
any kind of complex things. The intention was to build a (rather) simple and
and powerful language for processing XML, nothing more.
You may of course argue, whether we've found the right set of combinators,
but that's another story.
As Sebasiaan wrote in this reply, when processing XML, the cases
for higher order computations are not very frequent. The few combinators
available for this are, from a Real World Haskell point of view, sufficient.

To sum it up, I think, from an implementers point of view for this eDSL, we 
agree that both
ways arrows/monads are possible and rather similar. From a users point of
view, I prefer a simple and specialised DSL, you would prefer a more general 
one. 

Cheers,

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


Re: [Haskell-cafe] Finite but not fixed length...

2010-10-13 Thread Steffen Schuldenzucker

Hmm, ok, I simplified the idea[1] and it looks like I'm getting the same
problem as you when trying to drop the 'n' parameter carrying the length of
the list.

Sad thing.

[1] http://hpaste.org/40538/finite_list__not_as_easy_as_i

On 10/13/2010 10:43 AM, Steffen Schuldenzucker wrote:
 
 I don't know too much about GADTs, but it works fine with fundeps:
 
 http://hpaste.org/40535/finite_list_with_fundeps
 
 (This is rather a draft. If anyone can help me out with the TODOs, I'd be 
 happy.)
 
 -- Steffen
 
 
 On 10/13/2010 10:40 AM, Eugene Kirpichov wrote:
 Well, in my implementation it's indeed impossible. It might be
 possible in another one. That is the question :)
 Perhaps we'll have to change the type of cons, or something.

 13 октября 2010 г. 12:37 пользователь Miguel Mitrofanov
 miguelim...@yandex.ru написал:
  So... you want your ones not to typecheck? Guess that's impossible, since
 it's nothing but fix application...

 13.10.2010 12:33, Eugene Kirpichov пишет:

 Well, it's easy to make it so that lists are either finite or bottom,
 but it's not so easy to make infinite lists fail to typecheck...
 That's what I'm wondering about.

 2010/10/13 Miguel Mitrofanovmiguelim...@yandex.ru:

  hdList :: List a n -  Maybe a
 hdList Nil = Nothing
 hdList (Cons a _) = Just a

 hd :: FiniteList a -  Maybe a
 hd (FL as) = hdList as

 *Finite  hd ones

 this hangs, so, my guess is that ones = _|_


 13.10.2010 12:13, Eugene Kirpichov пишет:

 {-# LANGUAGE ExistentialQuantification, GADTs, EmptyDataDecls #-}
 module Finite where

 data Zero
 data Succ a

 class Finite a where

 instance Finite Zero
 instance (Finite a) =Finite (Succ a)

 data List a n where
   Nil :: List a Zero
   Cons :: (Finite n) =a -List a n -List a (Succ n)

 data FiniteList a where
   FL :: (Finite n) =List a n -FiniteList a

 nil :: FiniteList a
 nil = FL Nil

 cons :: a -FiniteList a -FiniteList a
 cons a (FL x) = FL (Cons a x)

 list123 = cons 1 (cons 2 (cons 3 nil))

 ones = cons 1 ones -- typechecks ok

 ___
 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] Re: Re: A question regarding cmdargs package

2010-10-13 Thread Henning Thielemann
Ben Franksen schrieb:
 Neil Mitchell wrote:
 This makes me curious.  What's the use case where you want to allow the
 user to pass arguments on the command line, but you don't want that user
 to be able
 to use '--help' to find out what arguments may be passed?
 
 I wanted to create a clone of an existing program that had no help option
 and instead gave the help output if it saw an invalid option.

I find it very annoying if a program floods my terminal with a help
page, when I just misspelled something. A short descriptive message that
points to the mistake would be of more help for me.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Finite but not fixed length...

2010-10-13 Thread Permjacov Evgeniy
 infinite value is value, that have no upper bound (see infinity
definition). So, you have to provide upper bound at compile time. Tree
example provides such bound.

On 10/13/2010 03:27 PM, Eugene Kirpichov wrote:
 Again, the question is not how to arrange that all non-bottom values
 are finite: this can easily be done using strictness, as in your List
 example.

 The trick is to reject infinite values in compile time. How can *this* be 
 done?

 13 октября 2010 г. 15:26 пользователь Permjacov Evgeniy
 permea...@gmail.com написал:
  On 10/13/2010 03:09 PM, Eugene Kirpichov wrote:

 1-st scenario: If you have, for example, 2-3 tree, it definitly has a
 root. If you construct tree from list and then match over root, the
 entire tree (and entire source list) will be forced. And on every
 update, 2-3 tree's root is reconstructed in functional setting. So, if
 you'll try to build 2-3 tree from infinite list, it will fail in process
 due insuffisient memory.
 Of course, you can make the same with
  data List a = Cons a (!List a) | Nil

 second scenario
 data Node a = Nil | One a | Two a a
 and so Node (Node (Node (Node a))) has at most 2^4 = 16 elements. with
 some triks you'll be able to set upper bound in runtime.

 I don't see how. Could you elaborate?

 13 октября 2010 г. 14:46 пользователь Permjacov Evgeniy
 permea...@gmail.com написал:
  On 10/13/2010 12:33 PM, Eugene Kirpichov wrote:
 I think, tree-like structure, used as sequence (like fingertrees), will
 do the work.
 but it's not so easy to make infinite lists fail to typecheck...
 That's what I'm wondering about.

 2010/10/13 Miguel Mitrofanov miguelim...@yandex.ru:
  hdList :: List a n - Maybe a
 hdList Nil = Nothing
 hdList (Cons a _) = Just a

 hd :: FiniteList a - Maybe a
 hd (FL as) = hdList as

 *Finite hd ones

 this hangs, so, my guess is that ones = _|_


 13.10.2010 12:13, Eugene Kirpichov пишет:
 {-# LANGUAGE ExistentialQuantification, GADTs, EmptyDataDecls #-}
 module Finite where

 data Zero
 data Succ a

 class Finite a where

 instance Finite Zero
 instance (Finite a) =  Finite (Succ a)

 data List a n where
   Nil :: List a Zero
   Cons :: (Finite n) =  a -  List a n -  List a (Succ n)

 data FiniteList a where
   FL :: (Finite n) =  List a n -  FiniteList a

 nil :: FiniteList a
 nil = FL Nil

 cons :: a -  FiniteList a -  FiniteList a
 cons a (FL x) = FL (Cons a x)

 list123 = cons 1 (cons 2 (cons 3 nil))

 ones = cons 1 ones -- typechecks ok
 ___
 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] Finite but not fixed length...

2010-10-13 Thread Jonas Almström Duregård
So all you need is a program that checks if your functions terminate. How
hard can it be, right? ;) Seriously though, since you would need static
termination guarantees on all functions that produce lists, you will
be severely restricted when working with them. It's like Haskell without
general recursion...

Anyway, here's a quick version where you can do cons, map and ++. The idea
is that any function that results in a larger list also results in a larger
type. Any function that works on finite lists of type a can have type
Finite s a as a parameter and since the finite module only exports the
limited : and ++ functions it should be safe. The inferred type of
safeLength = length . infinite is safeLength :: Finite s a - Int for
instance.

{-# Language EmptyDataDecls #-}

module Finite (
   emp
 , (-:)
 , map
 , (++)
 , infinite
 , module Prelude
 ) where

import Prelude hiding ((++), map)
import qualified Prelude

data Z
data S a
data Plus a b

newtype Finite s a = Finite {infinite :: [a]} deriving Show

instance Functor (Finite n) where
 fmap f = Finite . fmap f . infinite

emp :: Finite Z a
emp = Finite []

(-:) :: a - Finite n a - Finite (S n) a
(-:) a l = Finite $ a  : (infinite l)
infixr 5 -:

(++) :: Finite s1 a - Finite s2 a - Finite (S (Plus s1 s2)) a
(++) (Finite a) (Finite b) = Finite $ a Prelude.++ b
infixr 5 ++

map = fmap


/J

2010/10/13 Eugene Kirpichov ekirpic...@gmail.com:
 Well, it's easy to make it so that lists are either finite or bottom,
 but it's not so easy to make infinite lists fail to typecheck...
 That's what I'm wondering about.

 2010/10/13 Miguel Mitrofanov miguelim...@yandex.ru:
  hdList :: List a n - Maybe a
 hdList Nil = Nothing
 hdList (Cons a _) = Just a

 hd :: FiniteList a - Maybe a
 hd (FL as) = hdList as

 *Finite hd ones

 this hangs, so, my guess is that ones = _|_


 13.10.2010 12:13, Eugene Kirpichov пишет:

 {-# LANGUAGE ExistentialQuantification, GADTs, EmptyDataDecls #-}
 module Finite where

 data Zero
 data Succ a

 class Finite a where

 instance Finite Zero
 instance (Finite a) =  Finite (Succ a)

 data List a n where
   Nil :: List a Zero
   Cons :: (Finite n) =  a -  List a n -  List a (Succ n)

 data FiniteList a where
   FL :: (Finite n) =  List a n -  FiniteList a

 nil :: FiniteList a
 nil = FL Nil

 cons :: a -  FiniteList a -  FiniteList a
 cons a (FL x) = FL (Cons a x)

 list123 = cons 1 (cons 2 (cons 3 nil))

 ones = cons 1 ones -- typechecks ok

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




 --
 Eugene Kirpichov
 Senior Software Engineer,
 Grid Dynamics http://www.griddynamics.com/
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

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


Re: [Haskell-cafe] Re: Who is afraid of arrows, was Re: ANNOUNCE: Haskell XML Toolbox Version 9.0.0

2010-10-13 Thread C. McCann
On Wed, Oct 13, 2010 at 3:50 AM, Heinrich Apfelmus
apfel...@quantentunnel.de wrote:
 Combined with = /  you have multiple reading direction in the same
 expression, as in

 expression      ( c . b . a ) `liftM` a1 = a2 = a3
 reading order     6   5   4            1      2      3

 That's why I'm usually using  =  instead of  = .

Does it bother you that (=) is defined to be infixr 1, while ($)
and (*) are infixl 4? Or is that just me?

For instance, I might write the above expression as something like:

a3 = a2 = a . b . c $ a1

But this still seems awkward, because it mixes different fixities and
I have to mentally regroup things when reading it. Right associativity
here does make a certain amount of sense for monads, but
left-associativity is consistent with plain function application and
feels more natural to me.

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


Re: [Haskell-cafe] Finite but not fixed length...

2010-10-13 Thread Stephen Tetley
Hi Jonas

Nice, but how about a list destructor?

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


Re: [Haskell-cafe] Re: Re: A question regarding cmdargs package

2010-10-13 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 10/13/10 06:07 , Henning Thielemann wrote:
 Ben Franksen schrieb:
 I wanted to create a clone of an existing program that had no help option
 and instead gave the help output if it saw an invalid option.
 
 I find it very annoying if a program floods my terminal with a help
 page, when I just misspelled something. A short descriptive message that
 points to the mistake would be of more help for me.

He mentioned that he has backward compatibility constraints.  In an ideal
world

- -- 
brandon s. allbery [linux,solaris,freebsd,perl]  allb...@kf8nh.com
system administrator  [openafs,heimdal,too many hats]  allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon university  KF8NH
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAky1xmUACgkQIn7hlCsL25WWpwCdFM209D0Y0FfhBwgeOnfyuzJa
SoYAnAhNuo1uhFE6hNErRG8QdIPmQmB6
=XTVN
-END PGP SIGNATURE-
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Finite but not fixed length...

2010-10-13 Thread Jonas Almström Duregård
 Nice, but how about a list destructor

I'm not sure what you mean by destructor, if you mean an eliminator for
case analysis then you can make a function

finite :: b - (a - Finite s1 a - b) - Finite s2 a - b
finite b _ (Finite []) = b
finite _ f (Finite (x:xs)) = f x xs

If you men functions that possibly remove elements from lists, then you can
add definitions like these to the module:

filter = onList . Prelude.filter
tail = onList Prelude.tail

onList :: ([a] - [b]) - Finite s a - Finite s b
onList f = Finite . f . infinite

Don't export onList though! filter and map should be enough to define any
list function you want outside the module.

Note that the size-type doesn't correspond exactly to the size of the list,
but that's not really a problem as long as you only want to guarantee
finiteness.

/J

On 13 October 2010 16:41, Stephen Tetley stephen.tet...@gmail.com wrote:

 Hi Jonas

 Nice, but how about a list destructor?

  ;-)
 ___
 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] Finite but not fixed length...

2010-10-13 Thread Ozgur Akgun
Jonas,

2010/10/13 Jonas Almström Duregård jonas.dureg...@chalmers.se

 (++) :: Finite s1 a - Finite s2 a - Finite (S (Plus s1 s2)) a
 (++) (Finite a) (Finite b) = Finite $ a Prelude.++ b
 infixr 5 ++


Why do you have the S in the return type of Finite.++ ?

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


Re: [Haskell-cafe] Finite but not fixed length...

2010-10-13 Thread Jonas Almström Duregård
Why do you have the S in the return type of Finite.++ ?

Typo. Plus is sufficient.

What I would really like is a nice way of implementing concat (i.e.
concatenate a finite number of finite lists, of various sizes, into a
single finite list).

/J

2010/10/13 Ozgur Akgun ozgurak...@gmail.com

 Jonas,

 2010/10/13 Jonas Almström Duregård jonas.dureg...@chalmers.se

 (++) :: Finite s1 a - Finite s2 a - Finite (S (Plus s1 s2)) a
 (++) (Finite a) (Finite b) = Finite $ a Prelude.++ b
 infixr 5 ++


 Why do you have the S in the return type of Finite.++ ?

 Ozgur

 ___
 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] ghci - always show types

2010-10-13 Thread Ozgur Akgun
Cafe,

Just a quick question. Either I am hallucinating or there was a way of
saying ghci to always show types. It was working as if you typed :t it
after every line of input.

Sorry, I searched but couldn't find the option via google. Hope someone here
knows/remembers what I am talking about.

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


Re: [Haskell-cafe] ghci - always show types

2010-10-13 Thread Christopher Done
On 13 October 2010 17:55, Ozgur Akgun ozgurak...@gmail.com wrote:
 Just a quick question. Either I am hallucinating or there was a way of
 saying ghci to always show types. It was working as if you typed :t it
 after every line of input.
 Sorry, I searched but couldn't find the option via google. Hope someone here
 knows/remembers what I am talking about.

  Options for ':set' and ':unset':

+rrevert top-level expressions after each evaluation
+sprint timing/memory stats after each evaluation
+tprint type after evaluation

See :help to get this display.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ghci - always show types

2010-10-13 Thread Ozgur Akgun
On 13 October 2010 17:03, Christopher Done chrisd...@googlemail.com wrote:

  Options for ':set' and ':unset':

+rrevert top-level expressions after each evaluation
+sprint timing/memory stats after each evaluation
+tprint type after evaluation

 See :help to get this display.


Thanks!

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


Re: [Haskell-cafe] Finite but not fixed length...

2010-10-13 Thread Brent Yorgey
On Wed, Oct 13, 2010 at 12:13:29PM +0400, Eugene Kirpichov wrote:
 Hm. This is not actually an answer to your question, just a
 discussion starter, but still.
 
 The code below typechecks, though actually it shouldn't: there's no
 type n such that ones is formed by the FL from some value of type
 List Int n.
 Or should it?
 
 {-# LANGUAGE ExistentialQuantification, GADTs, EmptyDataDecls #-}
 module Finite where
 
 data Zero
 data Succ a
 
 class Finite a where
 
 instance Finite Zero
 instance (Finite a) = Finite (Succ a)
 
 data List a n where
   Nil :: List a Zero
   Cons :: (Finite n) = a - List a n - List a (Succ n)
 
 data FiniteList a where
   FL :: (Finite n) = List a n - FiniteList a
 
 nil :: FiniteList a
 nil = FL Nil
 
 cons :: a - FiniteList a - FiniteList a
 cons a (FL x) = FL (Cons a x)
 
 list123 = cons 1 (cons 2 (cons 3 nil))
 
 ones = cons 1 ones -- typechecks ok

Fascinating.  Doing

  ones' = Cons 1 ones'

of course does not typecheck (as expected) with an occurs check error
(can't unify n = S n).  But

  ones = cons 1 ones

does typecheck.  And it makes sense: I can see why cons has the type
it does, and given that type for cons this definition of ones is
perfectly well-typed.  But the upshot, which I had never considered,
seems to be that existentially quantified types are allowed to be _|_.

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


[Haskell-cafe] Things I would like to see in protocol-buffers

2010-10-13 Thread Mads Lindstrøm
Hi

I have been trying to use protocol-buffers[2], and I have some ideas
which would have improved the protocol-buffers package for my usage (and
maybe for others):

* hprotoc should have an option to generate messages with [Char], Int
and [] in stead of Utf8, Int32 and Seq. While some people may need the
speed of bytestrings, for others they are just cumbersome. And if you
need to convert bytestring to [Char] anyway (maybe some other library
requires [Char]) you really do not gain any performance anyway.

* Integration with System.IO.Handle, so that I would have a simpler
interface like:

readDelimitedMessage :: System.IO.Handle - IO MessageType
writeDelimitedMessage :: System.IO.Handle - MessageType - IO ()

* Union types. A common protocol buffers idiom for union types is[3]:

message Foo {
  enum FooType { SOME_FOO_MESSAGE = 0; ANOTHER_FOO_MESSAGE = 1; }
  
  message SomeFoo {
...
  }

  message AnotherFoo {
 ...
  }

  required FooType fooType = 1;

  optional SomeFoo someFoo = 2;
  optional AnotherFoo anotherFoo = 3;
}

While the message can (statically) contain both someFoo and anotherFoo,
it would be a runtime error. In reality it is a union type, that must
either contain someFoo or antoherFoo. It would be nice if one could mark
in the .proto file that hprotec should see Foo as a union type. Hprotoc
should then generate the Foo type as:

data Foo = SomeFoo ...
 | AnotherFoo ...

Maybe the custom option mechanism[1] can be used in the .proto file, to
implement this feature.

What do people think of these ideas?

Regards,


Mads Lindstrøm


[1] http://code.google.com/apis/protocolbuffers/docs/proto.html#options

[2] http://hackage.haskell.org/package/protocol-buffers

[3]
http://code.google.com/apis/protocolbuffers/docs/techniques.html#union

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


Re: [Haskell-cafe] Finite but not fixed length...

2010-10-13 Thread Stephen Tetley
Hi Jonas

Thanks - I was meaning an equivalent to viewl on Data.Sequence, on plain lists:

viewl :: [a] - Either () (a,[a])
viewl [] = Left ()
viewl (x:xs) = Right (x,xs)


It was a trick question because I can't see how you can do it without
decrement on the Peano numbers.

Best wishes

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


Re: [Haskell-cafe] Finite but not fixed length...

2010-10-13 Thread Jonas Almström Duregård
Hi Stephen,

I'm not sure I see the problem. You can do what you require with the
function i supplied (minus the typo). This is in the module (where the
Finite constructor is exposed)

finite :: b - (a - Finite s a - b) - Finite s a - b
finite b _ (Finite []) = b
finite _ f (Finite (x:xs)) = f x (Finite xs)

Then viewl can be defined anywhere,

viewl :: Finite s a - Either () (a, Finite s a)
viewl = finite (Left ()) (Right . (,))

Why would you ever decrease the Peano numbers? It's just an upper bound, not
an exact size.

/J

2010/10/13 Stephen Tetley stephen.tet...@gmail.com:
 Hi Jonas

 Thanks - I was meaning an equivalent to viewl on Data.Sequence, on plain
lists:

 viewl :: [a] - Either () (a,[a])
 viewl [] = Left ()
 viewl (x:xs) = Right (x,xs)


 It was a trick question because I can't see how you can do it without
 decrement on the Peano numbers.

 Best wishes

 Stephen

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


Re: Who is afraid of arrows, was Re: [Haskell-cafe] ANNOUNCE: Haskell XML Toolbox Version 9.0.0

2010-10-13 Thread Henning Thielemann
David Virebayre schrieb:
 2010/10/12 Gregory Crosswhite gcr...@phys.washington.edu:
 
 Also, I don't see why one would prefer  over the standard function
 composition operator, ..
 
 With .  you have to read right-to-left to follow data's path.
 
 For me that reading order isn't natural, and I imagine it is so for
 most people which don't have a mathematical background.
 
 Combined with = /  you have multiple reading direction in the same
 expression, as in
 
 expression  ( c . b . a ) `liftM` a1 = a2 = a3
 reading order 6   5   41  2  3

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


Re: [Haskell-cafe] Finite but not fixed length...

2010-10-13 Thread Stephen Tetley
Hi Jonas

Thanks - I was anticipating a type like this for the destructor:

viewl :: Finite s a - Either () (a, Finite (Predecessor s) a)

I didn't appreciate that the size type in your code represented the
upper bound and not the actual size.

Best wishes

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


Re: [Haskell-cafe] Re: Re: Make your Darcs repositories hashed?

2010-10-13 Thread Jason Dagit
On Tue, Oct 12, 2010 at 4:41 PM, Ben Franksen ben.frank...@online.dewrote:

 Jason Dagit wrote:
  On Tue, Oct 12, 2010 at 2:02 PM, Ben Franksen
  ben.frank...@online.dewrote:
 
  One minor but important note: the hashed format is *not* readable with a
  darcs-1 program:
 
  Sorry about that.  The support for hashed repos existed long before 2.0
  was released and so I misremembered the hashed support as appearing in a
  1.x release.
 
  It looks like you need at least 2.0 to read darcs 1 hashed repos.
 
  Upgrading to a modern darcs client is advised and is only a 'cabal
 install
  darcs' away.  I was under the impression that even debian stable has
 moved
  on to 2.x releases.  How is it that you have a 1.0.9 release candidate
  client still?

 Have you ever worked at a public institution? I recommend the
 experience... ;-)


Heh.  I once was a junior sysadmin at a university.  Yes, sometimes the
software people used was old.



 Seriously, the server is a debian etch (!) system. Also called debian
 old-stable. Of course I have long since installed newer version of darcs,
 but since I am not root there I cannot put it into /usr/local, so I cannot
 completely rule out the possibility that other users still use the
 ancient /usr/bin/darcs and will now have problems when they darcs get.


Isn't debian etch a security liability at this point?



 I do _not_ expect that this will lead to any serious trouble, as the latest
 stable darcs is just a small addition to the PATH away. Still, users should
 be warned that darcs-2.x is required.


Yes, sorry about that.  At the time I was having some trouble
finding authoritative info on it so I went with my memory, which was wrong.

As for your path, I'm reasonably confident that if you put your local darcs
at the front of your path then you're good to go.  I know that works for
local push, what I'm wondering about is push over ssh.  It seems easy for
you to test in this case.  I know darcs finds the right executable by
looking in PATH for 'darcs'.  What I can't know is whether the server you're
using lets you set PATH over ssh invocations that are non-interactive.  It's
entirely possible that has been disallowed by the sysadmins.

And again, darcs-2.x is installed on the haskell.org machine in question.

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


Re: [Haskell-cafe] Finite but not fixed length...

2010-10-13 Thread Jason Dusek
  Thanks everyone for your thoughtful replies. I might have
  expected a referral to a paper; it's a pleasant surprise
  to have these worked examples.

--
Jason Dusek
Linux User #510144 | http://counter.li.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Finite but not fixed length...

2010-10-13 Thread Daniel Peebles
One option could be something like:

data Z
data S n

data Vec n a where
  Nil :: Vec Z a
  Cons :: a - Vec n a - Vec (S n) a

data Length n where
  One :: Length (S Z)
  Two :: Length (S (S Z))
  Seventeen :: Length (S (S (S (S (S (S (S (S (S (S (S (S (S (S (S (S (S
Z)

data FixedVec a where
  FixedVec :: Legnth n - Vec n a - FixedVec a

But it's obviously rather cumbersome :)

On Wed, Oct 13, 2010 at 7:57 AM, Jason Dusek jason.du...@gmail.com wrote:

  Is there a way to write a Haskell data structure that is
  necessarily only one or two or seventeen items long; but
  that is nonetheless statically guaranteed to be of finite
  length?

 --
 Jason Dusek
 Linux User #510144 | http://counter.li.org/
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

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


[Haskell-cafe] Re: Re: Re: Make your Darcs repositories hashed?

2010-10-13 Thread Ben Franksen
Jason Dagit wrote:
 On Tue, Oct 12, 2010 at 4:41 PM, Ben Franksen
 ben.frank...@online.dewrote:
 Seriously, the server is a debian etch (!) system. Also called debian
 old-stable. Of course I have long since installed newer version of
 darcs, but since I am not root there I cannot put it into /usr/local, so
 I cannot completely rule out the possibility that other users still use
 the ancient /usr/bin/darcs and will now have problems when they darcs
 get.
 
 Isn't debian etch a security liability at this point?

Certainly. But the admin (there is just one for a all our machines) can only
do so much at a time...

 I do _not_ expect that this will lead to any serious trouble, as the
 latest stable darcs is just a small addition to the PATH away. Still,
 users should be warned that darcs-2.x is required.
 
 Yes, sorry about that.  At the time I was having some trouble
 finding authoritative info on it so I went with my memory, which was
 wrong.

No problem. I thought you were still an active darcs developer, so I assumed
you must know ;-)

 As for your path, I'm reasonably confident that if you put your local
 darcs
 at the front of your path then you're good to go.  I know that works for
 local push, what I'm wondering about is push over ssh.

Works only if the remote user be default uses darcs-2, too.

  It seems easy for
 you to test in this case.  I know darcs finds the right executable by
 looking in PATH for 'darcs'.  What I can't know is whether the server
 you're
 using lets you set PATH over ssh invocations that are non-interactive. 
 It's entirely possible that has been disallowed by the sysadmins.

Yes, but it is no problem, since we abandoned a special user for the repos a
while ago and now share stuff using group memebership. This works really
well if each user has her own group by default, because then you can set
umask to 002 and share directories by giving them to the shared group and
setting the S-bit (so that all files and subdirectories created there
inherit the group).

Oops. How did we drift this far off-topic?

Cheers
Ben

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


Re: [Haskell-cafe] Re: Re-order type (flip map)

2010-10-13 Thread Henning Thielemann
Stephen Tetley schrieb:
 On 11 October 2010 00:00, Johannes Waldmann
 waldm...@imn.htwk-leipzig.de wrote:
 My point was: you need to find/define two operators, not just one.
 Sure, I need  flip ($)  and  flip (.)

 Since the Prelude forgot to define these (and  flip map),
 the question was: are there established names for these two operators?

 
 (#) was quite established for flip ($) around 2000 - its in a couple
 of papers that appeared at the PADL conferences - one written by Erik
 Meijer, Daan Leijen and (I think) James Hook on scripting Microsoft
 Agents with COM. The authors noted reverse application with (#) gave
 code a nice OO-like reading.
 
 The other was Peter Thiemann's Wash - (#) is again flip ($) and (##)
 is flipped compose.

also in Functional Metapost.

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


Re: [Haskell-cafe] Re: Re-order type (flip map)

2010-10-13 Thread Henning Thielemann
Dan Doel schrieb:
 On Sunday 10 October 2010 5:32:16 pm Johannes Waldmann wrote:
 I mean instead of  h . g . f $ x
 I'd sometimes prefer   x ? f ? g ? h
 but what are the ?
 
 Note, before anyone gets too excited about this, there are some built-in 
 things about the language that make forward chaining less nice. For instance:
 
   (f $ \x - ...) /= (\x - ... ? f)
   (f $ do ...)/= (do ... ? f)

http://www.haskell.org/haskellwiki/Direction_of_data_flow

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


Re: [Haskell-cafe] a couple of cabal related questions

2010-10-13 Thread Neil Mitchell
I do this using a .ghci file. For Hoogle I have a file called Paths.hs
with the module name Paths_hoogle and stub exports. I then have my
.ghci file as:

:load Main.hs Paths.hs

Now Paths.hs will never interfere, or be picked up in ghc --make,
because it has the wrong name - but is used in ghci.

Thanks, Neil

On Wed, Oct 13, 2010 at 6:45 AM, Antoine Latter aslat...@gmail.com wrote:
 On Tue, Oct 12, 2010 at 10:41 PM, Ivan Lazar Miljenovic
 ivan.miljeno...@gmail.com wrote:
 On 13 October 2010 02:00, Magnus Therning mag...@therning.org wrote:
 On Tue, Oct 12, 2010 at 15:34, Dmitry V'yal akam...@gmail.com wrote:
 By the way, the 'version' variable doesn't mentioned in Cabal user
 guide, or
 at least I missed it. Is it documented somewhere?

 I don't know, I think I found it in the source more or less by mistake
 :-)

 Yeah, I think that's the common consensus; there is _some_
 documentation of the Paths_foo module in the Cabal user guide, but it
 doesn't cover much.

 One thing I do wish was possible: the ability to use a stub
 Paths_foo module for testing purposes (as currently you have to have
 done a cabal configure  cabal build to get it), but I couldn't
 find a way to do so without Cabal packaging the stub version when
 creating the distribution tarball :s


 I've used CPP, something like:

 module MyPaths
  ( export contents of Paths_magic ) where

 #ifdef SOME_DEF_SET_BY_CABAL
 import Paths_magic
 #else

 mock implementation of paths magic here

 #endif

 Then in your .cabal file declare the define which causes it to use the
 real magic paths module. When not compiling via cabal, you'll at least
 have something sensible (like the current directory or something).

 I'm pretty sure I didn't make this up, but I have used it. It's a bit
 of a pain to set up, though.

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

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


[Haskell-cafe] Re: How to make cabal pass flags to happy?

2010-10-13 Thread Niklas Broberg
On Fri, Oct 8, 2010 at 4:55 PM, Niklas Broberg niklas.brob...@gmail.com wrote:
 Hi all,

 I want to do something I thought would be quite simple, but try as I
 might I can't find neither information nor examples on how to achieve
 it.

 What I want specifically is to have happy produce a GLR parser from my
 .ly file, and I want this to happen during 'cabal install'. Which in
 turn means I want cabal to pass the --glr flag to happy during
 setup. My best guess is that I might want to use 'ppHappy' [1], or
 something in the vicinity, but there's no documentation for the
 combinator and it's far from obvious how to pass arguments to it.

 ... help? :-)

... anyone? ... please? :-)

Cheers,

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


Re: [Haskell-cafe] How to fix undefined reference error with getDataDir?

2010-10-13 Thread Henning Thielemann
Andy Stewart schrieb:
 Hi all,
 
 I have two package A and B, and B depend A.
 
 I use below code snippets in package A:
 
 -- code start --
 ...
 import Paths_manatee_ircclient
 import System.FilePath
 ...
   dir - getDataDir
   let imagePath imageName = dir / icons / (imageName ++ .png)
 ...
 -- code end   --
 
 Anyway, package A compile fine, but when i compile package B, i got
 below error:
 
 -- error start --
 Linking dist/build/manatee/manatee ...
 /home/andy/.cabal/lib/manatee-ircclient-0.0.1/ghc-6.12.3/libHSmanatee-ircclient-0.0.1.a(Smile.o):
  In function `s6sP_info':
 (.text+0x3bea): undefined reference to 
 `manateezmircclientzm0zi0zi1_Pathszumanateezuircclient_getDataDir3_closure'

Often these linker problems arise if A was altered and recompiled and
not all depending parts of B were recompiled. However, 'cabal install'
which in turn calls 'ghc --make' should automatically find and compile
the affected modules of B. Maybe it fails in trying to do so. I would
try to remove dist/build of packages A and B and then compile and
install the packages again.

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


Re: [Haskell-cafe] How to fix undefined reference error with getDataDir?

2010-10-13 Thread Andy Stewart
Henning Thielemann schlepp...@henning-thielemann.de writes:

 Andy Stewart schrieb:
 Hi all,
 
 I have two package A and B, and B depend A.
 
 I use below code snippets in package A:
 
 -- code start --
 ...
 import Paths_manatee_ircclient
 import System.FilePath
 ...
   dir - getDataDir
   let imagePath imageName = dir / icons / (imageName ++ .png)
 ...
 -- code end   --
 
 Anyway, package A compile fine, but when i compile package B, i got
 below error:
 
 -- error start --
 Linking dist/build/manatee/manatee ...
 /home/andy/.cabal/lib/manatee-ircclient-0.0.1/ghc-6.12.3/libHSmanatee-ircclient-0.0.1.a(Smile.o):
 In function `s6sP_info':
 (.text+0x3bea): undefined reference to
 manateezmircclientzm0zi0zi1_Pathszumanateezuircclient_getDataDir3_closure'

 Often these linker problems arise if A was altered and recompiled and
 not all depending parts of B were recompiled. However, 'cabal install'
 which in turn calls 'ghc --make' should automatically find and compile
 the affected modules of B. Maybe it fails in trying to do so. I would
 try to remove dist/build of packages A and B and then compile and
 install the packages again.
Hi Henning, thanks for reply.

I have fix this problem: I forgot add 'Paths_manatee_ircclient' in
other-modules of A.cabal , then package A compile fine, but package B
can't found path of module ''Paths_manatee_ircclient', then link failed.

After i add Paths_manatee_ircclient in A.cabal, problem fix.

Cheer,

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


Re: [Haskell-cafe] Finite but not fixed length...

2010-10-13 Thread Jonas Almström Duregård
...and you can always do

hack :: Vec n a - FixedVec a
hack x :: FixedVec undefined

Also I'm guessing 1, 2 and 17 are just examples, he really wants arbitrary
length finite lists.

/J

On 13 October 2010 20:47, Daniel Peebles pumpkin...@gmail.com wrote:

 One option could be something like:

 data Z
 data S n

 data Vec n a where
   Nil :: Vec Z a
   Cons :: a - Vec n a - Vec (S n) a

 data Length n where
   One :: Length (S Z)
   Two :: Length (S (S Z))
   Seventeen :: Length (S (S (S (S (S (S (S (S (S (S (S (S (S (S (S (S (S
 Z)

 data FixedVec a where
   FixedVec :: Legnth n - Vec n a - FixedVec a

 But it's obviously rather cumbersome :)


 On Wed, Oct 13, 2010 at 7:57 AM, Jason Dusek jason.du...@gmail.comwrote:

  Is there a way to write a Haskell data structure that is
  necessarily only one or two or seventeen items long; but
  that is nonetheless statically guaranteed to be of finite
  length?

 --
 Jason Dusek
 Linux User #510144 | http://counter.li.org/
 ___
 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] Haskell Weekly News: Issue 154 - October 13, 2010

2010-10-13 Thread Daniel Santa Cruz
   Welcome to issue 154 of the HWN, a newsletter covering developments in
   the Haskell community in the week of October 03 - 09.

   This community does not stand still! The last section of the newsletter
   contains a list of new or updated packages this passed week. All 87 of
   them! I had my doubts about listing them all, but there was
   encouragement from IRC folk to showcase them all, at least this time.

   If you are having a hard time filling your day with Haskell stories,
   make sure to jump into Reddit and help everyone by posting comments and
   voting on stories that are meaninful. If you manage to have time left
   after that, the volume of postings on the mailing lists is more than
   one person can keep up with. Send threads that you think the rest of
   the community would benefit from. For those of you who manage to have
   extra-extra time, you can use [1]twitterfall to try to keep up with the
   many tweets about Haskell!

   So, what was hot this week?

Announcements

   Want to know what events are comming up in the community? Come and see
   the [2]Haskell Community Calendar. Send new events to dstc...@gmail.com

   Michael Snoyman [3]announced and asked for advice on [4]Haskellers.com.
   If you are into Haskell, by all means, please stop by and make a
   profile on the site!

   A new version of the venerable Haskell XML Toolbox (version 9.0.0)
   [5]was announced by Uwe Schmidt.

   A package for tls, native TLS/SSL protocol implementation [6]was
   announced by Vincent Hanquez.

Interesting Threads on Haskell-Cafe

   Petr Pudlak Asked if there are any suggested/recommended Haskell coding
   conventions? Perhaps something like Java has? [7]see thread

   caseyh commented of difficulties with GUIs working under Windows. The
   thread included talk about the state of Haskell GUI programming in
   general. [8]see thread

   Don Steward and Duncan Coutts presented a status report on the Haskell
   distribution infrastructure: Hackage, Haskell Platform and Cabal,
   during the Haskell Implementors Workshop held in Baltimore. You can
   find the [9]slides and the [10]video of the presentation.

   Christopher Done [11]annouced that he has been doing some refactoring
   on Haskell web development entries on the Wiki.

   Max Bolingbroke [12]told us about a proposed haskell feature:
   lambda-case/lambda-if. There seems to be interest from multiple people
   to see this feature. Some modifications to the original syntax were
   also proposed in the thread.

Top Reddit Stories

 * Learn You a Haskell for Great Good! The Book!
   Domain: amazon.com
   Score: 72, Comments: 28
   On Reddit: http://bit.ly/dp07AZ
   Original: http://amzn.to/b1JYWM
 * LYAH: For A Few Monads More
   Domain: learnyouahaskell.com
   Score: 64, Comments: 25
   On Reddit: http://bit.ly/bLQMsD
   Original: http://bit.ly/dpkD0R
 * Real World Experiences with Long Running Haskell Servers?
   Domain: self.haskell
   Score: 34, Comments: 25
   On Reddit: http://bit.ly/9NTcLo
 * Want professional work in Haskell? Don't forget to register your skills
   Domain: haskellers.com
   Score: 28, Comments: 21
   On Reddit: http://bit.ly/9bqlhG
   Original: http://www.haskellers.com/
 * Enumerators Tutorial Part 3: Enumeratee
   Domain: docs.yesodweb.com
   Score: 25, Comments: 1
   On Reddit: http://bit.ly/d3RPP0
   Original: http://bit.ly/dwEOWO
 * Scheduling Lazy Evaluation on Multicore : Simon Marlow : Video
   Domain: vimeo.com
   Score: 24, Comments: 5
   On Reddit: http://bit.ly/cGXeFJ
   Original: http://vimeo.com/15573590
 * Scrap Your Zippers : Michael Adams : Video
   Domain: vimeo.com
   Score: 23, Comments:
   On Reddit: http://bit.ly/aco7b6
   Original: http://www.vimeo.com/15481513
 * [The Haskell Platform] libraries process is a trackless mire
   Domain: haskell.org
   Score: 21, Comments: 7
   On Reddit: http://bit.ly/cby0zw
   Original: http://bit.ly/a62xg0
 * Angel: a daemon that runs and monitors other processes, developed by Bump
   Domain: github.com
   Score: 19, Comments:
   On Reddit: http://bit.ly/9P8Ccm
   Original: http://github.com/jamwt/Angel#readme
 * The HTML purification manifesto (Inside 245s)
   Domain: blog.ezyang.com
   Score: 15, Comments:
   On Reddit: http://bit.ly/a6Bu4N
   Original: http://bit.ly/duCoSz

Top StackOverflow Questions

 * haskell regex substitution (votes: 8, answers: 1)
   http://bit.ly/b34nPB
 * What is the Haskell response to Node.js? (votes: 6, answers: 2)
   http://bit.ly/9YKRPj
 * Conventions for Stability field of Cabal packages (votes: 5,
   answers: 2)
   http://bit.ly/cxDksd
 * is there a lazy way to write the minus function (remove items from
   a list)? (votes: 4, answers: 3)
   http://bit.ly/c85gi9
 * maybe-like function 

Re: [Haskell-cafe] Re: Re: Re: Make your Darcs repositories hashed?

2010-10-13 Thread Jason Dagit
On Wed, Oct 13, 2010 at 11:56 AM, Ben Franksen ben.frank...@online.dewrote:


  As for your path, I'm reasonably confident that if you put your local
  darcs
  at the front of your path then you're good to go.  I know that works for
  local push, what I'm wondering about is push over ssh.

 Works only if the remote user be default uses darcs-2, too.


Yes, I guess I didn't explain that well.  What I meant is:  On the remote
host, put your 'user' version of darcs (the darcs-2.x client) first in your
path.  Whether this is sufficient depends on the ssh-server configuration.
 For most people, it will be sufficient.

I have a feeling you understand that but I'm not certain, hence the
repeating :)

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


Re: [Haskell-cafe] a couple of cabal related questions

2010-10-13 Thread Ivan Lazar Miljenovic
On 14 October 2010 05:58, Neil Mitchell ndmitch...@gmail.com wrote:
 I do this using a .ghci file. For Hoogle I have a file called Paths.hs
 with the module name Paths_hoogle and stub exports. I then have my
 .ghci file as:

 :load Main.hs Paths.hs

 Now Paths.hs will never interfere, or be picked up in ghc --make,
 because it has the wrong name - but is used in ghci.

Oh, I like this solution.  I wonder how well it plays with
running ghci in emacs via haskell-mode...

-- 
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


[Haskell-cafe] Hexpat: Lazy I/O problem with huge input files

2010-10-13 Thread Aleksandar Dimitrov
Hello Haskell Cafe,

I really hope this is the right list for this sort of question. I've
bugged the folks in #haskell, they say go here, so I'm turning to you.

I want to use Hexpat to read in some humongous XML files (linguistic
corpora,) since it's the only Haskell XML library (I could find) that
takes ByteStrings as input. I stumbled on a problem when using one of
the examples from the docs of Text.XML.Expat.Tree. The cookbook
recipe there suggests *first* processing the data, and only then
looking into the parser error to see if there has been an error. I
understand this should prevent the parse tree from being fully
evaluated before use. Unfortunately, that is not what happens on my
system (ghc 6.12.1, if that's of importance.)

This is the code from the docs, that I modified to read files:

 import Text.XML.Expat.Tree
 import System.Environment (getArgs)
 import Control.Monad (liftM)
 import qualified Data.ByteString.Lazy as C
·
 -- This is the recommended way to handle errors in lazy parses
 main = do
     f - liftM head getArgs = C.readFile
     let (tree, mError) = parse defaultParseOptions f
     print (tree :: UNode String)
·
     -- Note: We check the error _after_ we have finished our processing
     -- on the tree.
      case mError of
          Just err - putStrLn $ It failed : ++show err
          Nothing - putStrLn Success!

Given a 42M test file, an invocation like this:

% ghc --make -O2 Hexpat.hs
% ./Hexpat input.xml  dump.xml

will gobble up some 2Gigs of RAM (at least. I usually kill it before
it starts thrashing the swap space, since that almost crashes my
entire machine.) If I remove the last 3 lines:

 import Text.XML.Expat.Tree
 import System.Environment (getArgs)
 import Control.Monad (liftM)
 import qualified Data.ByteString.Lazy as C

 main = do
     f - liftM head getArgs = C.readFile
     let (tree, mError) = parse defaultParseOptions f
     print (tree :: UNode String)

the same invocation and input file barely uses a megabyte or two of
RAM and finishes really quickly.

Why is that? Is this a mistake in the Hexpat docs, or am I doing
something wrong? Lazy IO has always been a little bit of a mystery to
me, and just when I thought I had it...

Thanks for any help on the matter!
Aleks
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Client-extensible heterogeneous types

2010-10-13 Thread Jacek Generowicz


On 2010 Oct 13, at 00:28, Alexander Solla wrote:



On Oct 12, 2010, at 4:24 AM, Jacek Generowicz wrote:

I can't see a Haskell solution which combines both of these  
orthogonal
features without losing the benefits of the type system. (For  
example,

I could create my own, weak, type system with tags to identify the
type and maps to do the dispatch.)


Is there any particular reason why you want to actually to mirror  
Python code?


I don't want to: I merely have a situation in which an OO solution  
(not necessarily a good one) immediately springs to mind, while I  
didn't see any obvious way to do it in Haskell. (I am sure that this  
is my shortcoming, not Haskell's.) I included the Python example lest  
my question be too nebulous without it.


I would be delighted to learn approaches which are completely  
different to anything offered by OO. In fact, for personal didactic  
purposes, being un-OO-like could even be considered to be a goal.


I think that letting the programmer design domain specific control  
structures is rather the point of Haskell.


While I don't, at the moment, understand exactly how this is the case,  
I do like the sound of it.


Instead of relying on a one-sized fits all solution (which only  
really fits one kind of problem), you write your own.  And it is  
typically easier to write the control structure than it is to  
implement it using the OO patterns, because of the notion of  
irreducible complexity.  For example, the Factory pattern constructs  
a functor.  You can write the essential semantics of doing this with  
a single Functor instance, instead of writing multiple classes which  
implement the semantics, while relying on implicit, and possibly ill- 
fitting semantics of method dispatch.  The other OO patterns make  
this objection stronger.  If you can write a UML diagram, you can  
turn it into a commutative diagram, and write less code by  
implementing its arrows.


Lots of stuff that sounds fascinating, but whose detailed meaning is,  
at the moment, beyond my grasp. So let my start off by getting my  
teeth into your example code:


An OO class hierarchy is a very specific functor over objects (which  
attaches methods to objects).


This sounds very interesting, but, again, I'm having difficulty  
understanding *exactly* how that is.


Haskell provides the Functor type class.  Write your generic  
functions for specific functors:



-- The varying input types.  Will be attached to arbitrary values  
by the Functor instance.


data A = A  -- Variant 1
data B = B  -- Variant 2

-- Some normalized Output type.
data Output = Output

-- The new control structure.  
data Attaches a = AttachesA A a

| AttachesB B a

-- Stick your conditional (varying) semantics in here.  Corresponds  
to heterogeneousProcessor. 


Could you explain this a bit more? heterogeneousProcessor was  
extremely boring: its only interesting feature was the dot between  
datum and method() Here it is again:


def heterogeneousProcessor(data):
   return [datum.method() for datum in data]

I suspect that runAttaches is (potentially) a lot more interesting  
than that!


-- The output presumably depends on whether A or B is attached, so  
this function is not equivalent 
-- to something of the form fmap (f :: a - Output) (attaches ::  
Attaches a) 


runAttaches :: Attaches a - Attaches Output
runAttaches = undefined

-- This corresponds roughly to  
heterogeneousProcessor(heterogeneousContainer):

processedOutputs :: [Attaches a] - [(Attaches Output)]
processedOutputs as = fmap runAttaches as


Would it be correct to say that runAttaches replaces Python's (Java's,  
C++'s etc.) dynamically dispatching dot, but also allows for a greater  
variety of behaviour?


Alternatively, would it be interesting to compare and contrast  
runAttach to CLOS' generic functions, or even Clojure's arbitrary  
method selection mechanism?


-- Functor instance.  Now you have a way to treat an (Attaches a)  
value just like you would an a. (modulo calling fmap)

instance Functor Attaches where
 fmap f (AttachesA A a) = (AttachesA A (f a))
 fmap f (AttachesB B a) = (AttachesB B (f a))



[ Aside:

Briefly returning to my original question: I don't see how, if this  
were supplied in a library, it would allow clients to inject new  
entities into the framework. It all seems to hinge on the Attaches  
type, which would be defined in the library, and is not extensible  
without modifying the library source code (unless I'm missing  
something). Which doesn't diminish my desire to understand what you  
are saying, in the slightest.


Can the set of variants usable in this framework be extended without  
modifying the original source? ]


Coming back to your statement that An OO class hierarchy is a very  
specific functor over objects (which attaches methods to objects),  
how would we complete your code so that it implements this particular  
functor?




Re: [Haskell-cafe] Hexpat: Lazy I/O problem with huge input files

2010-10-13 Thread Daniel Fischer
On Wednesday 13 October 2010 23:06:04, Aleksandar Dimitrov wrote:
 Hello Haskell Cafe,

 I really hope this is the right list for this sort of question. I've
 bugged the folks in #haskell, they say go here, so I'm turning to you.

 I want to use Hexpat to read in some humongous XML files (linguistic
 corpora,) since it's the only Haskell XML library (I could find) that
 takes ByteStrings as input. I stumbled on a problem when using one of
 the examples from the docs of Text.XML.Expat.Tree. The cookbook
 recipe there suggests *first* processing the data, and only then
 looking into the parser error to see if there has been an error. I
 understand this should prevent the parse tree from being fully
 evaluated before use. Unfortunately, that is not what happens on my
 system (ghc 6.12.1, if that's of importance.)

 This is the code from the docs, that I modified to read files:
  import Text.XML.Expat.Tree
  import System.Environment (getArgs)
  import Control.Monad (liftM)
  import qualified Data.ByteString.Lazy as C
 ·
  -- This is the recommended way to handle errors in lazy parses
  main = do
      f - liftM head getArgs = C.readFile
      let (tree, mError) = parse defaultParseOptions f
      print (tree :: UNode String)
 ·
      -- Note: We check the error _after_ we have finished our
  processing -- on the tree.
       case mError of
           Just err - putStrLn $ It failed : ++show err
           Nothing - putStrLn Success!

 Given a 42M test file, an invocation like this:

 % ghc --make -O2 Hexpat.hs
 % ./Hexpat input.xml  dump.xml

 will gobble up some 2Gigs of RAM (at least. I usually kill it before
 it starts thrashing the swap space, since that almost crashes my
 entire machine.)

I don't know Hexpat at all, so I can only guess.

Perhaps due to the laziness of let-bindings, mError keeps a reference to 
the entire tuple, thus preventing tree from being garbage collected as it 
is consumed by print.

Try

main = do
f - liftM head getArgs = C.readFile
case parse defaultParseOptions f of
  (tree, mError) - do
print (tree :: UNode String)
case mError of
  Just err - putStrLn $ It failed:  ++ show err
  Nothing - putStrLn Success!

it may fix the leak, change nothing or make it worse.

 If I remove the last 3 lines:
  import Text.XML.Expat.Tree
  import System.Environment (getArgs)
  import Control.Monad (liftM)
  import qualified Data.ByteString.Lazy as C
 
  main = do
      f - liftM head getArgs = C.readFile
      let (tree, mError) = parse defaultParseOptions f
      print (tree :: UNode String)

 the same invocation and input file barely uses a megabyte or two of
 RAM and finishes really quickly.

 Why is that? Is this a mistake in the Hexpat docs, or am I doing
 something wrong? Lazy IO has always been a little bit of a mystery to
 me, and just when I thought I had it...

 Thanks for any help on the matter!
 Aleks

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


Re: [Haskell-cafe] Yi on Windows

2010-10-13 Thread Jeff Wheeler
On Wed, Oct 13, 2010 at 2:54 AM, Peter Marks pe...@indigomail.net wrote:

 What should I see when Yi loads? If my config file is broken, where should I
 see errors? The debug option didn't produce anything useful.

I'd expect it in one of three places:

1. In a buffer inside Yi when it launches using the default config.
(I'm guessing this isn't the case for you if you haven't seen the
error messages, but it'd be in a buffer called *errors* if present.
It theoretically should open as the default buffer.)

2. I don't think this should happen, but dyre /may/ make a file
yi.errors in ~/.yi/, next to your config file.

3. It might just print it to the console, but that's not happening
here, or you would have seen it.

 After starting up, the help option does open my config, so I think it is in
 the right place. This is Windows 7 if that makes any difference.

I'm not sure; I've never tried installing much Haskell on my Windows
machine, so I haven't tested Yi on it. I think somebody worked on it a
while back, but I'm not sure if they succeeded (or if it still
theoretically works).

 I'm happy to take a look at the source, any suggestions where I should
 start?

Interfacing with the dyre config loader occurs in src/Yi/Boot.hs, but
there's also some interesting stuff related to starting up in
src/Yi/Main.hs. The dyre package provides the primary entry-point, and
calls Yi.Main.main with the relevant config when it's ready to start.
Yi.Boot instructs dyre on how to work with configs for yi.

Best of luck, and thanks for playing with Yi!

-Jeff

-- 
Jeff Wheeler

Undergraduate, Electrical Engineering
University of Illinois at Urbana-Champaign
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Client-extensible heterogeneous types

2010-10-13 Thread Evan Laforge
I admit I haven't read this whole thread in detail, but when I want
something with an implementation that can vary dynamically I just pass
a different function.  Your original python example is equivalent to
just passing strings in haskell, so lets add an argument:

type Process = Int - String

heterogeneousProcessor :: [Process] - [String]
heterogeneousProcessor ps = [p 42 | p - ps] -- or map ($42) ps

variant1 n = variant1 stuff  ++ show n
-- etc.

Now the user of your library can pass their own Process.

I have a number of records in my program like State { lookup_x ::
Name - Maybe X, lookup_y :: Name - Maybe Y, do_something_important
:: X - Result }.  They reduce dependencies by not exposing the
(complicated) lookup details and types, and aid testing because I can
just pass a state with a dummy 'do_something_important' (in my case,
it's update GUI, which is important to stub out for a test).

This may be simpler than what you had in mind, but to narrow it down,
could you provide a more specific example where this is inadequate?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Finite but not fixed length...

2010-10-13 Thread Jason Dusek
2010/10/13 Jonas Almström Duregård jonas.dureg...@chalmers.se:
 ...and you can always do

 hack :: Vec n a - FixedVec a
 hack x :: FixedVec undefined

 Also I'm guessing 1, 2 and 17 are just examples, he really wants arbitrary
 length finite lists.

  Indeed. Where I said is necessarily I meant is not necessarily.

--
Jason Dusek
Linux User #510144 | http://counter.li.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Client-extensible heterogeneous types (Duck-typed variadic functions?)

2010-10-13 Thread Jacek Generowicz


On 2010 Oct 13, at 23:52, Evan Laforge wrote:


I admit I haven't read this whole thread in detail, but when I want
something with an implementation that can vary dynamically I just pass
a different function.


Of course.


Your original python example is equivalent to
just passing strings in haskell,


Sure. The original example was kept trivial, thereby hiding the true  
problem.



so lets add an argument:

type Process = Int - String

heterogeneousProcessor :: [Process] - [String]
heterogeneousProcessor ps = [p 42 | p - ps] -- or map ($42) ps

variant1 n = variant1 stuff  ++ show n
-- etc.

Now the user of your library can pass their own Process.


Which works just fine, if all the different things I might wish to  
express can be expressed within (Int - String) (or any other function  
type).



I have a number of records in my program like State { lookup_x ::
Name - Maybe X, lookup_y :: Name - Maybe Y, do_something_important
:: X - Result }.  They reduce dependencies by not exposing the
(complicated) lookup details and types, and aid testing because I can
just pass a state with a dummy 'do_something_important' (in my case,
it's update GUI, which is important to stub out for a test).


I think I'm starting too see what my problem is. I think it boils down  
to hankering for Duck Typing and variadic functions. I fully  
appreciate that passing functions is a wonderful and powerful  
technique for catering for variation, but Haskell's type system cramps  
my style by insisting that I can't put a (Banana - Cake) in the same  
container as an (Octopus - Truffles - DogsBreakfast).


I can get around this by creating a variant type which contains both  
of these (and any others I might ever need to use), but


a) It's bloody tedious (compared to having to do exactly nothing in  
Duck Typing),


b) The set of acceptable function types is not extensible by clients.

Put another way, your X and Y types aren't flexible/large enough.


This may be simpler than what you had in mind, but to narrow it down,
could you provide a more specific example where this is inadequate?


How about this?

-- Imagine that I want to write a program which will help me practice
-- basic arithmetic.

-- At its core I might have the following three functions

ask :: (Int, Int) - String
ask (a,b) = show a ++  +  ++ show b

answer :: (Int, Int) - Int
answer (a,b) = a + b

check :: (Int, Int) - String - Bool
check  q ans = (read ans :: Int) == answer q

-- which present the question, and check whether a given answer is
-- correct.

-- Now, imagine I've got addition down pat, and want to extend my
-- repertoire to subtraction. I could introduce some flexibility into
-- my core functions thus

data Operation = Operation (Int - Int - Int) String

ask' :: (Int, Int) - Operation - String
ask'(a,b) (Operation _ sym) = show a ++   ++ sym ++   ++ show b

answer' :: (Int, Int) - Operation - Int
answer' (a,b) (Operation op _)  = op a b

check' :: (Int, Int) - Operation - String - Bool
check' q op ans = (read ans :: Int) == answer' q op

-- Now my program can deal with any binary infix operations on
-- Ints. But what if I now want to practice a unary operation
-- (e.g. sqrt)? How about a binary prefix one (e.g. gdc) ?

-- Maybe this is the way forward?

data Question =
BinaryInfix  (Int - Int - Int) String Int Int |
BinaryPrefix (Int - Int - Int) String Int Int |
UnaryPrefix  (Int - Int)String Int

ask'' :: Question - String
ask'' (BinaryInfix  _ sym a b) = show a ++   ++ sym ++   ++ show b
ask'' (BinaryPrefix _ sym a b) = sym ++   ++ show a ++   ++ show b
ask'' (UnaryPrefix  _ sym a)   = sym ++   ++ show a

answer'' :: Question - Int
answer'' (BinaryInfix  op _ a b) = op a b
answer'' (BinaryPrefix op _ a b) = op a b
answer'' (UnaryPrefix  op _ a)   = op a

check'' :: Question - String - Bool
check'' q a = (read a :: Int) == answer'' q

-- So far, so ... not too bad.

-- I'm a little annoyed by the repetitive tedium of answer'': this
-- will really wind me up when I get on to TernaryPrefix,
-- QuaternaryPrefix etc. and I will hanker for something like Python's
-- *args.

-- Now, I go to a party and thoroughly impress my friends with my
-- newly-acquired arithmetic wizardry. One thing leads to another and
-- my program ends up in the hands of another soul or two, desperate
-- to match my mental calculation powers: I acquire some users. And as
-- every schoolboy knows, users are closely followed by feature
-- requests.

-- John wants to practice adding fractions. Cindy needs to learn to
-- find all prime factors of a given number.

-- Clearly
--
--  check'' q a = (read a :: Int) == answer'' q
--
-- won't cut the mustard any more.

-- Now, I can't see any obvious reason why I can't just keep adding
-- new constructors to Question, and corresponding patterns to ask,
-- answer and check, but I'm a lazy bugger and want to palm this off
-- onto the users by telling them that I am empowering them by giving
-- them the 

Re: [Haskell-cafe] Yi on Windows

2010-10-13 Thread Peter Marks
The problem is down to getAppUserDataDirectory called in Yi.Boot. This
function behaves differently on Windows to Linux... and more so on Windows
7. The first issue is that on Windows it doesn't prepend the . to the
directory name, so it is looking in yi, not .yi. On Windows 7, it looks
for this directory in a completely different location:
C:\Users\peter\AppData\Roaming rather than just C:\Users\peter.

Obviously other parts of the program are using a different call to locate
the config file as, letting the editor create the default file, it places it
in C:\Users\peter\.yi\yi.hs! I can't find the code that does this at the
moment - any pointers appreciated.

My current feeling is that getAppUserDataDirectory is the correct call to
use and the docs should be changed to tell users to put their file where
this call points. Further, it would be nice if the editor told you where it
was looking if it doesn't find a config file... well actually, when it does
find a file too, so you know which one it loaded.

Now I'm on to the next problem, it tries to write its error file in a
location that doesn't exist: C:\Users\peter\Local
Settings\Cache\yi\errors.log. Local Settings doesn't exist on Windows 7.
This is now AppData\Local I think. Setting the cacheDir field of the dyre
Params should fix this, but I don't have time to try it right now.

I'll let you know how I get on.


Peter

On 13 October 2010 22:31, Jeff Wheeler wheel...@illinois.edu wrote:

 On Wed, Oct 13, 2010 at 2:54 AM, Peter Marks pe...@indigomail.net wrote:

  What should I see when Yi loads? If my config file is broken, where
 should I
  see errors? The debug option didn't produce anything useful.

 I'd expect it in one of three places:

 1. In a buffer inside Yi when it launches using the default config.
 (I'm guessing this isn't the case for you if you haven't seen the
 error messages, but it'd be in a buffer called *errors* if present.
 It theoretically should open as the default buffer.)

 2. I don't think this should happen, but dyre /may/ make a file
 yi.errors in ~/.yi/, next to your config file.

 3. It might just print it to the console, but that's not happening
 here, or you would have seen it.

  After starting up, the help option does open my config, so I think it is
 in
  the right place. This is Windows 7 if that makes any difference.

 I'm not sure; I've never tried installing much Haskell on my Windows
 machine, so I haven't tested Yi on it. I think somebody worked on it a
 while back, but I'm not sure if they succeeded (or if it still
 theoretically works).

  I'm happy to take a look at the source, any suggestions where I should
  start?

 Interfacing with the dyre config loader occurs in src/Yi/Boot.hs, but
 there's also some interesting stuff related to starting up in
 src/Yi/Main.hs. The dyre package provides the primary entry-point, and
 calls Yi.Main.main with the relevant config when it's ready to start.
 Yi.Boot instructs dyre on how to work with configs for yi.

 Best of luck, and thanks for playing with Yi!

 -Jeff

 --
 Jeff Wheeler

 Undergraduate, Electrical Engineering
 University of Illinois at Urbana-Champaign
 ___
 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] The Haskell theme

2010-10-13 Thread Nicolas Wu
On 13 October 2010 07:41, Christopher Done chrisd...@googlemail.com wrote:
 This reminds me, do we have a good syntax highlighting theme?
 HsColour's has always been pretty bad (no offence intended -- but
 there is a reason people always redefine it).

I've been sitting on a post about highlighting Haskell for a while now
which is about Haskell syntax highlighting in HTML files [1]. This
would let you use any CSS style file from SHJS [2], and does a pretty
good job of highlighting Haskell. Feel free to use the style file on
my website if you like it.

Nick

[1] http://zenzike.com/posts/2010-10-14-highlighting-haskell-with-shjs/
[2] http://shjs.sourceforge.net/css/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Client-extensible heterogeneous types

2010-10-13 Thread Jacek Generowicz


On 2010 Oct 12, at 15:44, John Lato wrote:

It's not plain Haskell, but I'm surprised nobody mentioned the  
ExistentialQuantification extension, which unless I'm missing  
something provides exactly what you want.


Yes, it does appear to be *exactly* what I want.

Thanks.

(Now, how about those HLists?)

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


Re: [Haskell-cafe] Client-extensible heterogeneous types (Duck-typed variadic functions?)

2010-10-13 Thread Evan Laforge
 I think I'm starting too see what my problem is. I think it boils down to
 hankering for Duck Typing and variadic functions. I fully appreciate that
 passing functions is a wonderful and powerful technique for catering for
 variation, but Haskell's type system cramps my style by insisting that I
 can't put a (Banana - Cake) in the same container as an (Octopus -
 Truffles - DogsBreakfast).

But the thing is, I don't use things like this, even in python.  How
are you expecting to call the functions in that container?  for f in
c: try: return f(*misc_args) except: pass?

 -- Imagine that I want to write a program which will help me practice
 -- basic arithmetic.

 -- At its core I might have the following three functions

 ask :: (Int, Int) - String
 ask (a,b) = show a ++  +  ++ show b

 answer :: (Int, Int) - Int
 answer (a,b) = a + b

 check :: (Int, Int) - String - Bool
 check  q ans = (read ans :: Int) == answer q

 -- which present the question, and check whether a given answer is
 -- correct.

 -- Now, imagine I've got addition down pat, and want to extend my
 -- repertoire to subtraction. I could introduce some flexibility into
 -- my core functions thus

 data Operation = Operation (Int - Int - Int) String

 ask' :: (Int, Int) - Operation - String
 ask'    (a,b) (Operation _ sym) = show a ++   ++ sym ++   ++ show b

 answer' :: (Int, Int) - Operation - Int
 answer' (a,b) (Operation op _)  = op a b

 check' :: (Int, Int) - Operation - String - Bool
 check' q op ans = (read ans :: Int) == answer' q op

 -- Now my program can deal with any binary infix operations on
 -- Ints. But what if I now want to practice a unary operation
 -- (e.g. sqrt)? How about a binary prefix one (e.g. gdc) ?

 -- Maybe this is the way forward?

 data Question =
    BinaryInfix  (Int - Int - Int) String Int Int |
    BinaryPrefix (Int - Int - Int) String Int Int |
    UnaryPrefix  (Int - Int)        String Int

Well, you're creating a little interpreter here.  I agree with you
that this is sometimes easier in a dynamic language because you can
reuse the implementation language at runtime.  In the extreme, in
python, you can simply call eval() on the input string.  I believe
there are some packages on hackage that implement little languages
that you might be able to reuse.

But if you don't need a full-on language, one easy step is to wrap
your haskell functions in a typechecker:

apply1 f [x] = f x
apply1 _ _ = throw hissy fit
apply2 f [x, y] = f x y
etc.

Now you can put them all into one container.  Yes, the family of apply
functions may be a little tedious, and you may be able to use
typeclass magic to automatically select the right apply function, but
it doesn't seem like a big deal to me.  If you want to extend this to
different types, you just have to extend this in one more direction,
and a typeclass definitely helps there.

 -- I'm a little annoyed by the repetitive tedium of answer'': this
 -- will really wind me up when I get on to TernaryPrefix,
 -- QuaternaryPrefix etc. and I will hanker for something like Python's
 -- *args.

 -- Now, I go to a party and thoroughly impress my friends with my
 -- newly-acquired arithmetic wizardry. One thing leads to another and
 -- my program ends up in the hands of another soul or two, desperate
 -- to match my mental calculation powers: I acquire some users. And as
 -- every schoolboy knows, users are closely followed by feature
 -- requests.

 -- John wants to practice adding fractions. Cindy needs to learn to
 -- find all prime factors of a given number.

 -- Clearly
 --
 --      check'' q a = (read a :: Int) == answer'' q
 --
 -- won't cut the mustard any more.

 -- Now, I can't see any obvious reason why I can't just keep adding
 -- new constructors to Question, and corresponding patterns to ask,
 -- answer and check, but I'm a lazy bugger and want to palm this off
 -- onto the users by telling them that I am empowering them by giving
 -- them the ability to add new question types to the framework.

 -- How would I enable them to do this without them having to mess with
 -- the original source?

Well, I guess you could find the bits of the question framework which
are always the same regardless of how its extended, then think about
what types those have.  Then export that as a library so your users
can put together their own program based on that.  For example, if you
always have a number of wrong answers and a number of right answers
and print a scoreboard, then you have 'Int - Int - Scoreboard'.  If
the answers the users are expected to give vary (a single int, or a
list of ints, or a string), then you can export some parsing
primitives.  Eventually, some invisible line is crossed and you have
an EDSL for writing math tests.  Your Question type could look like
'String - Answer' and Answer = 'Wrong String | Right | ParseError
String'.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Yi on Windows

2010-10-13 Thread Jeff Wheeler
On Wed, Oct 13, 2010 at 6:14 PM, Peter Marks pe...@indigomail.net wrote:

 The problem is down to getAppUserDataDirectory called in Yi.Boot. This
 function behaves differently on Windows to Linux... and more so on Windows
 7. The first issue is that on Windows it doesn't prepend the . to the
 directory name, so it is looking in yi, not .yi. On Windows 7, it looks
 for this directory in a completely different location:
 C:\Users\peter\AppData\Roaming rather than just C:\Users\peter.

This sounds right.

 Obviously other parts of the program are using a different call to locate
 the config file as, letting the editor create the default file, it places it
 in C:\Users\peter\.yi\yi.hs! I can't find the code that does this at the
 moment - any pointers appreciated.

Are you sure that Yi ever writes a default config file? As far as I
know, when dyre provides no config from reading a file (or resuming a
saved state), Yi will boot with Yi.Config.Default.defaultConfig
(that's the one that lets you enter vim or emacs keybindings with 'v'
and 'e' respectively), but I don't think it ever writes this to a
file. (Note that src/Main.hs calls this; it might make sense to remove
that file and move this to Yi.Main or Yi.Boot.)

 My current feeling is that getAppUserDataDirectory is the correct call to
 use and the docs should be changed to tell users to put their file where
 this call points. Further, it would be nice if the editor told you where it
 was looking if it doesn't find a config file... well actually, when it does
 find a file too, so you know which one it loaded.

I'm in favor of printing it when an error occurs (should no config be
an error? not sure, but I'd be inclined to say no). When Yi boots
correctly, I'd prefer to not print anything.

Or, better yet, just always include it in --debug.

 Now I'm on to the next problem, it tries to write its error file in a
 location that doesn't exist: C:\Users\peter\Local
 Settings\Cache\yi\errors.log. Local Settings doesn't exist on Windows 7.
 This is now AppData\Local I think. Setting the cacheDir field of the dyre
 Params should fix this, but I don't have time to try it right now.

If dyre defaults to using a directory that doesn't exist on 7, I'd say
that's a bug in dyre. We should probably tell Will Donnelly (the
maintainer) if that's correct.

Again, thanks so much for looking at this.

-- 
Jeff Wheeler

Undergraduate, Electrical Engineering
University of Illinois at Urbana-Champaign
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskellers.com recent changes (and I need some volunteers)

2010-10-13 Thread Jeremy Shaw
On Tue, Oct 12, 2010 at 8:03 AM, Brandon S Allbery KF8NH
allb...@ece.cmu.edu wrote:

 On the one hand, a professional organization will prefer to have real names,
 real pictures, etc.  On the other, if you want to be a central coordinating
 spot for the existing Haskell community, many of us are far better known by
 nicknames and identicons.

I would definitely like to see the option of adding your handle to
your profile. Even if it is a commercially oriented site. Otherwise I
won't be able to figure out who is who.

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


Re: [Haskell-cafe] Client-extensible heterogeneous types (Duck-typed variadic functions?)

2010-10-13 Thread Jacek Generowicz


On 2010 Oct 14, at 01:32, Evan Laforge wrote:

I think I'm starting too see what my problem is. I think it boils  
down to
hankering for Duck Typing and variadic functions. I fully  
appreciate that
passing functions is a wonderful and powerful technique for  
catering for
variation, but Haskell's type system cramps my style by insisting  
that I

can't put a (Banana - Cake) in the same container as an (Octopus -
Truffles - DogsBreakfast).


But the thing is, I don't use things like this, even in python.


Shame. They're damn useful :-)


How
are you expecting to call the functions in that container?  for f in
c: try: return f(*misc_args) except: pass?


to_do = [(call, (AuntMabel,)),
 (buy,  ([(12*kg, sugar), (6*bushel, wheat)])),
 (introduce, (Romeo, Juliet))]

for do,it in to_do:
do(*it)

(Actually, it is far more commonly used in Python in all sorts of  
function wrappers. But the general principle is the same: It's  
somebody else's problem to ensure they give me compatible data, but  
the type system won't grumble about the types being different; it will  
only complain when the result of bringing the types together doesn't  
make sense. All at run-time, of course.)


The thing is, I can arrange for them to be compatible. Python won't be  
able to confirm this statically, but is it too much to ask of Haskell  
to have it figure out (statically) that all of


(Int - Bool, Int)
(Banana - Apple - Orange - Kiwi - Bool, (Banana, Apple,  
Orange, Kiwi))

(Bool - Bool - Bool, (Bool, Bool))

can be combined to give Bool ?

So, in my maths tester, I'm only ever going to stick together  
compatible versions of ask, answer and check, but in any given set,  
the types of the 3 functions will not be the same as those in any  
other set. At which point Haskell refuses to let me store them in the  
same container. (Without existential types, at least.)



data Question =
   BinaryInfix  (Int - Int - Int) String Int Int |
   BinaryPrefix (Int - Int - Int) String Int Int |
   UnaryPrefix  (Int - Int)String Int


Well, you're creating a little interpreter here.


Yes, this can be viewed as an interpreter for maths testing language.


I agree with you
that this is sometimes easier in a dynamic language because you can
reuse the implementation language at runtime.


I don't think I'm looking for that in this case. I'm just asking to be  
allowed to stick both


(A - B - X, (A, B))

and

(C - D - E - X, (C, D, E))

etc. in the same container, because, frankly, in the context in which  
they are used, they *are* the same.


In the extreme, in python, you can simply call eval() on the input  
string.


Aaaargh! No! For the love of all that is good, please! No! :-)

But seriously, there's enough dynamism, introspection etc. in Python,  
that eval is almost completely avoidable. I've used it once, in a  
situation where faking up a Lisp macro turned out to be an order of  
magnitude simpler than the alternatives. But that's the only time I've  
been tempted.


I find structured objects far easier and safer to manipulate than  
strings.



But if you don't need a full-on language, one easy step is to wrap
your haskell functions in a typechecker:

apply1 f [x] = f x
apply1 _ _ = throw hissy fit
apply2 f [x, y] = f x y
etc.


I would hope that the types could be checked statically, as I  
explained above.



Now you can put them all into one container.  Yes, the family of apply
functions may be a little tedious, and you may be able to use
typeclass magic to automatically select the right apply function, but
it doesn't seem like a big deal to me.  If you want to extend this to
different types, you just have to extend this in one more direction,
and a typeclass definitely helps there.


Except that I now lose the ability to stick them all into the same  
container. (Unless I enable existential quantification.)



-- Now, I can't see any obvious reason why I can't just keep adding
-- new constructors to Question, and corresponding patterns to ask,
-- answer and check, but I'm a lazy bugger and want to palm this off
-- onto the users by telling them that I am empowering them by giving
-- them the ability to add new question types to the framework.

-- How would I enable them to do this without them having to mess  
with

-- the original source?


Well, I guess you could find the bits of the question framework which
are always the same regardless of how its extended, then think about
what types those have.  Then export that as a library so your users
can put together their own program based on that.  For example, if you
always have a number of wrong answers and a number of right answers
and print a scoreboard, then you have 'Int - Int - Scoreboard'.  If
the answers the users are expected to give vary (a single int, or a
list of ints, or a string), then you can export some parsing
primitives.


I'm pretty sure that you could never come up with a sufficiently large  
set of 

Re: [Haskell-cafe] Client-extensible heterogeneous types (Duck-typed variadic functions?)

2010-10-13 Thread Jacek Generowicz
BTW Thanks: This discussion has helped me gain a better understanding  
of some of the mechanisms at work, which I really appreciate.


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


Re: [Haskell-cafe] Client-extensible heterogeneous types

2010-10-13 Thread Alexander Solla


On Oct 13, 2010, at 2:18 PM, Jacek Generowicz wrote:

Is there any particular reason why you want to actually to mirror  
Python code?


I don't want to: I merely have a situation in which an OO solution  
(not necessarily a good one) immediately springs to mind, while I  
didn't see any obvious way to do it in Haskell.


Fair enough. :0)




Instead of relying on a one-sized fits all solution (which only  
really fits one kind of problem), you write your own.  And it is  
typically easier to write the control structure than it is to  
implement it using the OO patterns, because of the notion of  
irreducible complexity.  For example, the Factory pattern  
constructs a functor.  You can write the essential semantics of  
doing this with a single Functor instance, instead of writing  
multiple classes which implement the semantics, while relying on  
implicit, and possibly ill-fitting semantics of method dispatch.   
The other OO patterns make this objection stronger.  If you can  
write a UML diagram, you can turn it into a commutative diagram,  
and write less code by implementing its arrows.


Lots of stuff that sounds fascinating, but whose detailed meaning  
is, at the moment, beyond my grasp. So let my start off by getting  
my teeth into your example code:




An OO class hierarchy is a very specific functor over objects  
(which attaches methods to objects).


This sounds very interesting, but, again, I'm having difficulty  
understanding *exactly* how that is.


At a high level, a functor is a thing which attaches things to the  
elements of an algebra, in an algebraically compatible way.  The  
functor laws express the compatibility conditions.


Let's think about how non-duck typed OO systems are used (internally)  
at run-time.  First, we have an algebra of objects.  If we don't  
consider how the class hierarchy interacts with the objects, the  
objects are a lot like Haskell values.  Basically, just locations in  
memory or another similar abstraction.


Every object has a principle class.  We can model this by creating a  
functor that attaches a class to each location in memory.


Some classes inherit from others.  We can model this by creating a  
functor that attaches a list (or tree) of classes to each class (that  
we have attached to an object).  Interpreting this model means  
searching for a class that has the method with the right name


With these constructs, we can recreate dynamic method dispatch.  In  
particular, a functor over a functor is a functor over the underlying  
functor's algebra.  We can use functor combinators to make going  
'up' and 'down' easier.





Haskell provides the Functor type class.  Write your generic  
functions for specific functors:



-- The varying input types.  Will be attached to arbitrary values  
by the Functor instance.


data A = A  -- Variant 1
data B = B  -- Variant 2

-- Some normalized Output type.
data Output = Output

-- The new control structure. data Attaches a = AttachesA A a
   | AttachesB B a

-- Stick your conditional (varying) semantics in here.  Corresponds  
to heterogeneousProcessor.


Could you explain this a bit more? heterogeneousProcessor was  
extremely boring: its only interesting feature was the dot between  
datum and method() Here it is again:


def heterogeneousProcessor(data):
  return [datum.method() for datum in data]

I suspect that runAttaches is (potentially) a lot more interesting  
than that!


It is as interesting as you want it to be.  That's where you put the  
semantics for interpreting a in terms of the types A or B.  For  
example, if A contained a list of named methods of the form (a -  
Output), your runAttaches could search through the list, find the  
right one, and apply it.




-- The output presumably depends on whether A or B is attached, so  
this function is not equivalent-- to something of the form fmap  
(f :: a - Output) (attaches :: Attaches a)

runAttaches :: Attaches a - Attaches Output
runAttaches = undefined

-- This corresponds roughly to  
heterogeneousProcessor(heterogeneousContainer):

processedOutputs :: [Attaches a] - [(Attaches Output)]
processedOutputs as = fmap runAttaches as


Would it be correct to say that runAttaches replaces Python's  
(Java's, C++'s etc.) dynamically dispatching dot, but also allows  
for a greater variety of behaviour?


Yes, that's right.



Alternatively, would it be interesting to compare and contrast  
runAttach to CLOS' generic functions, or even Clojure's arbitrary  
method selection mechanism?


I don't know, I'm not familiar with either.  On the other hand, method  
dispatch is always pretty similar.  The difference is the shape of the  
structure traversed to find the right method.




-- Functor instance.  Now you have a way to treat an (Attaches a)  
value just like you would an a. (modulo calling fmap)

instance Functor Attaches where
fmap f (AttachesA A a) = (AttachesA A (f a))
fmap f (AttachesB B a) = 

[Haskell-cafe] ANNOUNCE: type-level-natural-number and friends!

2010-10-13 Thread Gregory Crosswhite

 Hey everyone,

I am pleased to announce the release of a family of packages for 
type-level natural numbers.  The emphasis on these packages is 
minimality in order to provide simple core functionality that requires 
as few extensions as possible beyond Haskell-2010.  The (probably 
foolish) hope is that this will encourage people to use these packages 
for their simple type-level natural number needs so that the different 
packages can have interoperable type-level natural numbers.


=== type-level-natural-numbers v1.1 ===

This is an update to type-level-natural-numbers, a Haskell-2010 
compatible package which provides simple type-level natural numbers.  
(The only non-Haskell-98 extension that it requires is EmptyDataDecls.)  
This release adds word aliases for N1..N15 (i.e., One, Two, Three...) as 
well as a Typeable instance for type-level natural numbers.


=== type-level-natural-number-operations v1.0 ===

This package contains the type functions Plus and Minus for performing 
addition and subtraction on natural numbers;  by keeping the 
functionality minimal I avoided the need to use UndecideableInstances, 
so the only extension that is required is TypeFamilies.


=== type-level-natural-number-induction v1.0 ===

This is the most interesting of the three packages.  It provides 
high-level combinators for expressing inductive operations on data 
structures tagged with a natural number, which at the moment I call 
inductive structures.  The idea is that you express your operation in 
terms of a base case and an inductive case, and then call one of the 
combinators to do the rest for you.  There are combinators for building 
up an inductive structure from a seed value, folding over/tearing down 
an inductive structure to get a result, and transforming one inductive 
structure into another.  These combinators are supplied in both monadic 
and non-monadic versions. The only extension that is required to use 
this package is Rank2Types.


=== natural-number v1.0 ===

This package provides *value*-level natural numbers that are tagged with 
a type-level natural number corresponding to their value by using GADTs, 
as well as some simple operations on them.  I also provide an instance 
for the EqT class in type-equality, which means that you can compare two 
natural numbers with possibly different tags and obtain a proof of 
equality if and only if they are the same type.  The extensions that are 
required to use this package are  Rank2Types and GADTs.  (The package 
itself only uses GADTs, but it pulls in 
type-level-natural-number-induction which uses Rank2Types.)




Feedback is always welcome!

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


[Haskell-cafe] ANNOUNCE: Facts

2010-10-13 Thread Alexander Solla
The Facts hierarchy is meant to contain commonly used, relatively  
static facts about the real world. The facts are meant to be encoded  
using relatively simple Haskell constructs. However, we do make some  
promises: every data type our modules export will have instances of  
Data, Eq, Ord, Show, andTypeable. We will use explicit module export  
lists to control access to internal data structures.


As much of the data we are encoding is tabular, we use simple  
structures like lists and maps to encode the relations. This has two  
practical ramifications: the textual representation of the data can be  
very wide, but are also very easy to edit, with block editing tools  
like Vi's visual block mode. The other consequence is that the naive  
approach to writing queries can be tedious, and the resulting naive  
queries are slower than they could be. Template Haskell can eliminate  
much of this drudgery. Felipe Lessa has graciously donated some  
Template Haskell code which we have adapted.


The Facts.* hierarchy currently contains modules with geographical  
information, such as a data type of countries, cross references to  
various ISO-3166-1 names for each, a list of states in the United  
States, and the United States address format. Please see the module  
hierarchy for more specifics. Patches are welcomed, though prospective  
contributors are encouraged to encode data structures using lists of  
pairs to encode bijections, all exposed data types are instances of  
Data, Eq, Ord, Show, and Typeable, and use explicit exports to only  
export queries and their atoms. For now, we will add facts to the  
hierarchy lazily, as our projects need them.___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANNOUNCE: tagged-list v1.0

2010-10-13 Thread Gregory Crosswhite

 Hey everyone,

I am pleased to announce the release of tagged-list version 1.0, a 
package which provides fixed-length lists that are tagged with a phantom 
type-level natural number corresponding to the length. The advantage of 
such lists is that you can make static guarantees about them, so that 
for example the function


addLists :: TaggedList n Int - TaggedList n Int - TaggedList n Int
...

which adds two lists is guaranteed to get two lists of the same length 
and to produce a list with the same length as the inputs. Some basic 
operations on these lists have been provided, including instances for 
Applicable, Traversable, etc. One of the more interesting of these 
operations is the join function,


join :: TaggedList m α → TaggedList n α → (TaggedList (Plus m n) 
α,TaggedList (Plus m n) β → (TaggedList m β,TaggedList n β))


This function takes two lists and appends them, and returns not only the 
appended list but also a function that takes a list of the same length 
and splits it into two lists with the same lengths as the inputs; one 
way of interpreting the second parameter is that it provides a proof 
that a TaggedList of type TaggedList (Plus m n) β can be broken into 
lists of type TaggedList m β and TaggedList n β. This function is 
provided because I couldn't figure out how to make a general split 
function pass the type-checker, and fortunately I found that in practice 
I didn't need a general such function because I was usually taking a 
list that was the result of some operation applied to two lists I had 
earlier appended and breaking the result list into sublists the lengths 
of the original two lists.


I also provided functions to convert tagged lists to and from tuples, 
which can be useful at the times when the type-checker gets confused by 
your a :. b :. ... :. E expression and gives you obscure error messages.


Anyway, I hope that the community finds this package useful, and welcome 
any feedback that you all have to offer.


Cheers,
Greg

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


Re: [Haskell-cafe] Re: Re: Make your Darcs repositories hashed?

2010-10-13 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 10/13/10 13:48 , Jason Dagit wrote:
 Isn't debian etch a security liability at this point?

Never underestimate the inertia of a system which a professor uses for
research or a grad student for their thesis work.

- -- 
brandon s. allbery [linux,solaris,freebsd,perl]  allb...@kf8nh.com
system administrator  [openafs,heimdal,too many hats]  allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon university  KF8NH
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAky2aKMACgkQIn7hlCsL25W9vgCgvtBEJkSSTNfpk/kUXZ1GcWTW
JfkAn3OOKnNaLcKuwk/Kh9OBNOtFxvIF
=OD3V
-END PGP SIGNATURE-
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Client-extensible heterogeneous types (Duck-typed variadic functions?)

2010-10-13 Thread Brandon Moore
If you just want instances of questions you can keep it simple. How about 
something isomorphic to

data Instance = Instance { question : String, answer : String, check : String 
- Bool }

You could make helper functions similar to your old code, like

addition : (Int , Int) - Instance

You might handle problem families by taking a random number generator, or maybe 
using QuickCheck's Gen monad.

easyMultiplication : Gen Instance



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


Re: [Haskell-cafe] Client-extensible heterogeneous types (Duck-typed variadic functions?)

2010-10-13 Thread Brandon Moore


On Oct 13, 2010, at 7:44 PM, Jacek Generowicz jacek.generow...@cern.ch wrote:


On 2010 Oct 14, at 01:32, Evan Laforge wrote:

I think I'm starting too see what my problem is. I think it boils down to
hankering for Duck Typing and variadic functions. I fully appreciate that
passing functions is a wonderful and powerful technique for catering for
variation, but Haskell's type system cramps my style by insisting that I
can't put a (Banana - Cake) in the same container as an (Octopus -
Truffles - DogsBreakfast).

But the thing is, I don't use things like this, even in python.

Shame. They're damn useful :-)

How
are you expecting to call the functions in that container?  for f in
c: try: return f(*misc_args) except: pass?

to_do = [(call, (AuntMabel,)),
   (buy,  ([(12*kg, sugar), (6*bushel, wheat)])),
   (introduce, (Romeo, Juliet))]

for do,it in to_do:
  do(*it)

What is the point of doing that? If it's just to defer execution until that 
loop, you should just rely on lazy evaluation, or [IO ()].

If that's not the only thing you do, then the question is still how you know 
enough about the structure of values In the list to do anything useful with 
them.

If you just want to be able to inspect them interactively, you should ask about 
support for inspecting thunks in the ghci debugger.

I suppose you haven't heard of parametricity theorems. In Haskell, values have 
no hair. If you don't know anything about the type of a values you can't 
inspect it. It's one of the major tools that helps type signatures contribute 
to the correctness of implementations.
In Python, Java, and other similar languages there are lots of things you can 
do with unknown values - get a string representation, test for equality with 
another value, get the class it belongs to, etc.

So, we won't understand the point of your example without a little more 
information on what you do to those heterogeneous values, and how the program 
can tell which things to do wi which item, 

In Haskell it may be fun to turn on -XGADTs and write

data DelayedApp result where
 Base :: a - DelayedApp a
 App :: DelayedApp (a - b) - a - DelayedApp b

but it turns out to be isomorphic to data DelayedResult r = DR a Nat
 - at least until you add some more data to the constructors.



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


Re: [Haskell-cafe] Haskellers.com recent changes (and I need some volunteers)

2010-10-13 Thread Michael Snoyman
On Thu, Oct 14, 2010 at 1:54 AM, Jeremy Shaw jer...@n-heptane.com wrote:
 On Tue, Oct 12, 2010 at 8:03 AM, Brandon S Allbery KF8NH
 allb...@ece.cmu.edu wrote:

 On the one hand, a professional organization will prefer to have real names,
 real pictures, etc.  On the other, if you want to be a central coordinating
 spot for the existing Haskell community, many of us are far better known by
 nicknames and identicons.

 I would definitely like to see the option of adding your handle to
 your profile. Even if it is a commercially oriented site. Otherwise I
 won't be able to figure out who is who.

It's available now. Just go to extras.

As a side point, I'm wondering how I should let everyone know about
the new features on the site. Emailing the cafe each time would be
stupid (and spam); posting to my twitter or my blog won't hit the
whole audience. The two real options I see are:

* A Haskelers twitter account
* A news section on the site

I lean towards the second. Obviously, I'd include a news feed with it.

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


Re: [Haskell-cafe] Haskellers.com recent changes (and I need some volunteers)

2010-10-13 Thread Ivan Lazar Miljenovic
On 14 October 2010 16:00, Michael Snoyman mich...@snoyman.com wrote:

 As a side point, I'm wondering how I should let everyone know about
 the new features on the site. Emailing the cafe each time would be
 stupid (and spam); posting to my twitter or my blog won't hit the
 whole audience. The two real options I see are:

 * A Haskelers twitter account
 * A news section on the site

 I lean towards the second. Obviously, I'd include a news feed with it.

I'd prefer the latter, possibly even with a dedicated optional
announce mailing list.

-- 
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] Haskellers.com recent changes (and I need some volunteers)

2010-10-13 Thread Conrad Parker
On 14 October 2010 14:00, Michael Snoyman mich...@snoyman.com wrote:
 As a side point, I'm wondering how I should let everyone know about
 the new features on the site. Emailing the cafe each time would be
 stupid (and spam);

but it's the main reason people are checking it out :) I reckon it's
ok to talk about community stuff in the community cafe!

 posting to my twitter or my blog won't hit the
 whole audience. The two real options I see are:

 * A Haskelers twitter account
 * A news section on the site

 I lean towards the second. Obviously, I'd include a news feed with it.

and please make sure it hits the haskell reddit ;-)

cheers,

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


[Haskell-cafe] Fuzzy time deltas

2010-10-13 Thread Michael Snoyman
Hey all,

Is there a library that supports fuzzy time deltas? For example, given
two UTCTimes (or something like that) it could produce:

43 seconds
13 minutes
17 hours
4 days
8 months

I want to use it for the news feature on Haskellers. It's not that
hard to write, just wondering if it's already been done.

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