[Haskell-cafe] Re: What do _you_ want to see in FGL?

2010-04-26 Thread Christian Maeder
Ivan Lazar Miljenovic schrieb:
 - Having a separate parameter (using associated types?) for the node
   type rather than just using Int.

Just Int for nodes was disappointing. It should have been at least a
newtype. I would vote against these experimental features like
associated types or MPTC and FD.
I prefer plain type parameters for data types, but that does not fit
well together with type classes.

 * Better fundamental data structures: one of the things that has always
   annoyed me about FGL is how much it uses tuples; I propose re-defining
   the Context type to be a record-based data structure.  Also, usage of
   Sets, Maps, etc. where applicable.

Right, these tuples annoyed me, too. (If this changes, it will break a
lot of our existing code, though.)

I also did not like the list of links, that let me redefine the context
data type (although it does not fit well into the current class):

newtype Gr a b = Gr { convertToMap :: Map.IntMap (GrContext a b) }

data GrContext a b = GrContext
{ nodeLabel :: a
, nodeSuccs :: Map.IntMap [b]
, loops :: [b]
, nodePreds :: Map.IntMap [b] }
 
http://trac.informatik.uni-bremen.de:8080/hets/browser/trunk/Common/Lib/Graph.hs

Maybe Ord b should be required for edge labels b (in order to use
sets), although it may make sense to have many edges with the same label
between the same two nodes. However, for this special case the user
could provide an additional index or a counter.

 * Data.Graph.Inductive.Monad: does anyone actually use this?

I did not use it. (I've got no opinion about the other points you made.)

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


[Haskell-cafe] Re: What do _you_ want to see in FGL?

2010-04-26 Thread Ivan Lazar Miljenovic
Christian Maeder christian.mae...@dfki.de writes:

 Ivan Lazar Miljenovic schrieb:
 - Having a separate parameter (using associated types?) for the node
   type rather than just using Int.

 Just Int for nodes was disappointing. It should have been at least a
 newtype. 

This then loses you all of the advantages of using Int (pre-defined data
type with known space usage, ordering, etc. and the ability to use
IntMap and IntSet which out-perform the normal ones).

 I would vote against these experimental features like associated types
 or MPTC and FD.  I prefer plain type parameters for data types, but
 that does not fit well together with type classes.

Why don't you like extensions?  I used to feel the same way, but then
someone pointed out to me that just because Haskell98 doesn't have them
doesn't mean they aren't good/useful, and we should be coding for
_modern_ Haskell.

 * Better fundamental data structures: one of the things that has always
   annoyed me about FGL is how much it uses tuples; I propose re-defining
   the Context type to be a record-based data structure.  Also, usage of
   Sets, Maps, etc. where applicable.

 Right, these tuples annoyed me, too. (If this changes, it will break a
 lot of our existing code, though.)

All of my proposals will break existing code though, but I believe for
the better.  We can't be afraid to innovate/change our libraries,
otherwise they can't improve.

-- 
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] What do _you_ want to see in FGL?

2010-04-26 Thread Neil Brown

Hi,

Primarily I want to see in FGL: documentation, documentation and more 
documentation.  The library has lots of undocumented functions 
(especially the queries, e.g. 
http://hackage.haskell.org/packages/archive/fgl/5.4.2.2/doc/html/Data-Graph-Inductive-Query-DFS.html 
has no documentation at all), and the only reference is the original 
paper.  I've seen several people who didn't read the paper (or didn't 
read the right bits) get confused by the inductive way the graph is 
constructed, when they try to de-construct it.


I would also like to see the library reduced in size/scope if possible; 
there's a lot of modules in FGL, but all I've ever used are D.G.I.Graph, 
D.G.I.Tree, D.G.I.Graphviz and D.G.I.Query.DFS.  I consider this to 
probably be the most common usage of the library by others too (if you 
throw in D.G.I.Query.BFS).  So by the sounds of it, if you split 
Graphviz and Query off to separate libraries, I probably only use the 
core module.


Ivan Lazar Miljenovic wrote:

Here are some ideas that I have regarding FGL:

* Better fundamental data structures: one of the things that has always
  annoyed me about FGL is how much it uses tuples; I propose re-defining
  the Context type to be a record-based data structure.  Also, usage of
  Sets, Maps, etc. where applicable.
  
I think this is worth doing, even if it does break code.  If you're 
doing Context, you may as well do LNode and LEdge too.



* Data.Graph.Inductive.Monad: does anyone actually use this?
  
No, now that I look at it, it's not what I would expect.  It seems to be 
a lot of operations that could be constructed by sticking liftM before 
the normal operations.  For example:


nodesM :: GraphM m gr = m (gr a b) - m [Node]

I would have thought the useful operations for graphs and monads would 
have been something more like:


nodesM :: GraphM m gr = gr (m a) (m b) - m [Node]

On that node, I would like to see some instances for the graph types: 
particularly Functor, Foldable and Traversable, for both (Gr a) and 
(Flip Gr b) -- where Flip is 
http://hackage.haskell.org/packages/archive/TypeCompose/latest/doc/html/Control-Compose.html#t:Flip 
or 
http://hackage.haskell.org/packages/archive/category-extras/latest/doc/html/Control-Functor-Combinators-Flip.html


If you put FGL in a repository somewhere, I might be able to find some 
time to write those instances and perhaps contribute a bit of 
documentation (no promises, though!).


Thanks,

Neil.

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


[Haskell-cafe] Re: What do _you_ want to see in FGL?

2010-04-26 Thread Christian Maeder
Ivan Lazar Miljenovic schrieb:
 I would vote against these experimental features like associated types
 or MPTC and FD.  I prefer plain type parameters for data types, but
 that does not fit well together with type classes.
 
 Why don't you like extensions?  I used to feel the same way, but then
 someone pointed out to me that just because Haskell98 doesn't have them
 doesn't mean they aren't good/useful, and we should be coding for
 _modern_ Haskell.

My feeling is, that the last words about fancy type class extension are
not spoken yet. Already the simple classes have disadvantages (wrt
multiple instances), that i.e. parameterized modules solve differently
(but maybe also not good enough, yet).

Parametrized data types, hofs, purity, etc. are proven concepts also
found in other functional languages that I prefer to stick to.

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


[Haskell-cafe] happstack/SOAP

2010-04-26 Thread Johannes Waldmann
Hi - I'm looking for an example/demo happstack server 
that handles SOAP requests. - Thanks, J.W.



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


Re: [Haskell-cafe] What do _you_ want to see in FGL?

2010-04-26 Thread Stephen Tetley
Hello Ivan

What would your thoughts be on freezing FGL as it is and putting
changes into a new package FGL2 or NewFGL?

The implementation technique for FGL is independently interesting;
Martin Erwig expanded on it in other papers ('Metamorphic
Programming') but no one else seems to have picked up on it. As I
think there is more mileage in the idiom and hopefully someone will
pick up on it at some point, it would be nice if it survives in the
code.

Best wishes

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


RE: [Haskell-cafe] London HUG domain expired

2010-04-26 Thread Bayley, Alistair
 From: sefer@gmail.com [mailto:sefer@gmail.com] On 
 Behalf Of Yitzchak Gale
 
 On Fri, Apr 23, 2010 at 1:24 PM, Bayley, Alistair wrote:
  Looks like the London HUG domain (londonhug.net) registration has
  expired. Neil Bartlett was the registrant.
  Neil: do you plan to renew?
 
 The whois database reports:
  Domain name: LONDONHUG.NET
  This domain name is up for auction for a limited time.
  To place a bid, visit: http://www.namejet.com
 
 And it appears that someone has already placed a $75 bid.
 
 The domain should be renewed promptly, before the grace
 period expires.

Probably the best option, but can anyone other than Neil do this?

If not, does anyone know if Neil is reachable? (could try his phone
number listed in the whois record, but that seems a little invasive).

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

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


[Haskell-cafe] Broken ghc documentation links

2010-04-26 Thread hask...@kudling.de
To reproduce:
 
1) Look for data IO on Hoogle, e.g.
http://haskell.org/ghc/docs/6.12.1/html/libraries/base-4.2.0.0/Prelude.html#t%3AIO

2) Click source, which redirects to
http://haskell.org/ghc/docs/6.12.1/html/libraries/base-4.2.0.0/src/GHC-Types.html#IO
 
3) Observe a Not Found page
 
Is there anyone interested in fixing this?
 
Bye,
Lenny___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Ada-style ranges

2010-04-26 Thread hask...@kudling.de
Hi list,
 
how would you describe Ada's ranges in Haskell's typesystem?
http://en.wikibooks.org/wiki/Ada_Programming/Types/range
 
I feel, you can not because this is a runtime property.
 
Bye,
Lenny___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Why does cabal select base-3.0.3.2 when base-4.2.0.0 is available?

2010-04-26 Thread Bjorn Buckwalter
Dear all,

Why does cabal seem to prefer base-3.0.3.2 over base-4.2.0.0 when
installing packages with an unqualified base requirement? Example:


$ cabal install -v fad --reinstall
[snip]
Resolving dependencies...
selecting fad-1.0 (hackage)
selecting base-3.0.3.2 (installed) and 4.2.0.0 (installed) and discarding
syb-0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.0.3, 0.2 and 0.2.1
[snip]
Configuring fad-1.0...
Dependency base ==3.0.3.2: using base-3.0.3.2
[snip]
[1 of 1] Compiling Numeric.FAD  ( Numeric/FAD.hs, dist/build/Numeric/FAD.o )

Numeric/FAD.hs:1:0:
Warning: Module `Prelude' is deprecated:
   You are using the old package `base' version 3.x.
   Future GHC versions will not support base version 3.x. You
   should update your code to use the new base version 4.x.
[snip]


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


[Haskell-cafe] Re: Unicode strings and runCommand / runProcess

2010-04-26 Thread S. Astanin
   Actually, the behavior of openFile when given a String with characters 
   0xFF is also completely undocumented.  I am not sure what it does with
   that.  It should probably be the same as runCommand, whatever it is.

Actually, the behaviour of openFile is known to be platform-dependent.
According to Simon Marlow,

 Be careful with FilePaths. On Windows they are interpreted as Unicode,
 on Unix they are interpreted as [Word8], by taking the low 8 bits of
 each Char. So if you always encode FilePaths to UTF-8, that will break
 on Windows. Fixing FilePaths is a high priority.

The last sentence gives me some hope.

http://ghcmutterings.wordpress.com/2009/09/30/heads-up-what-you-need-to-know-about-unicode-io-in-ghc-6-12-1/#comment-61

 But truncation makes impossible to pass non ASCII strings portably. They
 should be encoded there is no easy way to do so.

 Actually problem is use of strings. String is sequence of _characters_ and
 program talk to outside world using sequence of bytes. I think that right (but
 impossible) way to solve this problem is to use separate data types for file
 path, command line arguments.

I think that Strings should be used _only_ for characters (code
points).
Using the same data type for encoded/truncated data is dangerous. Most
of the
current problems with Unicode is due to the fact that Strings could
turn
out to be anything (are not strictly typed from this point of view).
Hence, the runtime checks and hacks like isUTF8Encoded :: String -
Bool,
encodeString :: String - String and decodeString :: String -
String...

So I absolutely support that truncating is wrong. Expecting encoded
data
in Strings is wrong too. So the only option (except changing the
standard library and introducing a new type for FilePath), is to do
all
necessary conversions inside openFile and similar functions.

 I think there are two alternatives. One is to encode/decode strings using
 current locale and provide [Word8] based variants. Main problem is that
 seeming innocent actions like getting directory content could crash program
 (exception )

Actually, any IO action is unpredictible. So trying to get directory
contents can produce an error (for various reasons, e.g. permission
denied). If it reports an error when there are filenames not
presentable
in the current locale (e.g. contain invalid UTF-8 sequences in UTF-8
locale), the problem is likely to be the wrong locale settings. What's
the
problem with an exception?

I think [Word8] variants for those who wants to deal with such cases
(guess file system encoding etc.) is enough.

 Another options is to provide function to encode/decode strings. This is ugly
 and mix strings which hold characters and string which hold bytes and
 completely unhaskellish but it seems there is no good solution.

This is ugly, because it's impossible to know if a String is already
encoded or not. This is ugly because application code will be polluted
with conditional compilation to be cross-platform (or worse, people
will
forget to write cross-platform code in _some_ cases).

 Also truncation could have security implications. It makes almost impossible
 to escape dangerous characters robustly. Consider following code. This is more
 matter of speculations than real threat but nevertheless:

Nice example. It shows that escaping should be the last step.

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


Re: [Haskell-cafe] What do _you_ want to see in FGL?

2010-04-26 Thread Ivan Lazar Miljenovic
Stephen Tetley stephen.tet...@gmail.com writes:
 What would your thoughts be on freezing FGL as it is and putting
 changes into a new package FGL2 or NewFGL?

That's another possibility.  However, I was planning on keeping the
fundamental layout and design of FGL.  I quite like and have used the
inductive approach of graph construction/deconstruction in my own code;
I just plan on updating/modernising the layout and design (after all,
large all-in-one packages are _so_ pre-Hackage :p).

Whilst freezing it is an option, I feel that this will lead to the same
problems that we already face with mtl: most people agree/know that the
approach/design is bad, but we keep using it because there's no (one)
viable alternative to be used (and thus mtl stays in the Platform, which
means more people use it, and thus we have this vicious cycle).  By
using the same name we can break this cycle: there is no implicit
loyalty to an old package that people still use because its familiar
(of course, this leaves it open to the problems with QuickCheck and
Parsec, yet they are being resolved and more and more people are moving
to QuickCheck-2 and Parsec-3).

 The implementation technique for FGL is independently interesting;
 Martin Erwig expanded on it in other papers ('Metamorphic
 Programming') but no one else seems to have picked up on it. As I
 think there is more mileage in the idiom and hopefully someone will
 pick up on it at some point, it would be nice if it survives in the
 code.

Hmmm I haven't come across Metamorphic Programming before, will
have to have a read through it (which isn't that appealing at the
moment, since I'm in the middle of the literature review section of my
PhD :s).

-- 
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] Broken ghc documentation links

2010-04-26 Thread Ivan Lazar Miljenovic

So, the problem is that there are broken links _in Hoogle_; have you
thought about contacting the author Neil Mitchell directly?

hask...@kudling.de hask...@kudling.de writes:

 To reproduce:
 
 1) Look for data IO on Hoogle, e.g.
 http://haskell.org/ghc/docs/6.12.1/html/libraries/base-4.2.0.0/Prelude.html#t%3AIO

 2) Click source, which redirects to
 http://haskell.org/ghc/docs/6.12.1/html/libraries/base-4.2.0.0/src/GHC-Types.html#IO
 
 3) Observe a Not Found page
 
 Is there anyone interested in fixing this?


-- 
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] Why does cabal select base-3.0.3.2 when base-4.2.0.0 is available?

2010-04-26 Thread Ivan Lazar Miljenovic
Bjorn Buckwalter bjorn.buckwal...@gmail.com writes:
 Why does cabal seem to prefer base-3.0.3.2 over base-4.2.0.0 when
 installing packages with an unqualified base requirement? Example:

You mean cabal-install rather than Cabal.  The reason that base-3 is
chosen is because many of these old libraries won't build with base-4;
as such, if no upper bound restriction is found on the base package then
base-3 is chosen as it is more likely to work than base-4 (there were a
_lot_ of breakages when base-4 first came out with 6.10.1).



 $ cabal install -v fad --reinstall
 [snip]
 Resolving dependencies...
 selecting fad-1.0 (hackage)
 selecting base-3.0.3.2 (installed) and 4.2.0.0 (installed) and discarding
 syb-0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.0.3, 0.2 and 0.2.1
 [snip]
 Configuring fad-1.0...
 Dependency base ==3.0.3.2: using base-3.0.3.2
 [snip]
 [1 of 1] Compiling Numeric.FAD  ( Numeric/FAD.hs, 
 dist/build/Numeric/FAD.o )

 Numeric/FAD.hs:1:0:
 Warning: Module `Prelude' is deprecated:
You are using the old package `base' version 3.x.
Future GHC versions will not support base version 3.x. You
should update your code to use the new base version 4.x.
 [snip]


-- 
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] Ada-style ranges

2010-04-26 Thread Steffen Schuldenzucker
On 04/26/2010 12:50 PM, hask...@kudling.de wrote:
 
 
 Hi list,
 
  
 
 how would you describe Ada's ranges in Haskell's typesystem?
 
 http://en.wikibooks.org/wiki/Ada_Programming/Types/range

Hi Lenny,

can non-constant expressions be given as arguments to 'range'? If not, then
what about a opaque wrapper type?

{-# LANGUAGE GeneralizedNewtypeDeriving #-}

module Range1 (Range1, fromRange1, mkBounded, mkRange1) where

newtype Range1 = Range1 { fromRange1 :: Integer }
deriving (Eq, Num, Ord, Show)

instance Bounded Range1 where
minBound = Range1 $ -5
maxBound = Range1 $ 10

mkBounded :: (Bounded a, Ord a) = (b - a) - b - Maybe a
mkBounded f x = case f x of
y | minBound = y  y = maxBound - Just y
  | otherwise  - Nothing

mkRange1 ::  Integer - Maybe Range1
mkRange1 = mkBounded Range1

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


Fwd: Re: [Haskell-cafe] Broken ghc documentation links

2010-04-26 Thread hask...@kudling.de
FYI
 

-- Ursprüngliche Nachricht --
Von: hask...@kudling.de hask...@kudling.de
An: Ivan Lazar Miljenovic ivan.miljeno...@gmail.com
Cc: Neil Mitchell ndmitch...@gmail.com
Datum: 26. April 2010 um 13:45
Betreff: Re: [Haskell-cafe] Broken ghc documentation links

Hi,
 
 So, the problem is that there are broken links _in Hoogle_; have you
 thought about contacting the author Neil Mitchell directly?
 
While the URL http://www.haskell.org/hoogle/ contains the word Hoogle, the URL
http://haskell.org/ghc/docs/6.12.1/html/libraries/base-4.2.0.0/Prelude.html#t%3AIO
does not and it does no mention Hoogle on the page either.
 
How did you determine that the latter is related to Hoogle?
 
Bye,
Lnny___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Why does cabal select base-3.0.3.2 when base-4.2.0.0 is available?

2010-04-26 Thread Bjorn Buckwalter
On Mon, Apr 26, 2010 at 19:38, Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com wrote:
 Bjorn Buckwalter bjorn.buckwal...@gmail.com writes:
 Why does cabal seem to prefer base-3.0.3.2 over base-4.2.0.0 when
 installing packages with an unqualified base requirement? Example:

 You mean cabal-install rather than Cabal.  The reason that base-3 is
 chosen is because many of these old libraries won't build with base-4;
 as such, if no upper bound restriction is found on the base package then
 base-3 is chosen as it is more likely to work than base-4 (there were a
 _lot_ of breakages when base-4 first came out with 6.10.1).

I see, I guess that's pragmatic although the deprecation warning is unfortunate.

(I'm aware of the cabal-install versus Cabal distinction, but I
understand that cabal-install uses Cabal to resolve dependencies; thus
I assumed Cabal was the culprit.)

Thanks,
Bjorn


 $ cabal install -v fad --reinstall
 [snip]
 Resolving dependencies...
 selecting fad-1.0 (hackage)
 selecting base-3.0.3.2 (installed) and 4.2.0.0 (installed) and discarding
 syb-0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.0.3, 0.2 and 0.2.1
 [snip]
 Configuring fad-1.0...
 Dependency base ==3.0.3.2: using base-3.0.3.2
 [snip]
 [1 of 1] Compiling Numeric.FAD      ( Numeric/FAD.hs, 
 dist/build/Numeric/FAD.o )

 Numeric/FAD.hs:1:0:
     Warning: Module `Prelude' is deprecated:
                You are using the old package `base' version 3.x.
                Future GHC versions will not support base version 3.x. You
                should update your code to use the new base version 4.x.
 [snip]


 --
 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] Broken ghc documentation links

2010-04-26 Thread Daniel Fischer
Am Montag 26 April 2010 13:36:22 schrieb Ivan Lazar Miljenovic:
 So, the problem is that there are broken links _in Hoogle_;

No, hoogle just sends you to 
http://www.haskell.org/ghc/docs/6.12.2/html/libraries/base-4.2.0.1/Prelude.html#t%3AIO
, which does exist. It's the 'Source' link in the haddocks that sends you 
to the 404 Not Found.
It's the same with my local docs, I think it's haddock that got confused by 
the move of the IO definition from base to ghc-prim.

 have you
 thought about contacting the author Neil Mitchell directly?

 hask...@kudling.de hask...@kudling.de writes:
  To reproduce:
 
  1) Look for data IO on Hoogle, e.g.
  http://haskell.org/ghc/docs/6.12.1/html/libraries/base-4.2.0.0/Prelude
 .html#t%3AIO
 
  2) Click source, which redirects to
  http://haskell.org/ghc/docs/6.12.1/html/libraries/base-4.2.0.0/src/GHC
 -Types.html#IO
 
  3) Observe a Not Found page
 
  Is there anyone interested in fixing this?

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


Re: [Haskell-cafe] Why does cabal select base-3.0.3.2 when base-4.2.0.0 is available?

2010-04-26 Thread Ivan Lazar Miljenovic
Bjorn Buckwalter bjorn.buckwal...@gmail.com writes:

 On Mon, Apr 26, 2010 at 19:38, Ivan Lazar Miljenovic
 ivan.miljeno...@gmail.com wrote:
 Bjorn Buckwalter bjorn.buckwal...@gmail.com writes:
 Why does cabal seem to prefer base-3.0.3.2 over base-4.2.0.0 when
 installing packages with an unqualified base requirement? Example:

 [snip]

 The reason that base-3 is chosen is because many of these old
 libraries won't build with base-4; as such, if no upper bound
 restriction is found on the base package then base-3 is chosen as it
 is more likely to work than base-4 (there were a _lot_ of breakages
 when base-4 first came out with 6.10.1).

 I see, I guess that's pragmatic although the deprecation warning is
 unfortunate.

The deprecation warning is due to GHC 6.12; this is a not-so-subtle hint
to package maintainers to fix their code up, and to users to poke the
maintainers of packages they use to do so!

-- 
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] and [] = True; or [] = False

2010-04-26 Thread Bjorn Buckwalter
Dear all,

Does it make good sense that 'and []' returns 'True' and 'or []'
returns 'False'? The Haskell Road to Logic, Maths and Programming says
so:

The function or takes a list of truth values and returns True if at
least one member of the list equals True, while and takes a list of
truth values and returns True if all members of the list equal True.

Should the conjunction of all elements of [] count as true or false?
As true, for it is indeed (trivially) the case that all elements of []
are true. So the identity element for conjunction is True. Should the
disjunction of all elements of [] count as true or false? As false,
for it is false that [] contains an element which is true. Therefore,
the identity element for disjunction is False.

While the above reasoning is fine, and allows straight-forward
implementations, it isn't extremely convincing. In particular, it
isn't clear that, while simple, the definitions of the first paragraph
are the most sensible. Perhaps one of the more mathematically versed
readers on the Cafe could enlighten me?

What got me thinking about this was the apparently incorrect intuition
that 'and xs' would imply 'or xs'.

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


Re: [Haskell-cafe] and [] = True; or [] = False

2010-04-26 Thread Jochem Berndsen
Bjorn Buckwalter wrote:
 Dear all,
 
 Does it make good sense that 'and []' returns 'True' and 'or []'
 returns 'False'? The Haskell Road to Logic, Maths and Programming says
 so:
 
 The function or takes a list of truth values and returns True if at
 least one member of the list equals True, while and takes a list of
 truth values and returns True if all members of the list equal True.
 
 Should the conjunction of all elements of [] count as true or false?
 As true, for it is indeed (trivially) the case that all elements of []
 are true. So the identity element for conjunction is True. Should the
 disjunction of all elements of [] count as true or false? As false,
 for it is false that [] contains an element which is true. Therefore,
 the identity element for disjunction is False.
 
 While the above reasoning is fine, and allows straight-forward
 implementations, it isn't extremely convincing. In particular, it
 isn't clear that, while simple, the definitions of the first paragraph
 are the most sensible. Perhaps one of the more mathematically versed
 readers on the Cafe could enlighten me?

The empty sum is regarded to be zero. The empty product is equal to one.
The empty conjunction is True. The empty disjunction is False.

The reason for this is that these are the neutral elements, i.e.
  0 + x = x
  1 * x = x
  True AND x = x
  False OR x = x

This allows some laws to hold also in degenerate cases, and it is quite
useful in general to accept these conventions. An example of such a law is
(∀ x : x ∈ A : P(x)) ∧ (∀ x : x ∈ B : P(x))
 ==
(∀ x : x ∈ A ∪ B : P(x)).

This also works if A or B is empty, provided that we say that the empty
conjunction is true.

In Haskell, we now have that

(and xs)  (and ys)
 ==
and (xs ++ ys),

even if xs or ys is the empty list.

Cheers, Jochem
-- 
Jochem Berndsen | joc...@functor.nl
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] and [] = True; or [] = False

2010-04-26 Thread Miguel Mitrofanov

Well, what's the sum of an empty list? Seems naturally that it's 0, but why?

Let's say that sum [] = x.

If we take two lists, say, l1 = [1,2,3] and l2 = [4,5], then

sum l1 + sum l2 = 6 + 9 = 15 = sum [1,2,3,4,5] = sum (l1 ++ l2)

We expect it to be the case even if one of the lists is empty, so

x + 9 = sum [] + sum l2 = to be expected = sum ([] ++ l2) = sum l2 = 9

Therefore, x = 0.

With and we have the same thing:

and [] = x

Let l1 = [True, True], l2 = [True, False]

and l1  and l2 = True  False = False = and [True, True, True, False] = and 
(l1 ++ l2)

x  True = and []  and l1 = to be expected = and ([] ++ l1) = and l1 = True

Therefore, x = True.

Bjorn Buckwalter wrote:

Dear all,

Does it make good sense that 'and []' returns 'True' and 'or []'
returns 'False'? The Haskell Road to Logic, Maths and Programming says
so:

The function or takes a list of truth values and returns True if at
least one member of the list equals True, while and takes a list of
truth values and returns True if all members of the list equal True.

Should the conjunction of all elements of [] count as true or false?
As true, for it is indeed (trivially) the case that all elements of []
are true. So the identity element for conjunction is True. Should the
disjunction of all elements of [] count as true or false? As false,
for it is false that [] contains an element which is true. Therefore,
the identity element for disjunction is False.

While the above reasoning is fine, and allows straight-forward
implementations, it isn't extremely convincing. In particular, it
isn't clear that, while simple, the definitions of the first paragraph
are the most sensible. Perhaps one of the more mathematically versed
readers on the Cafe could enlighten me?

What got me thinking about this was the apparently incorrect intuition
that 'and xs' would imply 'or xs'.

Thanks,
Bjorn
___
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] and [] = True; or [] = False

2010-04-26 Thread Daniel Fischer
Am Montag 26 April 2010 14:15:40 schrieb Bjorn Buckwalter:
 Dear all,

 Does it make good sense that 'and []' returns 'True' and 'or []'
 returns 'False'? The Haskell Road to Logic, Maths and Programming says
 so:

 The function or takes a list of truth values and returns True if at
 least one member of the list equals True, while and takes a list of
 truth values and returns True if all members of the list equal True.

 Should the conjunction of all elements of [] count as true or false?
 As true, for it is indeed (trivially) the case that all elements of []
 are true. So the identity element for conjunction is True. Should the
 disjunction of all elements of [] count as true or false? As false,
 for it is false that [] contains an element which is true. Therefore,
 the identity element for disjunction is False.

 While the above reasoning is fine, and allows straight-forward
 implementations, it isn't extremely convincing. In particular, it
 isn't clear that, while simple, the definitions of the first paragraph
 are the most sensible. Perhaps one of the more mathematically versed
 readers on the Cafe could enlighten me?

It's necessary for

and (xs ++ ys) == and xs  and ys

and

or (xs ++ ys) == or xs || or ys

It's the same reason why sum [] == 0 and product [] == 1.


 What got me thinking about this was the apparently incorrect intuition
 that 'and xs' would imply 'or xs'.

Unless xs is empty


 Thanks,
 Bjorn

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


Re: [Haskell-cafe] Why does cabal select base-3.0.3.2 when base-4.2.0.0 is available?

2010-04-26 Thread Bjorn Buckwalter
On Mon, Apr 26, 2010 at 20:07, Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com wrote:
 Bjorn Buckwalter bjorn.buckwal...@gmail.com writes:

 On Mon, Apr 26, 2010 at 19:38, Ivan Lazar Miljenovic
 ivan.miljeno...@gmail.com wrote:
 Bjorn Buckwalter bjorn.buckwal...@gmail.com writes:
 Why does cabal seem to prefer base-3.0.3.2 over base-4.2.0.0 when
 installing packages with an unqualified base requirement? Example:

 [snip]

 The reason that base-3 is chosen is because many of these old
 libraries won't build with base-4; as such, if no upper bound
 restriction is found on the base package then base-3 is chosen as it
 is more likely to work than base-4 (there were a _lot_ of breakages
 when base-4 first came out with 6.10.1).

 I see, I guess that's pragmatic although the deprecation warning is
 unfortunate.

 The deprecation warning is due to GHC 6.12; this is a not-so-subtle hint
 to package maintainers to fix their code up, and to users to poke the
 maintainers of packages they use to do so!

Understood, but in this case the warning seems misdirected since fad
does not restrict itself to base-3.*...

So what would be the fix, to set an upper bound on base? Is the
general recommendation that all packages should specify upper bounds
on all dependencies (if so why doesn't Cabal tell us?)? I can see that
this would make some sense as a package might be broken by an API
change in its dependencies. On the other hand I can also see it
causing headaches occasionally...

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


Re: [Haskell-cafe] and [] = True; or [] = False

2010-04-26 Thread Miguel Mitrofanov

Forgot about this one:

Bjorn Buckwalter wrote:

What got me thinking about this was the apparently incorrect intuition
that 'and xs' would imply 'or xs'.



No. See, and is very close to for all, and or is similarly close to exists. For example, the statement all crows are black means just this crow is black AND this one too AND another one on 
the tree is also black AND... etc.


Now, obviously, all real dragons can fly. But it doesn't mean there is such thing as a 
real dragon.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Why does cabal select base-3.0.3.2 when base-4.2.0.0 is available?

2010-04-26 Thread Daniel Fischer
Am Montag 26 April 2010 14:32:03 schrieb Bjorn Buckwalter:

 So what would be the fix, to set an upper bound on base? Is the
 general recommendation that all packages should specify upper bounds
 on all dependencies (if so why doesn't Cabal tell us?)?

Yes, that's the general recommendation. (upper and lower bounds)

 I can see that
 this would make some sense as a package might be broken by an API
 change in its dependencies.

Exactly. That's why bounds on the versions of the dependencies are a good 
thing.

 On the other hand I can also see it
 causing headaches occasionally...

Yes, but probably less headaches than packages eternally breaking because 
of API changes in the dependencies.


 Thanks,
 Bjorn

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


Re: [Haskell-cafe] Why does cabal select base-3.0.3.2 when base-4.2.0.0 is available?

2010-04-26 Thread Ivan Lazar Miljenovic
Bjorn Buckwalter bjorn.buckwal...@gmail.com writes:
 So what would be the fix, to set an upper bound on base?

The fix is to have the maintainer check whether or not the package
builds with base-4 (you can do this the old manual way using runhaskell
Setup.hs).  If it does, then specify that it does so, e.g.:

  base  5

The upper bound is needed (and Hackage now enforces this) because too
many packages have this same problem: the maintainers blindly assume
that the package will build for all time, and then it dies the next time
a new major version of the base package is released.  Note that some
people cheat by having dependencies like base  10 as Hackage will
accept this because there is indeed an upper bound, but this just causes
problems in the future (Don Stewart had base  5 for a release of
ghc-core which then failed to build with base-4).

 Is the general recommendation that all packages should specify upper
 bounds on all dependencies (if so why doesn't Cabal tell us?)?

This is the eventual goal and is why Duncan Coutts is pushing the
Package Versioning Policy
(http://www.haskell.org/haskellwiki/Package_versioning_policy) as you
can tell from the version (if it is followed correctly) when the API has
changed in a backwards-incompatible fashion.

At the moment, however, Hackage - not Cabal - enforces the requirement
on the base package for all new packages uploaded.  This isn't made
compulsory for all package dependencies as 1) it is base dependencies
that typically cause most of the breakages and 2) not all packages
follow the PVP and thus doing this doesn't always make sense (e.g. some
packages use a date-based versioning system for some reason).

 I can see that this would make some sense as a package might be broken
 by an API change in its dependencies. On the other hand I can also see
 it causing headaches occasionally...

Right, see the recent thread started by John Goerzon The instability of
Haskell libraries which is in part to do with this problem.  At the
moment when a dependency has a major version update but is still
buildable by your package you have to create a new release to let it use
that updated dependency, which is a pain and isn't always done promptly
by maintainers.  Possibly the best way towards fixing this is the
proposal to take the Cabal files outside of the tarballs and distribute
them separately; that way they can be edited without affecting the
tarball in question (thus making them even more like Gentoo's ebuild or
Arch's PKGBUILD files).

-- 
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] and [] = True; or [] = False

2010-04-26 Thread Neil Brown

Bjorn Buckwalter wrote:

Dear all,

Does it make good sense that 'and []' returns 'True' and 'or []'
returns 'False'? 
It's certainly what I would expect it to do, based on several ways of 
thinking.


1: If we define the function using explicit recursion:
and (x:xs) = x  and xs
Therefore and [] has to be True.  Similar logic for or.

2: My instinct is to consider and = all (== True), while or = any (== 
True).  It's even clearer to me that all [] = True and any [] = 
False (similiar to Miguel's post).


Thanks,

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


Re: [Haskell-cafe] and [] = True; or [] = False

2010-04-26 Thread Bjorn Buckwalter
Ok Guys, you've convinced me thrice within ten minutes of posing my
question. The quality of the mailing list is just ridiculous! ;)

And Miguel, thanks for the follow-up regarding for all and exists
– it's an excellent analogy and easy to remember!


On Mon, Apr 26, 2010 at 20:23, Jochem Berndsen joc...@functor.nl wrote:
 Bjorn Buckwalter wrote:
 Dear all,

 Does it make good sense that 'and []' returns 'True' and 'or []'
 returns 'False'? The Haskell Road to Logic, Maths and Programming says
 so:

 The function or takes a list of truth values and returns True if at
 least one member of the list equals True, while and takes a list of
 truth values and returns True if all members of the list equal True.

 Should the conjunction of all elements of [] count as true or false?
 As true, for it is indeed (trivially) the case that all elements of []
 are true. So the identity element for conjunction is True. Should the
 disjunction of all elements of [] count as true or false? As false,
 for it is false that [] contains an element which is true. Therefore,
 the identity element for disjunction is False.

 While the above reasoning is fine, and allows straight-forward
 implementations, it isn't extremely convincing. In particular, it
 isn't clear that, while simple, the definitions of the first paragraph
 are the most sensible. Perhaps one of the more mathematically versed
 readers on the Cafe could enlighten me?

 The empty sum is regarded to be zero. The empty product is equal to one.
 The empty conjunction is True. The empty disjunction is False.

 The reason for this is that these are the neutral elements, i.e.
  0 + x = x
  1 * x = x
  True AND x = x
  False OR x = x

 This allows some laws to hold also in degenerate cases, and it is quite
 useful in general to accept these conventions. An example of such a law is
 (∀ x : x ∈ A : P(x)) ∧ (∀ x : x ∈ B : P(x))
  ==
 (∀ x : x ∈ A ∪ B : P(x)).

 This also works if A or B is empty, provided that we say that the empty
 conjunction is true.

 In Haskell, we now have that

 (and xs)  (and ys)
  ==
 and (xs ++ ys),

 even if xs or ys is the empty list.

 Cheers, Jochem
 --
 Jochem Berndsen | joc...@functor.nl

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


Re: [Haskell-cafe] Broken ghc documentation links

2010-04-26 Thread Ivan Lazar Miljenovic
Daniel Fischer daniel.is.fisc...@web.de writes:

 Am Montag 26 April 2010 13:36:22 schrieb Ivan Lazar Miljenovic:
 So, the problem is that there are broken links _in Hoogle_;

 No, hoogle just sends you to 
 http://www.haskell.org/ghc/docs/6.12.2/html/libraries/base-4.2.0.1/Prelude.html#t%3AIO
 , which does exist. It's the 'Source' link in the haddocks that sends you 
 to the 404 Not Found.
 It's the same with my local docs, I think it's haddock that got confused by 
 the move of the IO definition from base to ghc-prim.

Yeah, as I've said I mis-read the initial problem (I've fielded a few
queries recently regarding Hoogle not pointing to the 6.12.2 docs and
initially thought this was another one).

-- 
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] Installing ghc in an OpenSolaris Zone

2010-04-26 Thread Günther Schmidt

Hello,

has anyone yet managed to install ghc (6.10.4) into an OpenSolaris zone?

Günther


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


Re: [Haskell-cafe] The instability of Haskell libraries

2010-04-26 Thread John Goerzen

On 04/25/2010 03:47 PM, Ivan Lazar Miljenovic wrote:

So you recommend having packages specifically for instances?

My main problem with this is if you want a custom variant of that
instance.  Let's take FGL graphs for example with instances for
QuickCheck's Arbitrary class.  Maybe you want arbitrary graphs that are
simple, or maybe multiple edges are fine.  Even when considering
Arbitrary instances for something like String you may wish to have a
custom variant that makes sense for what you're testing.

My conclusion: it is not possible to have hard-and-fast conclusions for
things like this :p


I'm inclined to agree.  As an example, there is the convertible library. 
 It grew out of the need to make an easy way to map Haskell to database 
types in HDBC, and these days is a more general way to convert from one 
type to another.  I provide a bunch of Convertible instances, but they 
are in separate modules, and thus can be omitted if a person doesn't 
want the instances.  As an example: what's the correct way to convert a 
Double to an Integer?  As an example, Prelude defines at least 4: 
ceiling, floor, truncate, and round.


Now, in a certain sense, Convertible is designed for people that don't 
care which is used.  (And yes, that is a perfectly valid answer in some 
cases.)  But if you want your own, you can simply not import the numeric 
Convertible instances.


It would, however, be nice if the language allowed you to override 
default instances with the code in your own package.


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


[Haskell-cafe] ANNOUNCE: graphviz 2999.9.0.0

2010-04-26 Thread Ivan Lazar Miljenovic

I'm pleased to announce the latest version of my graphviz library that
provides Haskell bindings to the Graphviz graph visualisation suite.

There are numerous changes in this release, the most important of which
are:

* graphviz now has an FAQ and an improved README as well as its own
  homepage: http://projects.haskell.org/graphviz/ (as prompted by Eric
  Kow).

* Add support for record labels; values are automatically
  escaped/unescaped.  The `Record` and `MRecord` shapes have been
  added for use with these labels.  Requested by Minh Thu and Eric
  Kow.

* Add support for HTML-like values (this replaces the wrong and
  completely broken URL datatype).  Strings are automatically
  escaped/unescaped.

* Various parsing improvements (including a slight parsing speed
  increase!).

In particular, graphviz is now able to parse almost all Dot graphs found
on my system (including samples shipped with Graphviz, Linux kernel
documentation and various other package documentations).  A list of the
breakages and why:

* /usr/share/sgml/docbook/xsl-stylesheets/roundtrip/template.dot seems
  to be a binary file and thus can't be read.

* /usr/share/graphviz/graphs/directed/Latin1.gv uses Latin1 encoding; at
  the moment graphviz uses the system's locale encoding (or whatever GHC
   6.10 defaults to).

* /usr/share/doc/boost-*/html/libs/graph/example/graphviz_test.dot
  (various boost versions) has subgraphs in edges; graphviz currently
  can't cope with these.

* 
/usr/src/linux-2.6.33-gentoo-r1/Documentation/blockdev/drbd/drbd-connection-state-overview.dot
 uses incorrect syntax for the minlen attribute (it is meant to be an
 integer but actually contains a floating point value).

The plans for the next release (which I don't plan on even starting for
a while) are to focus on improving printing and parsing performance,
using a state-based printer and parser (as part of Dot syntax is
state-based) and force usage of UTF-8 (via text or utf8-string).

--
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] Re: ANNOUNCE: graphviz 2999.9.0.0

2010-04-26 Thread Ivan Miljenovic
A few things I forgot to mention in my haste to get this out:

1) I was planning on having a tutorial-style blog post where I'd use
graphviz to parse an manipulate the output ghc-pkg dot; however I've
been busier than I expected recently and figured it'd be better to get
this release out and do this later.

2) The website was developed with the help of John MacFarlane; at the
moment I'm using the CSS he uses for Pandoc's homepage, but I plan on
updating that during the week (again, better to get it out now and fix
it later).

And with that, I need to sleep.  Having a public holiday to get this
finished in was nice, but it didn't help with my sleep deprivation :s

On 26 April 2010 23:46, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote:

 I'm pleased to announce the latest version of my graphviz library that
 provides Haskell bindings to the Graphviz graph visualisation suite.

 There are numerous changes in this release, the most important of which
 are:

 * graphviz now has an FAQ and an improved README as well as its own
  homepage: http://projects.haskell.org/graphviz/ (as prompted by Eric
  Kow).

 * Add support for record labels; values are automatically
  escaped/unescaped.  The `Record` and `MRecord` shapes have been
  added for use with these labels.  Requested by Minh Thu and Eric
  Kow.

 * Add support for HTML-like values (this replaces the wrong and
  completely broken URL datatype).  Strings are automatically
  escaped/unescaped.

 * Various parsing improvements (including a slight parsing speed
  increase!).

 In particular, graphviz is now able to parse almost all Dot graphs found
 on my system (including samples shipped with Graphviz, Linux kernel
 documentation and various other package documentations).  A list of the
 breakages and why:

 * /usr/share/sgml/docbook/xsl-stylesheets/roundtrip/template.dot seems
  to be a binary file and thus can't be read.

 * /usr/share/graphviz/graphs/directed/Latin1.gv uses Latin1 encoding; at
  the moment graphviz uses the system's locale encoding (or whatever GHC
   6.10 defaults to).

 * /usr/share/doc/boost-*/html/libs/graph/example/graphviz_test.dot
  (various boost versions) has subgraphs in edges; graphviz currently
  can't cope with these.

 * 
 /usr/src/linux-2.6.33-gentoo-r1/Documentation/blockdev/drbd/drbd-connection-state-overview.dot
  uses incorrect syntax for the minlen attribute (it is meant to be an
  integer but actually contains a floating point value).

 The plans for the next release (which I don't plan on even starting for
 a while) are to focus on improving printing and parsing performance,
 using a state-based printer and parser (as part of Dot syntax is
 state-based) and force usage of UTF-8 (via text or utf8-string).

 --
 Ivan Lazar Miljenovic
 ivan.miljeno...@gmail.com
 IvanMiljenovic.wordpress.com




-- 
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] maling-list manager in haskell?

2010-04-26 Thread Günther Schmidt

Hi,

is there a mailing-list manager written in haskell?

Best regards

Günther


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


Re: [Haskell-cafe] Broken ghc documentation links

2010-04-26 Thread Daniel Fischer
Am Montag 26 April 2010 15:15:03 schrieb Ivan Lazar Miljenovic:
 Daniel Fischer daniel.is.fisc...@web.de writes:
  Am Montag 26 April 2010 13:36:22 schrieb Ivan Lazar Miljenovic:
  So, the problem is that there are broken links _in Hoogle_;
 
  No, hoogle just sends you to
  http://www.haskell.org/ghc/docs/6.12.2/html/libraries/base-4.2.0.1/Pre
 lude.html#t%3AIO , which does exist. It's the 'Source' link in the
  haddocks that sends you to the 404 Not Found.
  It's the same with my local docs, I think it's haddock that got
  confused by the move of the IO definition from base to ghc-prim.

 Yeah, as I've said I mis-read the initial problem (I've fielded a few
 queries recently regarding Hoogle not pointing to the 6.12.2 docs and
 initially thought this was another one).

Yes, I sent the reply before your second reply hit my inbox.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Order of arguments to GCC when building SDL on Windows with Cabal

2010-04-26 Thread JP Moresmau
Hello, I've been trying for a while to build the SDL haskell library
on windows. People have told me it worked for them, but I can't get to
work for the life of me. I have the latest Haskell Platform, I think
more or less the latest MINGW and MSYS tools. I'm on Windows 7 64
bits. I installed the SDL library without hassle, and the samples
work. It's only the haskell library that's bothering me. I've modified
the .cabal file as indicated for Windows (extra-include-dirs,
extra-lib-dirs), and runhaskell Setup configure. But then runhaskell
Setup build fails with:

Preprocessing library SDL-0.5.9...
dist\build\Graphics\UI\SDL\General_hsc_make.o:General_hsc_make.c:(.text
+0x29): m
ultiple definition of `main'
d:/dev/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../
libmingw32.a(main.o):main.c:(
.text+0x0): first defined here
D:\dev\SDL-1.2.14\lib/libSDLmain.a(SDL_win32_main.o): In function
`console_main'
:
/Users/hercules/trunk/SDL-1.2/./src/main/win32/SDL_win32_main.c:315:
undefined r
eference to `SDL_main'
collect2: ld returned 1 exit status
linking dist\build\Graphics\UI\SDL\General_hsc_make.o failed
command was: d:\dev\MinGW\bin\gcc.exe -LD:\dev\SDL-1.2.14\lib -L/usr/
lib -lmingw
32 -lSDLmain -lSDL -mwindows -LD:\dev\haskell\HaskellPlatform
\2010.1.0.0\base-4.
2.0.0 -lwsock32 -luser32 -lshell32 -LD:\dev\haskell\HaskellPlatform
\2010.1.0.0\i
nteger-gmp-0.2.0.0 -LD:\dev\haskell\HaskellPlatform\2010.1.0.0\ghc-
prim-0.2.0.0
-LD:\dev\haskell\HaskellPlatform\2010.1.0.0 -LD:\dev\haskell
\HaskellPlatform\201
0.1.0.0/gcc-lib -lm -lwsock32 -LD:\dev\haskell\HaskellPlatform
\2010.1.0.0 dist\b
uild\Graphics\UI\SDL\General_hsc_make.o -o dist\build\Graphics\UI\SDL
\General_hs
c_make.exe

(I have the same error with the gcc inside the Haskell Platform, the
same error running in a windows shell without MSYS on the path, in the
MSYS bash with MSYS on the path).

And I figured out what's wrong with that line after thinking for a
while (as in, several days...): basically the line says something like
gcc sdl-flags file.o -o file.exe. If I revert the order of the
arguments and run gcc file.o -o file.exe sdl-flags, it works! The gcc
documentation explains that the libraries are searched in the order
they appear (http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html), so
to put the libraries you depend on after the code that has the
dependencies. And I can see that building the SDL samples indeed puts
the .c file before the sdl linker flags. So this seems to be my
problem. What's the solution?
1. I've done something stupid or forgot some essential MINGW tool that
would make my system not dependent on the order of the arguments to
gcc? I've tried with gcc 3.4.5 and gcc 4.5.0, same result.
2. I can hack somewhere (where???) the command passed on to GCC when
building? Maybe some voodoo in the cabal file?
3. I can get runhaskell Setup build to only dump the commands it's
going to run, modify them in my favorite text editor and run them
manually (as said above, I've managed to create the first exe required
but build insists on rebuilding it even if present)
4. ...?

The fact that some people managed seem to point with a problem with my
config, but it's seems reasonnably clean to me, and I've even managed
to install wxWidgets and wxHaskell...

Any help appreciated!

-- 
JP Moresmau
http://jpmoresmau.blogspot.com/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Bulk Synchronous Parallel

2010-04-26 Thread Thomas Horstmeyer

Hi Aaron,

On 21.04.2010 20:29, Aaron D. Ball wrote:
 Unfortunately, Eden is one of the examples I had in mind when
 referring to distributed Haskell projects as overly complicated and
 [for practical purposes] dead.  Their last release available for
 download was in 2006.  Their beta is available upon request, which
 doesn't raise my confidence in the level of active development or
 openness of the project.

You're partly right. The development of the Eden system itself has been 
neglected for a time. Mostly because Jost Berthold (the main system 
programmer) finished his PhD and left Marburg (and has only limited 
spare time with his new job). The remaining members of the Eden group 
here were mostly language users and language developers, not system 
implementors. No one really opted to take over responsibility...
However, this is changing right now. We are actively merging the Eden 
runtime and that of the GpH language (as both need basically the same 
features) to get a new runtime based on GHC 6.12 (and GHC HEAD). This 
runtime, while still in beta state, is already usable. However, building 
it is currently still a bit too complicated to bother end users with it. 
So, if your complicated is referring to this, you are right. We hope 
to simplify this and to have a usable release in the near future. If 
your complicated was targetting the use of the Eden language itself, 
however, I object!




 They just had a hackathon in St Andrews,

 http://hackage.haskell.org/trac/ghc/wiki/HackPar

 they don't seem to have even a source code repository yet, and they
 appear to be bogged down in that complexity I mentioned.

Of course, a source code repository for Eden always existed. The new 
repository was meant for the merged version of Eden/GpH. And that exists 
as well. The Eden webpage will be updated as soon as we have a 
pre-release of the 6.12 branch.



Best regards,
Thomas Horstmeyer (Eden group Marburg)

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


[Haskell-cafe] Haddock infix constructors in markup

2010-04-26 Thread Ozgur Akgun
Hi all,

If I have the following data type:

data Expr = Num Int | Expr :+: Expr | Expr :-: Expr

Haddock handles the infix constructors, and generates a very nice output
(html in this case)
However when I try to reference to one of the infix constructors in the
markup of other functions it fails to hyperlink.

-- | If the input is 'Num' does magic, if it is ':+:' does even more magic!
someFunc :: Expr - Expr

In the output of this markup, the 'Num' is hyperlinked but the ':+:' is not.
Is there a different syntax for infix constructors (and for infix functions
presumably) or does haddock simple lack this feature?

Best,

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


Re: [Haskell-cafe] Haddock infix constructors in markup

2010-04-26 Thread Daniel Fischer
Am Montag 26 April 2010 18:15:02 schrieb Ozgur Akgun:
 Hi all,

 If I have the following data type:

 data Expr = Num Int | Expr :+: Expr | Expr :-: Expr

 Haddock handles the infix constructors, and generates a very nice output
 (html in this case)
 However when I try to reference to one of the infix constructors in the
 markup of other functions it fails to hyperlink.

 -- | If the input is 'Num' does magic, if it is ':+:' does even more
 magic! someFunc :: Expr - Expr

 In the output of this markup, the 'Num' is hyperlinked but the ':+:' is
 not. Is there a different syntax for infix constructors (and for infix
 functions presumably) or does haddock simple lack this feature?

Infix functions work fine (try referring to e.g. '' in the haddock 
comment), but infix constructors apparently not.


 Best,

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


[Haskell-cafe] Fwd: Mancoosi International Solver Competition

2010-04-26 Thread Johannes Waldmann
This looks interesting: an international competition 
of solvers for package/component installation and upgrade problems.
http://www.mancoosi.org/misc-2010/  (deadline: June 10)

Is the underlying package dependency model the same as cabal's?
If (nearly) so, then cabal's solver could enter the competition -
if it wins, then fine; if not, then it could be replaced by the winner :-)


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


Re: [Haskell-cafe] Build problems (hsp, trhsx, ultimately Happstack)

2010-04-26 Thread Alexander Solla


On Apr 23, 2010, at 2:59 PM, Thomas Hartman wrote:


So, you might need to
-- upgrade hsx
-- make sure that the upgraded trhsx executable is the one being
executed by cabal install hsx (maybe deleting/temporarily moving other
trhsx exes)


Unfortunately, this suggestion didn't work out for me.  I read through  
all the relevant GHC documentation I could find -- I didn't see a way  
to set a specific path for GHC to search through for binaries.   
Whether I moved trhsx or not, the error was the same.  But it's the  
only trhsx on my system.


I've upgraded through every version of hsx that is compatible with  
Happstack, and tried every hsp that is compatible with Happstack.   
I've built Cabal-install, removed it, used the Arch package; tried  
global/user installs for Happstack;  did a darcs get on the official  
Happstack repo, and tried to build using its build script, on a fresh  
GHC install; and other stuff that I guess didn't make much sense.


It always broke in the same place:

[ a...@kizaru:~/ ]$ cabal install hsp-0.4.5
Resolving dependencies...
Configuring hsp-0.4.5...
Preprocessing library hsp-0.4.5...
Building hsp-0.4.5...
ghc: could not execute: trhsx
cabal: Error: some packages failed to install:
hsp-0.4.5 failed during the building phase. The exception was:
ExitFailure 1

The strange thing about it (that I noticed) is that GHC reports  
failing during the building phase instead of the preprocessing phase.   
Maybe this is just an artifact of the logging system, but it seems  
like GHC is doing something strange.  If I increase the verbosity,  
(near the end) I get:


*** Haskell pre-processor:
trhsx src/HSP/HJScript.hs /tmp/ghc6345_0/ghc6345_6.hscpp /tmp/ 
ghc6345_0/ghc6345_0.hspp

*** Deleting temp files:
Deleting: /tmp/ghc6345_0/ghc6345_0.hspp /tmp/ghc6345_0/ 
ghc6345_6.hscpp /tmp/ghc6345_0/ghc6345_5.hscpp /tmp/ghc6345_0/ 
ghc6345_4.hscpp /tmp/ghc6345_0/ghc6345_3.hscpp /tmp/ghc6345_0/ 
ghc6345_2.hscpp /tmp/ghc6345_0/ghc6345_1.hscpp /tmp/ghc6345_0/ 
ghc6345_0.hscpp

Warning: deleting non-existent /tmp/ghc6345_0/ghc6345_0.hspp
*** Deleting temp dirs:
Deleting: /tmp/ghc6345_0
ghc: could not execute: trhsx
/usr/bin/ghc returned ExitFailure 1
cabal: Error: some packages failed to install:
hsp-0.4.5 failed during the building phase. The exception was:
ExitFailure 1


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


Re: [Haskell-cafe] The instability of Haskell libraries

2010-04-26 Thread Brandon S. Allbery KF8NH

On Apr 26, 2010, at 09:33 , John Goerzen wrote:
It would, however, be nice if the language allowed you to override  
default instances with the code in your own package.



Many other languages refer to this kind of thing as monkey patching  
and warn against it because of the problems it causes.


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon universityKF8NH




PGP.sig
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: What do _you_ want to see in FGL?

2010-04-26 Thread Louis Wasserman
I'm a fan of making FGL more record-based, but definitely keeping the
inductive graph style.

My own biggest gripe with previous versions of FGL was that the graph
implementations were severely underoptimized.  In particular, PatriciaTree
left open a *lot* of optimization.

Ivan, would you like to set up a darcs repo for FGL-Prime or something at
code.haskell.org, and start cracking?  I'm really excited for this project.

Louis Wasserman
wasserman.lo...@gmail.com
http://profiles.google.com/wasserman.louis
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Rank-2 polymorphism and overloading

2010-04-26 Thread Thomas van Noort

Hello all,

I'm having difficulties understanding rank-2 polymorphism in combination 
with overloading. Consider the following contrived definition:


f :: (forall a . Eq a = a - a - Bool) - Bool
f eq = eq True True

Then, we pass f both an overloaded function and a regular polymorphic 
function:


x :: forall a . Eq = a - a - Bool
x = \x y - x == y

y :: forall a . a - a - Bool
y = \x y - True

g :: (Bool, Bool)
g = (f x, f y)

Could someone explain to me, or point me to some reading material, why g 
is correctly typed?


I understand that x's type is what f expects, but why does y's 
polymorphic type fulfill the overloaded type of f's argument? I can 
imagine that it is justified since f's argument type is more restrictive 
than y's type. However, it requires y to throw away the provided 
dictionary under the hood, which seems counter intuitive to me.


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


[Haskell-cafe] Halp: wacky FFI problems

2010-04-26 Thread Louis Wasserman
Hey,

I'm trying to do some funky things with the FFI, and I'm clueless enough
with C that I could use some help.

In particular, I'm trying to bind to the glpk library in a multithreaded
style.  It's not normally thread-safe, but somebody suggested how to make it
safe here http://www.mail-archive.com/help-g...@gnu.org/msg04021.html.

I have no idea how to integrate this with FFI-style bindings.  A
single-threaded set of bindings that I've written is here:
http://hackage.haskell.org/package/glpk-hs  I'm trying to figure out how to
integrate FFI bindings with pthreads, and yadda yadda, and I'm pretty
clueless.

Any suggestions?

Louis Wasserman
wasserman.lo...@gmail.com
http://profiles.google.com/wasserman.louis
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Rank-2 polymorphism and overloading

2010-04-26 Thread Jochem Berndsen
Thomas van Noort wrote:
 Hello all,
 
 I'm having difficulties understanding rank-2 polymorphism in combination
 with overloading. Consider the following contrived definition:
 
 f :: (forall a . Eq a = a - a - Bool) - Bool
 f eq = eq True True
 
 Then, we pass f both an overloaded function and a regular polymorphic
 function:
 
 x :: forall a . Eq = a - a - Bool
 x = \x y - x == y
 
 y :: forall a . a - a - Bool
 y = \x y - True
 
 g :: (Bool, Bool)
 g = (f x, f y)
 
 Could someone explain to me, or point me to some reading material, why g
 is correctly typed?
 
 I understand that x's type is what f expects, but why does y's
 polymorphic type fulfill the overloaded type of f's argument? I can
 imagine that it is justified since f's argument type is more restrictive
 than y's type. However, it requires y to throw away the provided
 dictionary under the hood, which seems counter intuitive to me.

f requires a function that is able to compute, for two values of type a
(which instantiates Eq), a Boolean.

y certainly fulfills that requirement: it does not even require that the
values are of a type instantiating Eq.

This is also well-typed and might or might not be enlightening:

 z :: forall a. Eq a = a - a - Bool
 z = y

 g :: (Bool, Bool)
 g = (f x, f z) -- note the use of z here instead of y

Jochem
-- 
Jochem Berndsen | joc...@functor.nl

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


Re: [Haskell-cafe] Rank-2 polymorphism and overloading

2010-04-26 Thread Daniel Fischer
Am Montag 26 April 2010 19:52:23 schrieb Thomas van Noort:
 Hello all,

 I'm having difficulties understanding rank-2 polymorphism in combination
 with overloading. Consider the following contrived definition:

 f :: (forall a . Eq a = a - a - Bool) - Bool
 f eq = eq True True

 Then, we pass f both an overloaded function and a regular polymorphic
 function:

 x :: forall a . Eq = a - a - Bool
 x = \x y - x == y

 y :: forall a . a - a - Bool
 y = \x y - True

 g :: (Bool, Bool)
 g = (f x, f y)

 Could someone explain to me, or point me to some reading material, why g
 is correctly typed?

 I understand that x's type is what f expects, but why does y's
 polymorphic type fulfill the overloaded type of f's argument? I can
 imagine that it is justified since f's argument type is more restrictive
 than y's type.

Yes, y's type is more general than the type required by f, hence y is an 
acceptable argument for f - even z :: forall a b. a - b - Bool is.

 However, it requires y to throw away the provided
 dictionary under the hood, which seems counter intuitive to me.

Why? y doesn't need the dictionary, so it just ignores it.


 Regards,
 Thomas

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


[Haskell-cafe] The Poor Man's PVP-Checking Tool

2010-04-26 Thread Neil Brown

Hi,

The issue of a tool to help with checking packages against the Package 
Versioning Policy (PVP: 
http://www.haskell.org/haskellwiki/Package_versioning_policy) has come 
up several times on this list, and it seems to be a generally wanted 
tool.  One of the things desired in such a tool is the ability to check 
what has been added/changed/removed in the latest version of a package, 
to help see what kind of version bump is needed according to the PVP.  
This could also be used to check if past releases have obeyed the PVP.


A proper way to build this tool is to parse the types of everything 
involved (functions, data  types, and instances), and check them for 
being the same (given that the type parameters may have been renamed, or 
a definition substituted for a synonym and so on).  I have instead 
hacked together a tool in an hour or so that roughly does the job.  It 
uses Perl, which I haven't written for a long time, because that was 
quickest  -- if this bothers you, pretend its a crazy Haskell EDSL or 
something :-).  I've attached the Perl script.  It combines the 
command-line tools diff and sort with a tiny bit of manual processing 
along with the Haskell tool cabal-install, and brings them to bear on 
the output of haddock --hoogle, which already nicely spits out the 
types of all functions, data types and instances in your library.


It looks for differences in the output between two package versions, and 
tells you what version bump it thinks you need.  It errs on the 
conservative side, I believe -- it should never miss a bump when it's 
needed, but you may sometimes get a false alarm if you've made a 
harmless change.


As an example, let's take the recent stm release.  You run the Perl 
script with the name and version of both package versions (if you omit 
the version, it should use the latest):



n...@beast ~: perl cmp.perl stm-2.1.2.0 stm-2.1.1.2
Warning: The documentation for the following packages are not installed. No
links will be generated to these packages: ffi-1.0, rts-1.0
Warning: The documentation for the following packages are not installed. No
links will be generated to these packages: ffi-1.0, rts-1.0
25a26
 Control.Concurrent.STM.TVar:readTVarIO :: TVar a - IO a
39c40
 @version 2.1.1.2
---
 @version 2.1.2.0

Given previous version number A.B.C.D:
It seems you have added something.  You must increase C (or A or B)


For those who can read diff, you get the diff.  At the bottom, the tool 
works out the required bump; here something was added so C must be 
increased, and we can see that the package did just that.  Let's take 
another example from my latest development version of my CHP library; 
here I run the command with one argument (chp, which means the latest 
version on Hackage):



n...@banshee ~/work/chp: perl cmp.perl chp
Warning: The documentation for the following packages are not installed. No
links will be generated to these packages: rts-1.0

Control/Concurrent/CHP/Alt.hs:116:9:
   Warning: orphan instance: instance Alternative CHP
Warning: The documentation for the following packages are not installed. No
links will be generated to these packages: rts-1.0
6a7
 Control.Concurrent.CHP.Alt:instance Alternative CHP
82d82
 Control.Concurrent.CHP.Channels.Creation:class ChannelTuple t
88,92d87
 Control.Concurrent.CHP.Channels.Creation:instance (Channel r w) = 
ChannelTuple (Chan r w a, Chan r w a)
 Control.Concurrent.CHP.Channels.Creation:instance (Channel r w) = 
ChannelTuple (Chan r w a, Chan r w a, Chan r w a)
 Control.Concurrent.CHP.Channels.Creation:instance (Channel r w) = 
ChannelTuple (Chan r w a, Chan r w a, Chan r w a, Chan r w a)
 Control.Concurrent.CHP.Channels.Creation:instance (Channel r w) = 
ChannelTuple (Chan r w a, Chan r w a, Chan r w a, Chan r w a, Chan r w a)
 Control.Concurrent.CHP.Channels.Creation:instance (Channel r w) = 
ChannelTuple (Chan r w a, Chan r w a, Chan r w a, Chan r w a, Chan r w 
a, Chan r w a)

102d96
 Control.Concurrent.CHP.Channels.Creation:newChannels :: (ChannelTuple 
t, MonadCHP m) = m t

149c143
 Control.Concurrent.CHP.Monad:class (MonadIO m) = MonadCHP m
---
 Control.Concurrent.CHP.Monad:class (Monad m) = MonadCHP m
155a150
 Control.Concurrent.CHP.Monad:foreverP :: CHP a - CHP b
156a152
 Control.Concurrent.CHP.Monad:liftIO_CHP :: IO a - CHP a
160a157
 Control.Concurrent.CHP.Monad:process :: String - a - a
164a162
 Control.Concurrent.CHP.Monad:subProcess :: String - a - a
169c167
 Control.Concurrent.CHP.Parallel:data (Monad m, MonadCHP m) = ForkingT m a
---
 Control.Concurrent.CHP.Parallel:data ForkingT m a
173d170
 Control.Concurrent.CHP.Parallel:instance (MonadIO m) = MonadIO 
(ForkingT m)

175c172
 Control.Concurrent.CHP.Parallel:instance MonadTrans ForkingT
---
 Control.Concurrent.CHP.Parallel:liftForking :: (Monad m) = m a - 
ForkingT m a

239c236
 @version 2.1.0.1
---
 @version 2.2.0

Given previous version number A.B.C.D:
It seems you have added, removed or changed some instances.  You must 

Re: [Haskell-cafe] Haddock infix constructors in markup

2010-04-26 Thread David Waern
2010/4/26 Daniel Fischer daniel.is.fisc...@web.de:
 Am Montag 26 April 2010 18:15:02 schrieb Ozgur Akgun:
 Hi all,

 If I have the following data type:

 data Expr = Num Int | Expr :+: Expr | Expr :-: Expr

 Haddock handles the infix constructors, and generates a very nice output
 (html in this case)
 However when I try to reference to one of the infix constructors in the
 markup of other functions it fails to hyperlink.

 -- | If the input is 'Num' does magic, if it is ':+:' does even more
 magic! someFunc :: Expr - Expr

 In the output of this markup, the 'Num' is hyperlinked but the ':+:' is
 not. Is there a different syntax for infix constructors (and for infix
 functions presumably) or does haddock simple lack this feature?

 Infix functions work fine (try referring to e.g. '' in the haddock
 comment), but infix constructors apparently not.

Yes, I actually fixed this a few weeks ago in Haddock's lexer. Colon
was just not included in the character set for identifiers.

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


Re: [Haskell-cafe] Rank-2 polymorphism and overloading

2010-04-26 Thread Thomas van Noort

On 26-4-2010 20:13, Jochem Berndsen wrote:

Thomas van Noort wrote:

...


f requires a function that is able to compute, for two values of type a
(which instantiates Eq), a Boolean.

y certainly fulfills that requirement: it does not even require that the
values are of a type instantiating Eq.

This is also well-typed and might or might not be enlightening:


z :: forall a. Eq a =  a -  a -  Bool
z = y

g :: (Bool, Bool)
g = (f x, f z) -- note the use of z here instead of y


I find your example of z more intuitive as it is z that does not provide 
its dictionary to y, but throws it away explicitly. This in contrast to 
y that is provided a dictionary but throws it away implicitly.


Regards,
Thomas



Jochem


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


Re: [Haskell-cafe] Rank-2 polymorphism and overloading

2010-04-26 Thread Thomas van Noort

On 26-4-2010 20:12, Daniel Fischer wrote:

Am Montag 26 April 2010 19:52:23 schrieb Thomas van Noort:

...


Yes, y's type is more general than the type required by f, hence y is an
acceptable argument for f - even z :: forall a b. a -  b -  Bool is.


That's what I thought. I've just never seen such a notion of a more 
general type involving overloading before.





However, it requires y to throw away the provided
dictionary under the hood, which seems counter intuitive to me.


Why? y doesn't need the dictionary, so it just ignores it.


Sure, but y's type explicitly mentions that it doesn't want a 
dictionary, so why would you provide one to it?






Regards,
Thomas




Regards,
Thomas

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


Re: [Haskell-cafe] Build problems (hsp, trhsx, ultimately Happstack)

2010-04-26 Thread Jeremy Shaw

Hello,

Does trying to install hsp-0.5.1 work any better?

- jeremy

On Apr 26, 2010, at 12:27 PM, Alexander Solla wrote:



On Apr 23, 2010, at 2:59 PM, Thomas Hartman wrote:


So, you might need to
-- upgrade hsx
-- make sure that the upgraded trhsx executable is the one being
executed by cabal install hsx (maybe deleting/temporarily moving  
other

trhsx exes)


Unfortunately, this suggestion didn't work out for me.  I read  
through all the relevant GHC documentation I could find -- I didn't  
see a way to set a specific path for GHC to search through for  
binaries.  Whether I moved trhsx or not, the error was the same.   
But it's the only trhsx on my system.


I've upgraded through every version of hsx that is compatible with  
Happstack, and tried every hsp that is compatible with Happstack.   
I've built Cabal-install, removed it, used the Arch package; tried  
global/user installs for Happstack;  did a darcs get on the official  
Happstack repo, and tried to build using its build script, on a  
fresh GHC install; and other stuff that I guess didn't make much  
sense.


It always broke in the same place:

[ a...@kizaru:~/ ]$ cabal install hsp-0.4.5
Resolving dependencies...
Configuring hsp-0.4.5...
Preprocessing library hsp-0.4.5...
Building hsp-0.4.5...
ghc: could not execute: trhsx
cabal: Error: some packages failed to install:
hsp-0.4.5 failed during the building phase. The exception was:
ExitFailure 1

The strange thing about it (that I noticed) is that GHC reports  
failing during the building phase instead of the preprocessing  
phase.  Maybe this is just an artifact of the logging system, but it  
seems like GHC is doing something strange.  If I increase the  
verbosity, (near the end) I get:


*** Haskell pre-processor:
trhsx src/HSP/HJScript.hs /tmp/ghc6345_0/ghc6345_6.hscpp /tmp/ 
ghc6345_0/ghc6345_0.hspp

*** Deleting temp files:
Deleting: /tmp/ghc6345_0/ghc6345_0.hspp /tmp/ghc6345_0/ 
ghc6345_6.hscpp /tmp/ghc6345_0/ghc6345_5.hscpp /tmp/ghc6345_0/ 
ghc6345_4.hscpp /tmp/ghc6345_0/ghc6345_3.hscpp /tmp/ghc6345_0/ 
ghc6345_2.hscpp /tmp/ghc6345_0/ghc6345_1.hscpp /tmp/ghc6345_0/ 
ghc6345_0.hscpp

Warning: deleting non-existent /tmp/ghc6345_0/ghc6345_0.hspp
*** Deleting temp dirs:
Deleting: /tmp/ghc6345_0
ghc: could not execute: trhsx
/usr/bin/ghc returned ExitFailure 1
cabal: Error: some packages failed to install:
hsp-0.4.5 failed during the building phase. The exception was:
ExitFailure 1


___
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] Run haskell program in emacs without typing main in the ghci buffer.

2010-04-26 Thread Zura_

Hello,

Is it possible to run haskell program in emacs without typing main in the
ghci buffer? Assuming main function exists of course.
Or, maybe automate sending main\n string to ghci buffer input.
In other words, I want edit/run/see result style session.

Thanks in advance,
Zura
-- 
View this message in context: 
http://old.nabble.com/Run-haskell-program-in-emacs-without-typing-%22main%22-in-the-ghci-buffer.-tp28368541p28368541.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

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


Re: [Haskell-cafe] Build problems (hsp, trhsx, ultimately Happstack)

2010-04-26 Thread Alexander Solla


On Apr 26, 2010, at 12:30 PM, Jeremy Shaw wrote:



Does trying to install hsp-0.5.1 work any better?


I hadn't tried it, since it forces hsx-0.7 to install.  But I gave it  
a shot, and it fails the same way:


[ a...@kizaru:~/ ]$ cabal install hsp-0.5.1
Resolving dependencies...
Configuring hsp-0.5.1...
Preprocessing library hsp-0.5.1...
Building hsp-0.5.1...
ghc: could not execute: trhsx
cabal: Error: some packages failed to install:
hsp-0.5.1 failed during the building phase. The exception was:
ExitFailure 1

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


Re: [Haskell-cafe] Haddock infix constructors in markup

2010-04-26 Thread Ozgur Akgun
So, how can we make use of this fix?

On 26 April 2010 19:47, David Waern david.wa...@gmail.com wrote:

 2010/4/26 Daniel Fischer daniel.is.fisc...@web.de:
  Am Montag 26 April 2010 18:15:02 schrieb Ozgur Akgun:
  Hi all,
 
  If I have the following data type:
 
  data Expr = Num Int | Expr :+: Expr | Expr :-: Expr
 
  Haddock handles the infix constructors, and generates a very nice output
  (html in this case)
  However when I try to reference to one of the infix constructors in the
  markup of other functions it fails to hyperlink.
 
  -- | If the input is 'Num' does magic, if it is ':+:' does even more
  magic! someFunc :: Expr - Expr
 
  In the output of this markup, the 'Num' is hyperlinked but the ':+:' is
  not. Is there a different syntax for infix constructors (and for infix
  functions presumably) or does haddock simple lack this feature?
 
  Infix functions work fine (try referring to e.g. '' in the haddock
  comment), but infix constructors apparently not.

 Yes, I actually fixed this a few weeks ago in Haddock's lexer. Colon
 was just not included in the character set for identifiers.

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




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


Re: [Haskell-cafe] Haddock infix constructors in markup

2010-04-26 Thread Daniel Fischer
Am Montag 26 April 2010 22:05:48 schrieb Ozgur Akgun:
 So, how can we make use of this fix?


My guess:

$ cabal install haddock-2.7.2
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Build problems (hsp, trhsx, ultimately Happstack)

2010-04-26 Thread Gregory Collins
Alexander Solla a...@2piix.com writes:

 On Apr 26, 2010, at 12:30 PM, Jeremy Shaw wrote:


 Does trying to install hsp-0.5.1 work any better?

 I hadn't tried it, since it forces hsx-0.7 to install.  But I gave it a shot,
 and it fails the same way:

 [ a...@kizaru:~/ ]$ cabal install hsp-0.5.1
 Resolving dependencies...
 Configuring hsp-0.5.1...
 Preprocessing library hsp-0.5.1...
 Building hsp-0.5.1...
 ghc: could not execute: trhsx
 cabal: Error: some packages failed to install:
 hsp-0.5.1 failed during the building phase. The exception was:
 ExitFailure 1

Is $HOME/.cabal/bin on your $PATH?

G
-- 
Gregory Collins g...@gregorycollins.net
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Build problems (hsp, trhsx, ultimately Happstack)

2010-04-26 Thread Alexander Solla


On Apr 26, 2010, at 1:23 PM, Gregory Collins wrote:


Is $HOME/.cabal/bin on your $PATH?



Argh.

I had ~/.cabal/bin in my $PATH instead of $HOME/.cabal/bin.  I'm  
still not sure what the semantic difference is in this use case, but  
one ($HOME) works and the other (~/) doesn't.


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


Re: [Haskell-cafe] Build problems (hsp, trhsx, ultimately Happstack)

2010-04-26 Thread Daniel Fischer
Am Montag 26 April 2010 22:23:42 schrieb Gregory Collins:
 Alexander Solla a...@2piix.com writes:
  On Apr 26, 2010, at 12:30 PM, Jeremy Shaw wrote:
  Does trying to install hsp-0.5.1 work any better?
 
  I hadn't tried it, since it forces hsx-0.7 to install.  But I gave it
  a shot, and it fails the same way:
 
  [ a...@kizaru:~/ ]$ cabal install hsp-0.5.1
  Resolving dependencies...
  Configuring hsp-0.5.1...
  Preprocessing library hsp-0.5.1...
  Building hsp-0.5.1...
  ghc: could not execute: trhsx
  cabal: Error: some packages failed to install:
  hsp-0.5.1 failed during the building phase. The exception was:
  ExitFailure 1

 Is $HOME/.cabal/bin on your $PATH?

 G

He said it is. That would've been too easy.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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

2010-04-26 Thread Peter Verswyvelen
2010/4/25 Patai Gergely patai_gerg...@fastmail.fm:
 (in my own FRP experiments I have an update thread and a render thread).
 I wonder how to nicely deal with state that requires communication with
 the outer world, even though it is functional at heart. For instance, if
 you want to change a vertex buffer or a texture or whatever during the
 update, how do you organise your code? Do you maintain separate pure and
 impure state information blocks?

I don't have a vertex buffers or texture in my update loop. These are
low level details, left to the render loop. Indeed I maintained a pure
information block in the update. If you really wanted to have
low-level access in the update loop, I wouldn't know how to do that,
although keeping two copies could work. Now my experiments were really
simple 2D games, so not really state of the art.

 Deciding between push and pull according to profiling results is a nice
 idea. :) It might be too expensive to do it adaptively during runtime
 (the overhead might easily distort the results and thus render them
 invalid), but treating it as just a flag could give us an interesting
 architecture to play with.

Yes, I see it more in the line of profile based optimization, where
a compiler performs static optimization based on a previous profile.

I kind of abandoned the FRP thing because Haskell just feels a bit too
complicated/abstract for me. It might also be that for the average
person to learn Haskell really well, one needs a mentor. I would love
to follow courses about it actually :)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Haskell Weekly News?

2010-04-26 Thread aditya siram
Hi all,
I haven't seen a Haskell Weekly News in a while. Is there anything I
can do to help?
-deech
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] and [] = True; or [] = False

2010-04-26 Thread Richard O'Keefe


On Apr 27, 2010, at 12:15 AM, Bjorn Buckwalter wrote:


Dear all,

Does it make good sense that 'and []' returns 'True' and 'or []'
returns 'False'?


YES!

There is no other behaviour that would make sense.

You wouldn't expect sum [] to return anything but 0, would you?


What got me thinking about this was the apparently incorrect intuition
that 'and xs' would imply 'or xs'.


Only if not (null xs).

See also Lisp and Scheme, where (AND) - true, (OR) - false,
and look up the behaviour of ∀ and ∃ in a logic book.
(∀x∈s)p(x) does NOT imply (∃x∈s)p(x) because s might be empty.
(This is where the modern ∀ and ∃ part company with Aristotelian
logic.  In syllogisms, all unicorns are white does not count as
true unless there is at least one unicorn.)

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


Re: [Haskell-cafe] Re: What do _you_ want to see in FGL?

2010-04-26 Thread Ivan Miljenovic
On 27 April 2010 03:39, Louis Wasserman wasserman.lo...@gmail.com wrote:
 I'm a fan of making FGL more record-based, but definitely keeping the
 inductive graph style.

Definitely.

 My own biggest gripe with previous versions of FGL was that the graph
 implementations were severely underoptimized.  In particular, PatriciaTree
 left open a lot of optimization.

Wouldn't know much about the optimisation side of things; when I've
used FGL graphs before they usually weren't the bottleneck in my
program.

 Ivan, would you like to set up a darcs repo for FGL-Prime or something at
 code.haskell.org, and start cracking?  I'm really excited for this project.

Sure, let's take these preliminary discussions off-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] Run haskell program in emacs without typing main in the ghci buffer.

2010-04-26 Thread Ivan Miljenovic
On 27 April 2010 05:43, Zura_ x...@gol.ge wrote:
 Is it possible to run haskell program in emacs without typing main in the
 ghci buffer? Assuming main function exists of course.
 Or, maybe automate sending main\n string to ghci buffer input.
 In other words, I want edit/run/see result style session.

This is probably possible if you have enough elisp-fu (which I don't,
but have a look at Flymake Haskell).

If so, it would be better to have this as a different emacs keybinding
rather than the default haskell-load-file one, as 1) you won't always
have a main action and 2) you won't always want to _run_ your main
action (e.g. it launches nuclear missiles and you don't want to run
that when you're just testing your countdown function...).

However, by using :main in the ghci session you have a bit more
control as it allows you to specify command-line flags and inputs,
which running just main doesn't.

-- 
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] Haddock infix constructors in markup

2010-04-26 Thread Ivan Miljenovic
On 27 April 2010 02:15, Ozgur Akgun ozgurak...@gmail.com wrote:
 data Expr = Num Int | Expr :+: Expr | Expr :-: Expr

 [snip]

 -- | If the input is 'Num' does magic, if it is ':+:' does even more magic!
 someFunc :: Expr - Expr

 In the output of this markup, the 'Num' is hyperlinked but the ':+:' is not.

I would hazard a guess that the Num hyperlink points to the Num
typeclass in the Prelude rather than your Num constructor.  As for
your infix constructor, I have no idea.

-- 
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] Haskell Weekly News?

2010-04-26 Thread Joe Fredette

Hehe,

 Mostly, at the moment, as I mentioned to Deech, what is holding me  
up is trying to get HWN and 7 classes worth of finals and papers done.  
This is the last two weeks of my last semester, but it should be all  
done soon.


 I hope to get HWN out shortly after it's all finished up. I shall  
return!


/Joe

On Apr 26, 2010, at 7:54 PM, Ivan Miljenovic wrote:


On 27 April 2010 08:08, aditya siram aditya.si...@gmail.com wrote:

Hi all,
I haven't seen a Haskell Weekly News in a while. Is there  
anything I

can do to help?


My guess is do John's marking, etc. for him so that he has some time
to do the HWN!

We also want him to avoid this situation: http://ro-che.info/ccc/06.html 
 :p


--
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 mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell Weekly News?

2010-04-26 Thread Ivan Miljenovic
On 27 April 2010 10:08, Joe Fredette jfred...@gmail.com wrote:
  I hope to get HWN out shortly after it's all finished up. I shall return!

As long as you don't end up copying the Gentoo situation where the
Gentoo Weekly News died, was resurrected (not sure how many times),
was converted to the Gentoo Monthly News to make it simpler, and then
became the Gentoo Never News (hey, GNN sounds kinda catchy, though not
as good as C :p).

-- 
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] Haskell Weekly News?

2010-04-26 Thread Joe Fredette
Most certainly, the HWN is easy to put together, it's just a little  
time consuming, the weekly schedule is just enough under a normal 40- 
hour courseload. When that number jumps into the high billions (as it  
did this last semester), it becomes someone more difficult to fit in.


HWN will always be HWN, at least as long as I can keep it that way. :D

/Joe


On Apr 26, 2010, at 8:17 PM, Ivan Miljenovic wrote:


On 27 April 2010 10:08, Joe Fredette jfred...@gmail.com wrote:
 I hope to get HWN out shortly after it's all finished up. I shall  
return!


As long as you don't end up copying the Gentoo situation where the
Gentoo Weekly News died, was resurrected (not sure how many times),
was converted to the Gentoo Monthly News to make it simpler, and then
became the Gentoo Never News (hey, GNN sounds kinda catchy, though not
as good as C :p).

--
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] Proper Handling of Exceptional IEEE Floating Point Numbers

2010-04-26 Thread Roman Leshchinskiy
On 24/04/2010, at 22:42, Roman Leshchinskiy wrote:

 On 24/04/2010, at 22:06, Barak A. Pearlmutter wrote:
 
 I was thinking of this:
 
 data T = T Double deriving ( Eq, Ord )
 
 ... GHC basically produces
 
 instance Ord T where
 compare (T x) (T y) = compare x y
 t  u = compare t u == LT
 
 That is indeed what it does.  Which is a plain old bug, since it leads
 to inconsistent behaviour between wrapped vs unwrapped values.
 
 *Main T (0/0) == T (0/0)
 False
 *Main T (0/0)  T (0/0)
 False
 *Main T (0/0)  T (0/0)
 True
 *Main (0/0)  (0/0)
 False
 
 Urgh. You're right, I hadn't thought of this. Would you care to submit a bug 
 report?

I submitted one but on further reflection, this is not so simple. Let's look at 
pairs as an example. At the moment, () is implemented basically like this:

 (a,b)  (c,d) = case compare a c of
   LT - False
   EQ - compare b d
   GT - True

Of course, this means that (0/0,'a')  (0/0,'a'). So we could change the 
implementation:

  (a,b)  (c,d) = a  c || (a == c  b  d)

But now we compare a to c twice which is very bad for, say, ([Int],Int). 
Clearly, we want to use the first definition but it leads to inconsistent 
results for Doubles. I don't see how to solve this while keeping IEEE semantics 
of silent NaNs.

Roman


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


[Haskell-cafe] Re: Run haskell program in emacs without typing main in the ghci buffer.

2010-04-26 Thread Jose A. Ortega Ruiz
Zura_ x...@gol.ge writes:

 Hello,

 Is it possible to run haskell program in emacs without typing main in the
 ghci buffer? Assuming main function exists of course.
 Or, maybe automate sending main\n string to ghci buffer input.
 In other words, I want edit/run/see result style session.

Assuming you're using haskell-mode, does

  M-x inferior-haskell-load-and-run

do what you want? You can of course define a shortcut for it:

  (define-key haskell-mode-map \C-l 'inferior-haskell-load-and-run)

If you don't want to load the file, just run main:
  
   (defun haskell-main ()
  (interactive)
  (inferior-haskell-send-command (inferior-haskell-process)
 :main))

(This a very simple version; there're many possible variations; for
instance, adding (swith-to-haskell) at the end).

HTH,
jao

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


[Haskell-cafe] Abstracted File Library?

2010-04-26 Thread 山本和彦
Hello,

I'm implementing a command which manipulates files both on Unix/Mac
and Windows. I was very surprised because there is not
getStatusChangeTime function. So, I wrote it with CPP.

http://github.com/kazu-yamamoto/Mew/blob/master/bin/hs/Stat.hs

Another problem is that since '\\' is used as the file separator of
Windows, I cannot use regular expression naturally for file path. In
many programming languages, '/' is only file separator for
programmers. And my friend, who is an expert of Windows API, says to me
that Windows API allows '/' as a file separator. Why don't we
use '/' on Windows, too?

Are there any abstracted file library to solve these problems?
Or should I start to write such a library?

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


Re: [Haskell-cafe] Abstracted File Library?

2010-04-26 Thread Marc Weber
Excerpts from Kazu Yamamoto (山本和彦)'s message of Tue Apr 27 04:59:46 +0200 2010:
 Hello,
 
 I'm implementing a command which manipulates files both on Unix/Mac
 and Windows. I was very surprised because there is not
 getStatusChangeTime function. So, I wrote it with CPP.
 
 http://github.com/kazu-yamamoto/Mew/blob/master/bin/hs/Stat.hs
 
 Another problem is that since '\\' is used as the file separator of
 Windows, I cannot use regular expression naturally for file path. In

Clarify this, please. Used by who?
The user may enter \\ which is valid on Windows.

Both Cabal and filepath libraries do have functions operating on
filepath strings. Eg filepath can split them.

I agree that / is valid on Windows.

So before working on user input you have to sanitize paths
by replacing \\ by /

 Are there any abstracted file library to solve these problems?
 Or should I start to write such a library?

Which functions should this library have?

I'm pretty sure that filepath already has most functions you need.
You may want to patch it so that it's using / on Windows when assembling
paths form lists of directory names.

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


Re: [Haskell-cafe] Abstracted File Library?

2010-04-26 Thread 山本和彦
Hello,

 Clarify this, please. Used by who?

It is by System.FilePath.
 Windows: combine home bob == home\\bob

 Both Cabal and filepath libraries do have functions operating on
 filepath strings. Eg filepath can split them.

I'm want to use regular expressions for results of 'combine', for
instance.

 Are there any abstracted file library to solve these problems?
 Or should I start to write such a library?
 
 Which functions should this library have?

isSymbolicLink, linkCounts, etc.

 I'm pretty sure that filepath already has most functions you need.

Not really at least to me.

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


Re: [Haskell-cafe] Abstracted File Library?

2010-04-26 Thread Marc Weber
Hi Kazu,

I don't have a ghc Windows installation at the moment so I can't test.

filepath has functions such as normalise and equalFilePath.

Have a look at splitPath which is using pathSeparators which allows both
\\ and / on Windows.

filpath is using \\ to join pathes though.
So appling normalise on filepath on Windowsn will result in 
having paths containing \\ only.
This will still not help you writing your regex unless you replace / by
\\ on Windows.

It's easy to write [\\/] in regex to catch both.

So maybe a normalisePosix function should be added which always returns
/ ?

The fast way which would work for you only is making pathSeparator
return / only. Then you're done but your code will not be portable..

Including a local copy of filepath for exactly this reason could be an
option for you.

 isSymbolicLink, linkCounts, etc.

Don't know about them..

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


[Haskell-cafe] Re: Curl UTF8

2010-04-26 Thread Aaron Denney
On 2010-04-23, Khudyakov Alexey alexey.sklad...@gmail.com wrote:
 В сообщении от 23 апреля 2010 02:36:07 Rickard Karlsson написал:
 Hi,
 
 I'm trying to download a file in UTF-8 with libcurl(1.3.5) and GHC 6.12:
 import Network.Curl
 
 u = http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-demo.txt;
 main = curlGetString u [] = putStrLn . snd
 
 Which doesn't print the characters correctly. If i read the file from local
 storage with getFile it is displayed properly.

 I think curl knows nothing about encoding and convert one byte to one Char 
 and 
 getFile uses new IO which uses system locale to choose encoding.

Then clearly curl should not return Strings, but byte arrays.  Of
course, curl can very well look at the headers which in this case do
specify UTF-8, and so perhaps it should do the translation itself.

-- 
Aaron Denney
--

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


[Haskell-cafe] Re: The instability of Haskell libraries

2010-04-26 Thread Aaron Denney
On 2010-04-24, John Goerzen jgoer...@complete.org wrote:
 It is a funny thing, because our fundamental libraries *have* had time 
 to settle down, in a sense.  In another sense, I must say that the 
 innovations we have seen recently have been sorely needed and are 
 unquestionably a good thing.

Overall, agreed.  It still makes it a pain to write to the current
standard, because it is moving.

 Unicode support in IO,

This was just a bugfix in GHC, made more painful by people writing
code dependent on the old behaviour.

 I guess this is the price of failing to avoid 
 success, to borrow Simon's phrase.  And again, not entirely bad.

I despair that a better Numeric hierarchy will never make it into
Haskell.

-- 
Aaron Denney
--

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


Re: [Haskell-cafe] Re: The instability of Haskell libraries

2010-04-26 Thread Ivan Miljenovic
On 27 April 2010 14:55, Aaron Denney wno...@ofb.net wrote:
 I despair that a better Numeric hierarchy will never make it into
 Haskell.

I think the reason it hasn't is because I for one still haven't seen a
fully implemented such hierarchy that's worth using.

Then again, most of my numerical calculations are very basic; yay for
combinatorics! :p

-- 
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] Re: The instability of Haskell libraries

2010-04-26 Thread Brandon S. Allbery KF8NH

On Apr 27, 2010, at 00:55 , Aaron Denney wrote:

I despair that a better Numeric hierarchy will never make it into
Haskell.



I thought the main reason for that was that nobody could agree on a  
better hierarchy that was actually usable.  (Nobody wants to chain  
10 typeclasses together to get work done.)


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon universityKF8NH




PGP.sig
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe